Adjust litterrobot tests and code to match guidelines#47060
Conversation
|
@MartinHjelmare, I've made most of the changes you requested. A couple responses to your comments that I haven't addressed yet: (#45886 (comment)): The entity_type that is passed in is controlled, so there isn't a risk of a trailing space at the moment. (#46942 (comment)): Theoretically these can be separate sensors, but I don't know how relevant they are on their own. Sometimes it is interesting to see, just to know what is the basis for the "Waste Drawer" gauge calculation. Should they still be separated and/or removed? (#46942 (comment)): Please see #46942 (comment) for previous conversation on this and let me know how to proceed. |
|
Times in state attributes should be UTC, there is no exception. |
If there's always an entity type passed in we should remove the other case. |
What do these attributes measure? As an example, a temperature measurement from a temperature sensor is relevant on its own, but a brightness measurement from a lamp isn't relevant without knowing if the lamp is on or off. |
Now I see what you are referring to. That was a relic of a previous version of entity_types in HACS that I hadn't removed. Thanks for the catch. |
Is there a way to show only the time portion, whilst storing the absolute UTC time? The reason I ask is that the Litter-Robot API returns an epoch time for when the "sleep mode start time" is first set and is not updated unless the start time is manually changed. So if a user set that a month ago, there is now a month old "sleep mode start time", which makes zero sense to a user. Sure, I could do some "magic" and update the date to be today's date. But then there is another question: do I always show the next start time, or do I show the previous start time while the unit is "sleeping" since it is an 8-hour window? Also, as an end user of the robot, there are really only two pertinent data points associated with "sleep mode":
If there is a date component displayed, the user now has to decipher what it means to gain value out of it, which seems counter-intuitive to what home automation is all about. Again, I look back on the input_datetime helper that only has a time component for how the history is tracked on it and it is precisely the functionality that makes sense for this data point. When I set a time on that helper, it doesn't care about a date and I only see state changes for things that make sense. There isn't a way to create an input_datetime helper through an integration is there? (I tried and got errors.) That would actually solve this altogether... |
370296c to
861e3a6
Compare
|
If the sleep mode measurements are supposed to show the start of the current sleep and the future end of the current sleep, I'd expect the time measurement to include the correct date besides the time. Consider breaking out these measurements to sensors with device class timestamp. Timestamp sensors can be shown as relative time when using the Lovelace frontend entities card. https://developers.home-assistant.io/docs/core/entity/sensor#available-device-classes |
|
Alright, @MartinHjelmare, I moved those attributes to their own timestamp sensor with appropriate absolute UTC time and removed the other attributes on the waste drawer sensor per your guidelines! |
…acuum, adjust and add sensors for sleep mode start/end time
56a1fd8 to
3508218
Compare
Thanks for all your help, @MartinHjelmare! |
Proposed change
Adjust the tests and code to match suggestions from previous PR reviews.
Type of change
Additional information
Checklist
black --fast 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.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: