Sensor template crashes HASS

Hi again! :slight_smile:

Any ideas of why this yaml code crashes HASS?
I am a bit lost, as it simple stop the docker containter and dont leave any comment on the log file.

- platform: template
  sensors:
    multisensor_6_temp:
      friendly_name: 'MultiSensor 6 Temp'
      value_template: '{{ state.sensor.aeotec_zw100_multisensor_6_temperature_15.state }}' 

If i comment the value_template line, it at least give me an error log, saying that the “value_template” field is missing.

my intention was to create the “persistent” name for the Zwave devices as suggested in the post Persistent Zwave names even after replacing sensor or readding to controller by @jbardi

any ideas?

thanks!

Luis

Try using

state.sensor.aeotec_zw100_multisensor_6_temperature_15

and see if that makes any difference.

No, he is going to need the .state on the end if he expects to actually have the state returned

The problem is that you have “state” in the begining instead of “states”, plural.

It should be

value_template: ‘{{ states.sensor.aeotec_zw100_multisensor_6_temperature_15.state }}’

Plural at the beginning but singular at the end.

Anytime you make changes to your configurations, you should run the new check_config command that was made available in 0.27

If you are on raspberry pi with the all-in-one installer, you will run:

/srv/hass/hass_venv/bin/hass --script check_config

when logged into the terminal as the hass user

This should let you know if you have any syntax errors in your files

Since this is a temperature sensor, you probably want to add:

unit_of_measurement: ‘°F’

or

unit_of_measurement: ‘°C’

As seen here:

- platform: template
  sensors:
    multisensor_6_temp:
      friendly_name: 'MultiSensor 6 Temp'
      value_template: '{{ states.sensor.aeotec_zw100_multisensor_6_temperature_15.state }}'
      unit_of_measurement: '°F'
1 Like

Hi,

I replace it by

- platform: template
  sensors:
    multisensor_6_temp:
      friendly_name: 'MultiSensor 6 Temp'
      value_template: '{{ states.sensor.aeotec_zw100_multisensor_6_temperature_15.state }}'
      unit_of_measurement: '°C'

it still crashes HA. I have not updated it to 0.27 yet, I will do it this evening and will let you know the result of the script. since i run HA from a docker container I assume I will be able to find the script form the termainal window from the container. I will let you know.

thanks for the help!

HELP!

actually after the upgrade it did not work, I couldnt find the script in docker AND now this is broken too:

  - platform: template
    switches:
      siren:
        friendly_name: 'siren'
        value_template: '{{ is_state('switch.siren_switch_13', 'on') }}'
        turn_on:
          service: switch.turn_on
          entity_id: switch.siren_switch_13
        turn_off:
          service: switch.turn_off
          entity_id: switch.siren_switch_13

The good thing is that I got an error message in the log :slight_smile:

16-08-31 19:39:31 homeassistant.util.yaml: while parsing a block mapping
in “/config/switches.yaml”, line 5, column 9
expected , but found ‘’
in “/config/switches.yaml”, line 6, column 39

any hints? the original issue still remains after the upgrade.

HELP :slight_smile:

thanks!

Luis

Can you post your swtiches.yaml file so we can review? Probably a syntax error.

that was it… all of it…

Try using " " around your value template instead of ’ '.

2 Likes

I dont understand why. but it solves the issue with the switch portion. thank you very much.

I also tried to use this in the sensor, but it doesnt work.
any ideas on that one? :slight_smile:
Luis

1 Like

Do you want to see something crazy?

this code, made it work:

  - platform: template
    sensors:
      multisensor_6_temp:
        friendly_name: 'MultiSensor 6 temp'
        value_template: >-
          {% if is_state("sensor.aeotec_zw100_multisensor_6_temperature_15", "0") %}
          0
          {% elif is_state("sensor.aeotec_zw100_multisensor_6_temperature_15", "1") %}
          1
          {% else %}
          {{ states.sensor.aeotec_zw100_multisensor_6_temperature_15.state }}
          {% endif %}

which for me makes absolutely no sense.
I do have another sensor in the same device (burglar) that have that setup. so i copy and paste with the other parameters…
i had to use the last line without any ’ or " i dont know why, but worked. also, if i try to supposed to be right code, using either of the 3 options (meaning " or ’ or nothing) it crashes the docker container without any warning.

in the current setup as in the code i just paste, if i add the: unit_of_measurement: ‘°C’ , it also crashes… so I am not 100% sure that this is working fine or if i step in some memory leak area… not a clue, but it working for the time being…

as always, ideas as very much welcome! :slight_smile:
thanks

Luis