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

Sensor command_line value template is wrong

$
0
0

@Mariusthvdb wrote:

using

  - platform: command_line
    name: Hue Daylight info
    command: !secret hue_daylight_command
    value_template: >
      {{'on' if value_json.state.daylight == 'true' else 'off'}}
    json_attributes:
      - state
      - config
      - name
      - type
      - modelid
      - manufacturername
      - swversion
    scan_interval: 300

I would have hoped to see the state to be ‘On’ right now, since this is the output of the full value_json:

{"state":{"daylight":true,"lastupdated":"2020-03-27T05:42:00"},
 "config": {"on":true,"configured":true,"sunriseoffset":15,"sunsetoffset":-45},
"name":"Daylight",
"type":"Daylight",
"modelid":"PHDL00",
"manufacturername":"Signify Netherlands B.V.",
"swversion":"1.0"}

The sensor is created alright:

and this is what it looks like in the developer-tools/template:


Please have a look what s wrong in the value_template,
thanks!

Posts: 17

Participants: 4

Read full topic


Viewing all articles
Browse latest Browse all 95445

Trending Articles



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