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

Comparing char received from a shell_command in a light_template value_template

$
0
0

@ky56 wrote:

Hi, I have just started using Home Assistant and I have a custom controller that I would like to add.

The following configuration works perfectly:

switch:
  platform: command_line
  switches:
    room_light:
      command_on: "/usr/bin/curl -s -o /dev/null -X GET <URL>“
      command_off: "/usr/bin/curl -s -o /dev/null -X GET <URL>”
      command_state: "/usr/bin/curl -s -X GET <URL>”
      value_template: '{{ value == "1" }}'
      friendly_name: "Room Light"

but its supposed to be a light switch so I tried replicating it using template light and I can’t figure out how to make the value_template to work. This is what I have so far and the on / off works fine its updating the current value that doesn’t.

shell_command:
    wib_out_3_1: "/usr/bin/curl -s -o /dev/null -X GET <URL>“
    wib_out_3_0: "/usr/bin/curl -s -o /dev/null -X GET <URL>"
    wib_out_3_t: "/usr/bin/curl -s -o /dev/null -X GET <URL>"
    wib_pin_3: "/usr/bin/curl -s -X GET <URL>"

light:
  - platform: template
    lights:
      room_light:
        friendly_name: "Room Light"
        value_template: '{{ shell_command.wib_pin_3 == "1" }}'
        turn_on:
        - service: shell_command.wib_out_3_1
#          data:
#            entity_id: switch.kitchen_lights
        turn_off:
        - service: shell_command.wib_out_3_0
#          data:
#            entity_id: switch.kitchen_lights

wib_pin_3 is supposed to return the same get request as command_state which is 1 for on and 0 for off. No JSON or anything just a single char. What am I doing wrong with the value_template?

Posts: 8

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 95397

Trending Articles



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