-
Notifications
You must be signed in to change notification settings - Fork 163
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
range: add oven timers and cook timers #843
base: master
Are you sure you want to change the base?
Conversation
and respective state sensors. when no timer is set, timer finish time is set to beginning of current day
@property | ||
def oven_upper_cook_timer_time(self) -> datetime | None: | ||
"""Get the upper cook time finish time.""" | ||
delta = self._get_time_delta( | ||
"UpperCookTimeHour", "UpperCookTimeMin", "UpperCookTimeSec" | ||
) | ||
return self._update_feature( | ||
RangeFeatures.OVEN_UPPER_COOK_TIMER_TIME, | ||
self._get_finish_time(delta), | ||
False, | ||
) |
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 find a way to check if the device provide this sensor (oven_upper_cook
) and if not just return None
, otherwise sensor for not existing cook zone will be created.
This is the same for all the other new properties.
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.
Yes. My oven only has upper, so the lower cook zone sensors are non-functional. I'll make the necessary changes for this.
Also, the stove top of my oven only reports whether any of the (five) burners are on, and it uses the front-left cooktop state to report it. So should cooktop state sensors also be modified (in a separate PR) in the same way you're suggesting here?
Thanks.
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.
Circling back around to this. I don't see any mechanism, in the current code, at least, for the detection of which sensors should or shouldn't be included. Rather, the optional entity_registry_enabled_default
is used to control this regardless of the data coming from the device.
My range has no lower oven, but they are still enabled by default, and though my COOKTOP_LEFT_FRONT_STATE
is valid, it's disabled by default.
Should we just make the call, as is currently done, as to which sensors are enabled by default? Or should we dig deeper and see if there's a way to find out which ones ought to be enabled?
It may be difficult to discern which sensors should be enabled by default, since I observe that the sensors that do not exist for my range show the same values as those that do exist when the range is not in use. We could provide some type of observational state where the user is instructed to go operate their range, turning on and off each cooktop burner, each oven, each timer/setting, and the integration could start with all sensors disabled, and enable each one whose state changes during the observational period. But that sounds complicated and annoying for users.
If we can't find a good method to do this automatically, then we have to make the call. Personally, I think that this integration, being a HACS integration, is for those users that desire more granular control and visibility for their LG appliances/devices, so it would be better to enable everything and let the user disable the inapplicable sensors. Alternatively, we should disable everything and let the user enable them manually. We would then include a note in the read-me or a dialog during setup that not all sensors may apply to their specific appliances/devices.
This change adds timestamp device sensors for upper/lower oven timers and cook times, and respective binary state sensors. When no timer is set, timer finish time is set to beginning of current day.