python-kasa icon indicating copy to clipboard operation
python-kasa copied to clipboard

[HS220] Dimmer Calibration (preferred_state)

Open Doomsdayrs opened this issue 3 years ago • 6 comments

Is it possible to control the dimmers minimum brightness?

From the sysinfo, I can see that there is the configuration for it.

Is it possible to update?

 'preferred_state': [{'brightness': 100, 'index': 0},
                     {'brightness': 75, 'index': 1},
                     {'brightness': 50, 'index': 2},
                     {'brightness': 25, 'index': 3}],

Doomsdayrs avatar Jun 27 '22 19:06 Doomsdayrs

As far as I know, these are the presets that you can change in the app but I'm not sure if they limit the allowed values. Is the minimum brightness of the dimmer currently 25? In any case, the preset functionality is not currently implemented by this library.

rytilahti avatar Jun 27 '22 23:06 rytilahti

Unfortunate, I hope then someone might be able to figure it out @-@

Only constraints I can guess are 0-100, integer, and has to be in order from greatest to least?

Doomsdayrs avatar Jul 07 '22 23:07 Doomsdayrs

I can't be certain, but it's likely you can modify the preferred states in a similar manner to the lightbulbs. I don't know if that will actually change the behavior of the switch, but feel free to play with the raw-command system and see if it tunes the dimmer behavior like you're hoping: https://github.com/python-kasa/python-kasa/issues/365

mr-ransel avatar Aug 31 '22 20:08 mr-ransel

Have there been any updates on this? It looks like the bulb integration has been added, but has there been any progress on support for Dimmer calibration?

Aptex55 avatar Oct 23 '23 01:10 Aptex55

I was able to use the raw command from the bulb integration. here is how I did it:

kasa --host 192.168.2.206 command --module smartlife.iot.dimmer set_preferred_state "{'index': 3, 'brightness': 25}"
kasa --host 192.168.2.206 command --module smartlife.iot.dimmer set_preferred_state "{'index': 2, 'brightness': 30}"
kasa --host 192.168.2.206 command --module smartlife.iot.dimmer set_preferred_state "{'index': 1, 'brightness': 65}"
kasa --host 192.168.2.206 command --module smartlife.iot.dimmer set_preferred_state "{'index': 0, 'brightness': 100}"

just make sure you replace the host with the host you want to change.

after this

 'preferred_state': [{'brightness': 100, 'index': 0},
                     {'brightness': 65, 'index': 1},
                     {'brightness': 30, 'index': 2},
                     {'brightness': 25, 'index': 3}],

sle118 avatar Mar 01 '24 19:03 sle118

Oh hey that's great! Glad it worked out for you after some tweaking!

Any chance we can get this functionality integrated into the CLI using the normal set preferred state syntax from bulbs?

Robert Ansel

Sent from my Pixel 6, using FairEmail

Mar 1, 2024 11:01:53 AM Sébastien @.***>:

I was able to use the raw command from the bulb integration. here is how I did it:

*kasa --host 192.168.2.206[https://192.168.2.206] command --module smartlife.iot.dimmer set_preferred_state "{'index': 3, 'brightness': 25}" kasa --host 192.168.2.206[https://192.168.2.206] command --module smartlife.iot.dimmer set_preferred_state "{'index': 2, 'brightness': 30}" kasa --host 192.168.2.206[https://192.168.2.206] command --module smartlife.iot.dimmer set_preferred_state "{'index': 1, 'brightness': 65}" kasa --host 192.168.2.206[https://192.168.2.206] command --module smartlife.iot.dimmer set_preferred_state "{'index': 0, 'brightness': 100}" * just make sure you replace the host with the host you want to change.

after this

  • 'preferred_state': [{'brightness': 100, 'index': 0}, {'brightness': 65, 'index': 1}, {'brightness': 30, 'index': 2}, {'brightness': 25, 'index': 3}],

— Reply to this email directly, view it on GitHub[https://github.com/python-kasa/python-kasa/issues/352#issuecomment-1973758503], or unsubscribe[https://github.com/notifications/unsubscribe-auth/ABIWWLVPFCDLQ6UEHQBLHGTYWDGCDAVCNFSM5Z7RLT32U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJXGM3TKOBVGAZQ]. You are receiving this because you commented. [Tracking image][https://github.com/notifications/beacon/ABIWWLQGRT657OIRLKJ44V3YWDGCDA5CNFSM5Z7RLT32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOOWSSUJY.gif]

mr-ransel avatar Mar 03 '24 01:03 mr-ransel