Skip to content

Commit

Permalink
feat(device): added z2m support for SNZB-01 (#460)
Browse files Browse the repository at this point in the history
* Added z2m support for SNZB-01

* docs(device): add z2m support for SNZB-01 in release notes

Co-authored-by: Sabaat Ahmad <sabaata@amazon.com>
Co-authored-by: Xavier Moreno <xaviml.93@gmail.com>
  • Loading branch information
3 people committed Apr 15, 2022
1 parent 80a557b commit 35b2a16
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ PRERELEASE_NOTE
- [HM-PBI-4-FM](https://xaviml.github.io/controllerx/controllers/HM-PBI-4-FM) - add device with Homematic support [ #421 ]
- [HM-PB-6-WM55](https://xaviml.github.io/controllerx/controllers/HM-PB-6-WM55) - add device with Homematic support [ #421 ]
- [PTM215X](https://xaviml.github.io/controllerx/controllers/PTM215X) - Add Z2M support [ #420 ]
- [SNZB-01](https://xaviml.github.io/controllerx/controllers/SNZB-01) - Add Z2M support [ #460 ]
- [ZNXNKG02LM](https://xaviml.github.io/controllerx/controllers/ZNXNKG02LM) - Add Z2M support as a Light and Media Player controller [ #430 ]
7 changes: 7 additions & 0 deletions apps/controllerx/cx_devices/sonoff.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@


class SNZB01LightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"single": Light.TOGGLE, # single click
"double": Light.ON_FULL_BRIGHTNESS, # double click
"long": Light.ON_MIN_BRIGHTNESS, # hold
}

def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"toggle": Light.TOGGLE, # single click
Expand Down
14 changes: 10 additions & 4 deletions docs/_data/controllers/SNZB-01.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@ device_support:
controller: SNZB01LightController
delay: 350
mapping:
- "1 click → Toggle"
- "2 clicks → Full brightness"
- "After 2s holding the button → Minimum brightness"
- 1 click → Toggle
- 2 clicks → Full brightness
- After 2s holding the button → Minimum brightness
integrations:
- name: Zigbee2MQTT
codename: z2m
actions:
- single → 1 click
- double → 2 clicks
- long → After 2s holding the button
- name: ZHA
codename: zha
actions:
- "toggle → 1 click"
- toggle → 1 click
- '"on" → 2 clicks'
- '"off" → After 2s holding the button'

0 comments on commit 35b2a16

Please sign in to comment.