Controlling Fibaro RGBW via REST API

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?

Does it work from the web API? It looks like your token is invalid. Also try the rgb_color without quotes.

The token is valid (both that the simple on/off switch work and the log says ok to me)
Tried to remove the quotes on rgb_color but that complained about {"message": "Data should be valid JSON."}
Removed the quotes of the values i.e. "rgb_color": [255, 0, 0]} that didn’t result in more than[]but didn’t work.
Web API, I assume you mean Lovelace or. It works if I use the slider-control like below

If you click on a light that supports color, you can change the color. To me it looks like you have 4 seperate brightness-only lights. You’ll need to combine them with a template sensor in order to use rgb_color.

The Fibaro RGBW controller in HomeAssistant generates 6 devices

Since there are no good Lovelace card to control these devices I have a plan to build a RGB color picker that does the API calls to HA but first I need to test the API calls via cURL.

In my previous openHAB installation this was one device and nicely integrated with UI and I am a bit surprised that this device doesn’t have better support in HA. I will gladly share/contribute a solution for this but need some help on the way.

Anyone that can guide me on how to get API’s to work with Fibaro RGBW devices?
How can template sensor be used in this scenario? Example?

I took some time to test this more. I used the wrong device. Device #6 works

Examples:

## Set RED color
curl -X POST -H "Authorization: Bearer ${MY_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{"entity_id": "light.albin_rgbw_level_6", "rgb_color": [255, 0, 0]}' \
  http://homeassistant:8123/api/services/light/turn_on

## Set GREEN color
curl -X POST -H "Authorization: Bearer ${MY_TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{"entity_id": "light.albin_rgbw_level_6", "rgb_color": [0, 255, 0]}' \
  http://homeassistant:8123/api/services/light/turn_on

Just a heads-up here. If you migrate from the original ZWave 1.4 integration, or the OpenZwave (beta) integration to the new ZWave JS integration, you will find that Device #6 is missing. There are only five light controls present. I hope that the ZWave JS team will address this omission at some point.

1 Like

Thanks for the info @gcoupe