-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add set_profile service for Vallox integration #120225
Add set_profile service for Vallox integration #120225
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Hey there @andre-richter, @slovdahl, @viiru-, @yozik04, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
7152e2a
to
34cbb9d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's split this PR up into 2, one for the service, one for the sensor
34cbb9d
to
4d1b6f9
Compare
set_profile: | ||
fields: | ||
profile: | ||
required: true | ||
selector: | ||
select: | ||
options: | ||
- label: "Home" | ||
value: "1" | ||
- label: "Away" | ||
value: "2" | ||
- label: "Boost" | ||
value: "3" | ||
- label: "Fireplace" | ||
value: "4" | ||
- label: "Extra" | ||
value: "5" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I am wondering, would this be able to be split up to a select entity and a number entity? I think the select entity would work, but I won't be sure if the logic around it could be reflected correctly, wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set_profile
method in the library supports setting duration. It works only for fireplace
, boost
and extra
profiles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I think a single set_profile service would be fine accepting profile name string and optional duration. Creating int mappings feels to be wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean its not about int mapping, its more about moving to a service or to entities, as entities are more user friendly and accesible, the only question is, is this a good idea for these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not that familiar with python, is there a simple way of having the parameter be coerced into the matching int enum of Profile
from the lib?
or how would the mapping be done? e.g. from "Boost"
to Profile(3)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh but that's not the thing I am worried about, you can indeed do Profile(3)
. I am more wondering if it fits and if it can be done directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
two parallel conversations happening I think :)
I'm not sure about either, my end goal is just to have a service to call from nodered to enable the programmable "extra" profile when my range hood turns on.
But the vallox_websocket_api
makes interactions a bit easier by hiding some of the lower level stuff. Separating this into two entities might mean splitting some of the existing stuff to use the lower level modbus registers.
Like all the modes that allow timing, have separate registers for timing, and also a register for enabling or disabling the timers. And when setting a profile, it clears the existing timers for other profiles. Out of the box there is a priority order the device runs down.
I would keep everything close to the api which is less likely to change.
Scratch that. Misread the code. |
schema=vol.Schema( | ||
{ | ||
vol.Required("profile"): vol.All( | ||
vol.Coerce(int), vol.Clamp(min=1, max=5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use ints as profile. Pass in a string that you would map to a profile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any ideas why originally the Extra
profile was not 'settable'? It's not included in VALLOX_PROFILE_TO_PRESET_MODE_SETTABLE
, but I could add it there and cut down on the definitions in const.py
and use it to map the param.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is some firmware limitation. Vallox's Web UI does not allow to set Extra profile in 2.0.16 (which I currently use).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does the HA side support some sort of conditionals based on the firmware version, it works fine on my .24 version
if someone can verify how it works on .20 i could branch it to either >=.20 or >=.24
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need that Extra profile? Isn’t fireplace and boost sufficient for all the use cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a separate configurable profile that can be used via digital inputs on the board or via modbus or the websocket api.
I'd use Fireplace for the fireplace, and a differently configured extra profile to compensate for my kitchen air extraction.
This way i can avoid pulling a low voltage cable from the kitchen to the air handler, and just trigger the extra profile via a sensor on the kitchen range hood open/close relay.
edit: my kitchen air extraction is not via the vallox unit, so it needs to be tunable separately
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Got it. I have that in Web UI as well. I just did not know where to find it. If you make the parameter settable are you able to turn extra profile on? Would be sad if it would turn off automatically, because we do not apply any voltage on digital input.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merged the settable/reportable constants, settable already supported 'fireplace' mode which works the same as extra mode. |
The code looks OK to me. Test coverage is missing. |
b2272d7
to
32305d5
Compare
Let me know if there's still something pending the requested changes seem to concern something that was discussed and changed already |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me.
32305d5
to
22702e7
Compare
Added documentation in home-assistant/home-assistant.io#33522 |
8d5de30
to
0ff6c0d
Compare
What's the status with this? Has been done for a while and not clear to me at least what's preventing merging. |
|
||
with patch_set_profile() as set_profile: | ||
service_data = {ATTR_PROFILE: profile} | ( | ||
{ATTR_DURATION: duration} if duration is not None else {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should avoid if statements in test code
return False | ||
return True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume the true false is something that is for vallox?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just imitated the other code in the vallox module, maybe someone else can answer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, not 100% sure but might just be a leftover from #56966.
Finally got back to this, rebased to continue working, but i can't commit anything locally due to:
Any tips on this? I couldn't find anything on google related to this in general or directly related to hass. edit: run |
f5b68b6
to
df9a9f8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests are failing but the code starts to look good :)
Co-authored-by: Sebastian Lövdahl <[email protected]>
df9a9f8
to
aa178fc
Compare
Oh shit, forgot to check for the documentation. Can you please open a docs PR from and to the |
has been there for a while: home-assistant/home-assistant.io#33522 |
Proposed change
Add service for activating a profile with optional duration for profiles that support it.
Add sensor for reporting duration left on activated profile.
Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: