For example, I setup AlarmDecoder and it created sensor.alarm_panel_display. When it is ready to arm, the status is “DISARMED CHIME Ready to Arm”. Can I change it to “Ready to Arm”?
Also, if the door is opened, the status is “Fault 01”. Can I change it to something like “Zone 1 is not ready”?
The second door is opened and it shows the status “Fault 2”. Can I change it to “Zone 2 is not ready”?
You can create sensor template that its value will be based on those cases.
Template value should look like:
value_template: >-
{% if is_state(‘sensor.somename’, ‘Fault 01’) %}
Zone 1 is not ready
{% elif is_state(‘sensor.somename’, ‘Fault 02’) %}
Zone 2 is not ready
{% else %}
Armed
{% endif %}
The sensor does not exist. It is created automatically when I add zone for alarmdecoder. How can I add something to the sensor that does not exist in configuraton.yaml file?
Yes, I setup AlarmDecoder with multiple zones. It created multiple binary_sensors for zones and it created sensor.alarm_panel_display. I need to change the status of this sensor.
Great, then you need to extract the name of the sensor that it creates, create sensor template based on that sensor’s state and it will work.
I have few template sensors that work the same with different components that generate other sensors,
Try it, if you have any issues post the error here
Which sensor are you looking at to see “fault 01”? the old sensor or the new sensor you just created?
Are you looking at the status of “sensor.alarm_panel_display_status” or “sensor.alarm_panel_display”?
the old one will still show the old status (fault 01). the new one should show “Zone 1 is not ready”.
Edit: I just noticed the different cases of the status to test for in your template. The template is case sensitive. “FAULT 01” is not the same as “Fault 01”.
There is something in the template that is causing the first two statements to not evaluate as true so the ‘else’ statement gets executed.
Have you ever used the template dev tool? You should probably use that to figure out why you’re first statement isn’t properly evaluating. once you figure that out then the rest should fall into place.
Your template isn’t evaluating properly because your state is getting caught by the if statements. This will result in your template returning the last value that it was set to. This is probably why it still reads the same value.
can you post your whole sensor section in your config? Also, take a picture of this page, with the sensor in question in the display (when the door is open):
If you have custom-ui installed you can change any statedisplay into whatever you want, without having to create any template sensor.
sensor.tarief_daystart:
templates:
icon: >
if (state === '1') return 'mdi:numeric-1-box-multiple-outline';
if (state === '2') return 'mdi:numeric-2-box-multiple-outline';
return 'mdi:fire';
theme: >
if (state === '1') return 'green';
return 'orange';
_stateDisplay: >
if (state === '1') return 'Laag';
return 'Hoog';
In this case see the last _stateDisplay. simply fill in the actual state between the quotes, and add what you want it to display after the return . Note: this doesnt actually change the state, only what is displayed in the frontend.
see:
in your case:
_stateDisplay: >
if (state === 'DISARMED CHIME Ready to Arm') return 'Ready to Arm';
return state;