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

Template switch for rest command

$
0
0

@abali wrote:

I have some lights that do not have status information and can be turned on/off via a rest command. I would like to control this with a switch, but the config below does not work, it says “Script script.kitchen_lights_on already running”. Any ideas?

rest_command:
  kitchen_lights_off:
    url: "http://192.168.1.135/ansluta/0"
  kitchen_lights_50:
    url: "http://192.168.1.135/ansluta/50"
  kitchen_lights_100:
    url: "http://192.168.1.135/ansluta/100"

script:
  kitchen_lights_on:
    sequence:
      - service: rest_command.kitchen_lights_100
      - service: switch.turn_on
        data:
          entity_id: switch.kitchen_lights
  kitchen_lights_off:
    sequence:
      - service: rest_command.kitchen_lights_off
      - service: switch.turn_off
        data:
          entity_id: switch.kitchen_lights

switch:
  - platform: template
    switches:
      kitchen_lights:
        value_template: "{{ states('switch.kitchen_lights') }}"
        turn_on:
          service: script.kitchen_lights_on
        turn_off:
          service: script.kitchen_lights_off

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 96121

Trending Articles



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