Hi,
I have started to test HomeAssistant REST API in order to control Fibaro RGBW controller.
Tested with a simple on/of switch and this works fine:
curl -X POST -H "Authorization: Bearer ${MY_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"entity_id": "switch.philio_technology_corp_pan11_4_smart_energy_plug_in_switch_switch"}' \
http://homeassistant:8123/api/services/switch/turn_on
Now when trying to set the Red value I get 400: Bad Request
curl -X POST -H "Authorization: Bearer ${MY_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"entity_id": "light.fibaro_system_fgrgbwm441_rgbw_controller_level_2", "rgb_color": "[255, 0, 0]"}' \
http://homeassistant:8123/api/services/light/turn_on
I have checked the services by (sorry for using httpie here):
http --json GET "http://homeassistant:8123/api/services" "Authorization:Bearer ${MY_TOKEN}"
and get:
[
{
"domain": "light",
"services": {
....<<clip>>
"turn_on": {
"description": "Turn a light on.",
"fields": {
....<<clip>>
"entity_id": {
"description": "Name(s) of entities to turn on",
"example": "light.kitchen"
},
"rgb_color": {
"description": "Color for the light in RGB-format.",
"example": "[255, 100, 100]"
},
....<<clip>>
}
}
}
}
]
Turned on debug logging and see this:
2020-09-02 21:13:47 DEBUG (MainThread) [homeassistant.components.http.auth] Authenticated 192.168.1.26 for /api/services/light/turn_on using bearer token
2020-09-02 21:13:47 DEBUG (MainThread) [homeassistant.components.http.view] Serving /api/services/light/turn_on to 192.168.1.26 (auth: True)
2020-09-02 21:13:47 DEBUG (MainThread) [homeassistant.core] Invalid data for service call light.turn_on: {'entity_id': 'light.fibaro_system_fgrgbwm441_rgbw_controller_level_2', 'rgb_color': '[255, 0, 0]'}
Do you have any tips on how to do it?