Short version: I’ve created an overly simple example to show what I’m trying to do, and have verified in the template editor that {{ states(“sensor.smart_meter_correlationid”) }} evaluates properly. So why does HA not put it in the command_line sensor?
- platform: template
sensors:
smart_meter_correlationid:
value_template: 643012
- platform: command_line
name: Smart Meter Test
scan_interval: 7200
command: 'Testing it here: {{ states("sensor.smart_meter_correlationid") }} '
My log file shows that rather than putting the value in, it is “unknown”:
I assume it’s some sort of formatting issue on my part, but I’ve tried all sorts of variations for 3 days now and can’t figure it out. It seems like a start-up race condition, but if that’s the case, why are more people not having problems with it?
Greatly appreciate you trying this… even if it only furthers the puzzle. Trying to think out of the box what could be different with my setup that causes it to not work. I’m using a sensors.yaml file… I assume you are too?
I’m open to suggestions from anybody with ideas on things to try - this really has me stumped!