Appdaemon, deconz/configure

Hi all. I’m having some trouble calling deconz configure.
How would a appdaemon call_service look to implement this example
from another thread:

- service: deconz.configure
      data:
        entity: light.closet
        field: "/state"
        data: {"bri_inc":-254, "transitiontime":50}

Not like this anyway…

 mydata="{\"bri_inc\":-254, \"transitiontime\":50}"
 self.call_service("deconz/configure", field='/state' ,entity='light.closet', 
                              data=mydata)

Have a nice day.

You can import the json library and then try like this:

mydata={"bri_inc": -254, "transitiontime": 50}

self.call_service(
    "deconz/configure", 
    field='/state',
    entity='light.closet',
    data=json.dumps(mydata)
)

The json.dumps method converts a python dictionary into JSON.

Thanks, but no luck. The error is:

requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://192.168.1.3:8123/api/services/deconz/configure

I’m out of ideas. Is the configure portion not exposed in hass rest api?

Hello @Flurken,

This this instead


mydata={"bri_inc": -254, "transitiontime": 50}

self.call_service(
    "deconz/configure", 
    field='/state',
    entity='light.closet',
    **mydata
)

Regards

Does the service call work when you enter it manually into the services tool of home assistant?

@Burningstone
Yep. Works fine that way. I tried calling it with a rest client. Just getting a 405.

Ok that’s strange. Fortunately I also have Deconz. I’ll test it on my system as well as soon as I’m home.
Can you please show me the command you entered in the Services tool?

I just tested and this works for me:

mydata={"bri_inc": -254, "transitiontime": 50}

self.call_service(
    "deconz/configure",
    field='/state',
    entity='light.decke_1_buero',
    data=mydata
)

Please be informed that if light.closet is a group than field needs to be ‘/action’, if it is a single light then the field needs to be ‘/state’. In addition if it is a group it only works if it is a deconz group, if you created the group in home assistant it doesn’t work.

Hi, and thanks your your engagement.
Works fine using your example. I’m an idiot. For some reason I assumed (why?) that the data needed to be text/json and not that you could simply just send a dictionary (as you should).

Thank you again and have a nice weekend.

1 Like