Hi,
I came across a little bit of issues with attempt of creating template sensor for samsung syncthru sensor.
The problem with samsung syncthru sensors is that when the printer if switched off, sensors are replaced with yellow containers saying that entity doesn’t exist. I therefore started to look into a way of having template sensor which will update itself when syncthru sensors are available and while thye’re not, it will display its own value. I’ve added a lot of 6 new template sensors to the recorder to make sure that the value will be available after HA restart but despite that fact, the template sensor value displays as empty string and only mirrors syncthru sensor when they become available. Below is my attempt to solve the problem:
- platform: template
sensors:
samsung_c43x_series_19216809_tray_1_template:
entity_id:
- sensor.samsung_c43x_series_19216809_tray_1
- sensor.samsung_c43x_series_19216809_tray_1_template
friendly_name: 'Input tray'
value_template: >-
{%- if states.sensor.samsung_c43x_series_19216809_tray_1 is defined and states.sensor.samsung_c43x_series_19216809_tray_1.state != '' -%}
{{ states.sensor.samsung_c43x_series_19216809_tray_1.state }}
{%- else -%}
{{ states.sensor.samsung_c43x_series_19216809_tray_1_template.state }}
{%- endif %}
Can you see what is causing a value from the template sensor not to be restored from DB?
Thanks in advance.