whaleygeek / pyenergenie

A python interface to the Energenie line of products
MIT License
81 stars 51 forks source link

Energenie light dimmer support #126

Closed whaleygeek closed 3 years ago

whaleygeek commented 3 years ago

I have been looking into the Energenie light dimmer tonight.

It turns out it uses the legacy (OOK) Radio, but maps different channel switch messages to different levels. I received this information from Energenie support when I asked them how it works:

Channel 1 on: Turn dimmer On at last light level set Channel 1 off: Turn dimmer Off Channel 2 on: Set dimmer to 20% (turn on at 20% if off) Channel 3 on: Set dimmer to 30% (turn on at 30% if off) Channel 4 on: Set dimmer to 40% (turn on at 40% if off) Channel 2 off: Set dimmer to 60% (turn on at 60% if off) Channel 3 off: Set dimmer to 80% (turn on at 80% if off) Channel 4 off: Set dimmer to 100% (turn on at 100% if off)

whaleygeek commented 3 years ago

There will need to be a new device class written in Devices.py, but as a quick hack to prove your dimmer works, you could use 4 instances of ENER002 and pass both the house code and channel to it, then switch either of the 4 channels on or off to effect one of the 8 requests listed above. A better way would be for us to write a proper device class for it that maps requests to the specific message, but this might get people going for now.

HOUSE_CODE = 0x1234 CH1 = energenie.Devices.ENER002((HOUSE_CODE, 1)) CH2 = energenie.Devices.ENER002((HOUSE_CODE, 2)) CH3 = energenie.Devices.ENER002((HOUSE_CODE, 3)) CH4 = energenie.Devices.ENER002((HOUSE_CODE, 4))

CH1.turn_on() # turn dimmer ON at last level set CH1.turn_off() # turn dimmer OFF CH2.turn_on() # Set dimmer to 20% CH3.turn_on() # Set dimmer to 30% CH4.turn_on() # Set dimmer to 40% CH2.turn_off() # Set dimmer to 60% CH3.turn_off() # Set dimmer to 80% CH4.turn_off() # Set dimmer to 100%

whaleygeek commented 3 years ago

This has now been dealt with via a user contribution. I tested it on my device and it works fine.