Skip to content

Commit

Permalink
Update button press listeners for switch
Browse files Browse the repository at this point in the history
  • Loading branch information
bigbadblunt committed Sep 18, 2021
1 parent 73103ad commit 0771eec
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ The color of the LED for generation 2 devices can be changed using the service c

Devices can be locked/unlocked using the service calls `lightwave2.lock` and `lightwave2.unlock`.

For gen2 devices, the brightness can be set without turning thelight on using `lightwave2.set_brightness`.

Firmware 5+ devices generate `lightwave2.click` events when the buttons are pressed. The "code" returned is the type of click:

Code|Hex|Meaning
Expand Down
4 changes: 1 addition & 3 deletions custom_components/lightwave2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,6 @@ async def async_setup_entry(hass, config_entry):
hass.async_create_task(forward_setup(config_entry, "binary_sensor"))
hass.async_create_task(forward_setup(config_entry, "sensor"))



return True

async def async_remove_entry(hass, config_entry):
Expand All @@ -157,6 +155,6 @@ async def async_remove_entry(hass, config_entry):
await hass.config_entries.async_forward_entry_unload(config_entry, "sensor")

async def reload_lw(hass, config_entry):
"""Reload HACS."""

await async_remove_entry(hass, config_entry)
await async_setup_entry(hass, config_entry)
2 changes: 1 addition & 1 deletion custom_components/lightwave2/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async def async_added_to_hass(self):
@callback
def async_update_callback(self, **kwargs):
"""Update the component's state."""
if kwargs["feature"] == "uiButtonPair" and self._lwlink.get_featureset_by_featureid(kwargs["feature_id"]).featureset_id == self._featureset_id:
if kwargs["feature"] == "uiButton" and self._lwlink.get_featureset_by_featureid(kwargs["feature_id"]).featureset_id == self._featureset_id:
self._hass.bus.fire(
"lightwave2.click",
{"entity_id": self.entity_id, "code": kwargs["new_value"]},
Expand Down
2 changes: 2 additions & 0 deletions info.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ The color of the LED for generation 2 devices can be changed using the service c

Devices can be locked/unlocked using the service calls `lightwave2.lock` and `lightwave2.unlock`.

For gen2 devices, the brightness can be set without turning thelight on using `lightwave2.set_brightness`.

Firmware 5+ devices generate `lightwave2.click` events when the buttons are pressed. The "code" returned is the type of click:

Code|Hex|Meaning
Expand Down

0 comments on commit 0771eec

Please sign in to comment.