Use defaults for device class UPTIME in Shelly#169148
Conversation
|
Hey there @bieniu, @thecode, @bdraco, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Pull request overview
Aligns Shelly’s uptime sensors with Home Assistant’s default SensorDeviceClass.UPTIME naming/translation behavior by removing the custom translation key.
Changes:
- Drop the
translation_key="last_restart"from Shelly REST and RPC uptime sensor descriptions to use the device-class default. - Remove the now-unused
last_restartentity name string fromstrings.json.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| homeassistant/components/shelly/strings.json | Removes the unused last_restart entity name translation entry. |
| homeassistant/components/shelly/sensor.py | Removes the custom translation key from uptime sensor descriptions so device-class defaults apply. |
| "uptime": RestSensorDescription( | ||
| key="uptime", | ||
| translation_key="last_restart", | ||
| value=lambda status, _: utcnow() - timedelta(seconds=status["uptime"]), | ||
| device_class=SensorDeviceClass.UPTIME, | ||
| entity_registry_enabled_default=False, |
There was a problem hiding this comment.
Update the PR checklist/description to match the actual changes (either add tests covering the uptime sensor naming change or uncheck the “Tests have been added” item).
|
Can we first fix the frontend to display the correct restart time before proceeding with multiple PRs that we will have to revert if the frontend is not fixed? |
|
I don't think this is a breaking change. |
Is there an issue/PR tracking frontend changes? |
I was thinking about migrating it to get it consistent all over, so in each integration you have "uptime" and no longer "last_restart". Worth adding the migration ? |
|
|
I think we should remove |
Breaking change
Sensor for device uptime now uses new sensor class UPTIME:
sensor.device_name_last_restartsensor.device_name_uptimePlease review your automations accordly.
Proposed change
Use defaults for device class UPTIME in Shelly
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.To help with the load of incoming pull requests: