I’m running the following Python command-line script:
sensor:
- platform: command_line
name: sma test
command: "python3 /config/python_scripts/sma.py"
scan_interval: 5
with following dict string as it’s output:
{ u'timestamp': u'2018-01-17 22:46:57',
u'ac_power': 15,
u'daily_yield': 277,
u'total_yield': 596969 }
Creating sensors with coresponding values:
sensor:
- platform: template
sensors:
sma_power:
value_template: "{{ states.sensor.sma_test.state.ac_power }}"
sma_daily:
value_template: "{{ states.sensor.sma_test.state.daily_yield }}"
sma_total:
value_template: "{{ states.sensor.sma_test.state.total_yield }}"
But this is not working and I don’t know why. It’s looks like the output is seen like a string but not parsed as a dict.
What am I doing wrong?