Dimming through the API

Hi,
can someone give me an example of how to use a dimmer though the api (as in whats the command?)
I’m currently using HAdotnet and this
CallServiceForEntities(“light.turn_on”, “light.dimmer_1”)
works, but I can’t seem to find the code for dimming

Solution:

to change brightness
Dim rsState = Sclt.CallService("light", "turn_on", New With {.entity_id = "light.dimmer_1", .brightness_pct = TrackBar1.Value})
to change the speed of dimming: 
Dim rsState = Sclt.CallService("light", "turn_on", New With {.entity_id = "light.dimmer_1", .transition  = 5})

The dimming feature is called transition in HA lingo, and they can be requested by passing “transition” key-value pair to the service call. Note that it depends on the integration if this is supported as this is done on the hardware. Likewise, the transition periods are hardware-dependent.

Looking at the hadotnet docs, maybe something like this is what you’re looking for:

CallService("light", "turn_on", new { entity_id = "light.dimmer_1", transition = 5 });

Hey, tx for the tip, but transition is the time it takes to go to the new value.
The thing I needed was brightness, and you gave me the code on how to call it.

1 Like