Tsar
(Christian)
1
Hello,
I defined a rest-command as this :
turn_status_lights_hallway_on:
url: http://192.168.1.6:8123/api/states/light.lights_hallway
method: POST
headers:
authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5xxxxxxxxxxyNjkzOTc4fQ.xxxxxxx-3c8lCIvELTJjpgfcL-8'
content-type: 'application/json'
payload: '{"state":"on"}'
Execution of the service :
- service: rest_command.turn_status_lights_hallway_on
data: {}
This works fine (status changes to on) but all the attributes are gone ?
How can I avoid this ?
FPro
(Florian)
2
What are “the attributes”, what entity is this and how is this connected to your REST command?
Tsar
(Christian)
3
That’s what I get when I use the standard light on/off service :
And here is the definition of the light :
- platform: template
lights:
lights_hallway:
friendly_name: "Lights hallway"
turn_on:
service: homeassistant.turn_on
entity_id: switch.do_not_use_verlichting_hallway
turn_off:
service: homeassistant.turn_off
entity_id: switch.do_not_use_verlichting_hallway
- platform: command_line
switches:
do_not_use_verlichting_hallway:
command_on: 'curl "http://192.168.1.3:80/postEvent.html?action=input&STM=0&MOD=5&CHA=0&EVT=3"'
command_off: 'curl "http://192.168.1.3:80/postEvent.html?action=input&STM=0&MOD=5&CHA=1&EVT=3"'
The rest command is used within the same home assistant.