Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95278

How to parse command_line json

$
0
0

@m486u4ever wrote:

This is my sensors.yaml

  - platform: command_line
    name: kocomtemp
    json_attributes:
      - l_cur_temp
      - l_set_temp
    command: "/config/python_script/kocom.py sensor temp"
    value_template: '{{ value_json.kocom_heat}}'

  - platform: template
    sensors:
      kocom_livingroom_current_temp:
        friendly_name: 'Current Temp'
        value_template: "{{ states.sensor.kocomtemp.attributes.l_cur_temp }}"
        unit_of_measurement: "C"

  - platform: template
    sensors:
      kocom_livingroom_set_temp:
        friendly_name: 'Desired Temp'
        value_template: "{{ states.sensor.kocomtemp.attributes.l_set_temp }}"
        unit_of_measurement: "C"

/config/python_script/kocom.py sensor temp returns like this

{“kocom_heat”: 0, “l_cur_temp”: 24, “l_set_temp”: 23}

However, I cannot parse this using written template.

[homeassistant.components.command_line.sensor] Unable to parse output as JSON

What’s wrong?

Can anybody help?

Posts: 5

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 95278

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>