Does anyone know why I cannot change the state of a light? Here’s the code from command line along with the result:
[grayson@homeassistant .homeassistant]$ curl -X POST -d '{"state": "on"}' http://localhost:8123/api/states/light.bedroom_lamp_l
{
"attributes": {},
"entity_id": "light.bedroom_lamp_l",
"last_changed": "16:24:02 16-04-2016",
"last_updated": "16:24:02 16-04-2016",
"state": "on"
}
The light did not get turned on. What I can do is get the state from a light:
[grayson@homeassistant .homeassistant]$ curl -X GET http://localhost:8123/api/states/light.bedroom_lamp_l{
"attributes": {
"friendly_name": "Bedroom Lamp L"
},
"entity_id": "light.bedroom_lamp_l",
"last_changed": "16:24:15 16-04-2016",
"last_updated": "16:24:15 16-04-2016",
"state": "off"
}
There’s nothing wrong with my light. I can control the state of the light from within the Home Assistant frontend.
The reason why I want to do this is so I can control the devices if I decide to build a custom web page and even control states of devices by using Tasker in Android.