I’m positively stumped here.
Why is this happening? All I did was remove the unique addon prefix from my sensor name (which was to match the MQTT publication topic, so I knew which addon-hostname-machine it came from), which is just normal alphanumeric letters?
I’ve spent about 3 hours banging my head on this syntax error…and it makes zero sense?
This sensor works, but the templates error with syntax errors:
Sensor:
mqtt:
# Temperature and Humidity Reading Sensors
sensor:
# Outside Front Sensor
- name: "6f2b8d81-rtl4332mqtt_HA_Addon Outside Front Sensor Report Time"
force_update: true
state_topic: "homeassistant/sensor/rtl433_by_source/6f2b8d81-rtl4332mqtt_HA_Addon/Acurite-Tower/1234"
availability:
- topic: "homeassistant/sensor/rtl433_by_source/6f2b8d81-rtl4332mqtt_HA_Addon/Acurite-Tower/1234"
value_template: "{{ 'time' in value_json }}"
payload_available: "True"
payload_not_available: "False"
value_template: >-
{{ value_json.time }}
Sensor:
Template:
{{ states.sensor.6f2b8d81_rtl4332mqtt_ha_addon_outside_front_sensor_report_time.last_updated }}
Result:
TemplateSyntaxError: expected token 'end of print statement', got 'f2b8d81_rtl4332mqtt_ha_addon_outside_front_sensor_report_time'
-----BUT----
This sensor works, AND the templates works:
Sensor:
mqtt:
# Temperature and Humidity Reading Sensors
sensor:
# Outside Front Sensor
- name: "rtl4332mqtt_HA_Addon Outside Front Sensor Report Time"
force_update: true
state_topic: "homeassistant/sensor/rtl433_by_source/6f2b8d81-rtl4332mqtt_HA_Addon/Acurite-Tower/1234"
availability:
- topic: "homeassistant/sensor/rtl433_by_source/6f2b8d81-rtl4332mqtt_HA_Addon/Acurite-Tower/1234"
value_template: "{{ 'time' in value_json }}"
payload_available: "True"
payload_not_available: "False"
value_template: >-
{{ value_json.time }}
Sensor:
Template:
{{ states.sensor.rtl4332mqtt_ha_addon_outside_front_sensor_report_time.last_updated }}
Result:
2023-07-16 15:01:20.640491+00:00