BixZod
(Matteo Z.)
August 13, 2022, 12:02am
1
Hi, I was wondering if it is possible to change the sensor status names, for example:
instead of appearing as “on” and “off” I want to tell HASSIO that “on ” stands for “Currently online ” and “off ” stands for “Currently offline ”
it’s possible? thank you
tom_l
August 13, 2022, 12:06am
2
If it’s a binary sensor pick a device class: https://www.home-assistant.io/integrations/binary_sensor/#device-class (connectivity
is probably the closest).
Set it either using the UI or manually using customize.
If you want custom device classes rather than the core ones vote here:
Rather than maintaining an ever growing list of binary type device classes to support things like people having windows that open horizontally or gates or mailboxes, etc…
Could a custom device class option be implemented that would be defined something like this:
device_class:
- binary_sensor:
- <device_class_name>:
state_off: <off state word>
state_on: <on state word>
icon_off: <mdi icon for off state>
icon_on: <mdi icon for on state>
All optio…
1 Like
BixZod
(Matteo Z.)
August 13, 2022, 12:35am
3
Thanks a lot, but it doesn’t work because I already have another binary_sensor done like this:
binary_sensor:
- platform: rest
resource: http://192.168.1.150:***/api.cgi?cmd=GetMdState&user=***&password=***
name: Reolink_Ingresso
device_class: motion
value_template: "{{ value_json[0].value.state }}"
scan_interval: 2
When I go to add:
device_class:
- binary_sensor:
- binary_sensor.rtx2070:
state_off: 'Attualmente Offline'
state_on: 'Attualmente Online'
icon_off: mdi:account-badge-outline
icon_on: mdi:account-badge
I go to check the configuration it gives me an error.
tom_l
August 13, 2022, 12:52am
4
BixZod:
When I go to add:
Do not use the format suggested in the Feature Request . Feature requests are just that, requests for new features. Thy have not been implemented and may never be implemented. All you do there is vote for it if you want it. Like I said:
What you need to do until that gets implemented is follow the instructions in the first two links I provided:
Or since you are using the rest sensor just do this:
binary_sensor:
- platform: rest
resource: http://192.168.1.150:***/api.cgi?cmd=GetMdState&user=***&password=***
name: Reolink_Ingresso
device_class: connectivity #### <-----Changed here ###
value_template: "{{ value_json[0].value.state }}"
scan_interval: 2
However I suspect that is a completely unrelated movement sensor (no idea why you posted it). So don’t change that particular one.
1 Like
BixZod
(Matteo Z.)
August 13, 2022, 11:22am
5
I explained myself badly, if I add :
device_class:
- binary_sensor:
- binary_sensor.rtx2070:
state_off: 'Attualmente Offline'
state_on: 'Attualmente Online'
icon_off: mdi:account-badge-outline
icon_on: mdi:account-badge
it gives me an error because there is this:
binary_sensor:
- platform: rest
resource: http://192.168.1.150:***/api.cgi?cmd=GetMdState&user=***&password=***
name: Reolink_Ingresso
device_class: motion
value_template: "{{ value_json[0].value.state }}"
scan_interval: 2
But if I remove the latter and just leave this other one:
device_class:
- binary_sensor:
- binary_sensor.rtx2070:
state_off: 'Attualmente Offline'
state_on: 'Attualmente Online'
icon_off: mdi:account-badge-outline
icon_on: mdi:account-badge
works perfectly, now my question is, how do I get both to work without errors??
tom_l
August 13, 2022, 11:26am
6
BixZod:
if I remove the latter and just leave this other one:
device_class:
- binary_sensor:
- binary_sensor.rtx2070:
state_off: 'Attualmente Offline'
state_on: 'Attualmente Online'
icon_off: mdi:account-badge-outline
icon_on: mdi:account-badge
works perfectly
That is not possible. That is not how you customize a device . That is config you have copied from a feature REQUEST that has not been implemented.
Delete all of that and do this instead (for the third and final time):