Closed igorbernstein closed 6 years ago
I think I figured out what the underlying issue is. This light switch is exposed as 2 endpoints: a light and a switch. The light endpoint contains the main input (server) clusters for turning the light on/off and tracking its state. The switch endpoint on the other hand, only implements the On/Off client, which I'm guessing is meant to be used in a 3 way configuration where it acts as a satellite switch.
The zha component blindly reads the cluster config from bellows: https://github.com/home-assistant/home-assistant/blob/8f083e17f89750d8593ae261b6016112b353dfff/homeassistant/components/zha/const.py#L50
Which doesn't distinguish between server & client clusters and returns the OnOff cluster: https://github.com/rcloran/bellows/blob/4cf12375111f3333d04c00159b07b0b004cc0538/bellows/zigbee/profiles/zha.py#L65
This will end up being used in device initialization, causing the zigbee switch device type to be mapped to a light:
As opposed to a switch.
I think the correct way to fix this is to stop depending on bellows for the static mapping information and instead use the input (server) clusters that are reported by zigbee instead. Please let me know if this is something that you'd want a patch for or if the current static mapping behavior is done on purpose. An alternative solution would be to patch bellows to split out the input (server) clusters from the output (client) clusters and use only the input (server) clusters)
ping @rcloran
After a bit more digging, I can't figure out how one would even configure the light switch client on the second endpoint. I would like to hide that endpoint from home assistant altogether. So as a separate change, I was wondering if it would make sense to add "hidden" or "ignored" component value in zha/const.py (alongside the existing light, switch and binary_sensor) that can be configured in my configuration.yaml#zha.device_config.
The light/switch detection won’t change much functionality. The only difference I can think of is that I added state read on startup from HA lights, but not switches.
It’s unusual for the device to report its state on one endpoint while being controlled on another. In fact, I’m fairly sure it’s not in spec to report the light switch profile but not have an OnOff input cluster.
The problem is that HA creates the platform device for the non-conforming endpoint, even though it doesn’t have the required clusters:
It then throws inside the component, which assumes that the OnOff (input) cluster exists.
I think it’d be easiest to add a notion of “required clusters” to the HA components, and not try and create the device if they’re not implemented.
I can confirm the similar behavior/issue with 45857GE dimmer. python --version Python 3.5.3
hass --version 0.62.1
component/platform zha/Debian stretch, armhv arch (Raspberry Pi)
Traceback (most recent call last):
File "/home/lex/homeassistant/lib/python3.5/site-packages/bellows/zigbee/endpoint.py", line 141, in __getattr__
return self._cluster_attr[name]
KeyError: 'on_off'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/lex/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_component.py", line 397, in _async_add_entity
yield from entity.async_device_update(warning=False)
File "/home/lex/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 306, in async_device_update
yield from self.async_update()
File "/home/lex/homeassistant/lib/python3.5/site-packages/homeassistant/components/light/zha.py", line 158, in async_update
result = yield from zha.safe_read(self._endpoint.on_off, ['on_off'])
File "/home/lex/homeassistant/lib/python3.5/site-packages/bellows/zigbee/endpoint.py", line 143, in __getattr__
raise AttributeError
AttributeError
Here's output for bellows devices
Device:
NWK: 0xe147
IEEE: 00:22:a3:00:00:1c:6e:6d
Endpoints:
1: profile=0x104, device_type=DeviceType.DIMMABLE_LIGHT
Input Clusters:
Basic (0)
Identify (3)
Groups (4)
Scenes (5)
On/Off (6)
Level control (8)
Metering (1794)
Diagnostic (2821)
Output Clusters:
Time (10)
Ota (25)
2: profile=0x104, device_type=DeviceType.DIMMER_SWITCH
Input Clusters:
Basic (0)
Identify (3)
Diagnostic (2821)
Output Clusters:
Identify (3)
On/Off (6)
Level control (8)
I can turn off the lights and control the dimming level, but I can't turn the lights on using HA.
Looking at Section 2.3.1 On/Off Switch
in this doc:
https://www.nxp.com/docs/en/user-guide/JN-UG-3076.pdf
It doesn't seem like the switch device type is supposed to implement any server clusters other then Basic & Identify. However they are required to implement an On/Off client cluster. While lights are required to implement an On/Off server cluster. I think you are supposed to be able to bind an On/Off client cluster to an On/Off server cluster. And the switch will act like a command generator using its On/Off client clusters to send commands to server clusters on a light's On/Off. Which would enable you to implement a 3-way switch over zigbee.
If I'm correct in this interpretation, then I don't think it's useful to export switches to home assistant.
Have you encountered devices that report themselves as On/Off Light Switch (0x0103) or Dimmer Switch(0x0104) or Colour Dimmer Switch (0x0105) that have On/Off server clusters?
Note: server = input cluster, client = output cluster
The binding section on page 16 of this doc, seems to confirm my suspicion: https://products.currentbyge.com/sites/products.currentbyge.com/files/document_file/DT200-GE-Zigbee-Primer-Whitepaper.pdf
It seems like zigbee switches are closer to HA's binary sensors then HA lights or HA switches
Right - I was confusing lights and light switches. I don't have one of these devices, so I can't test any code. Happy to review a PR, though.
@igorbernstein . and @rcloran Sorry did not see this post and created this issue.
Do you have any insight on why i can not turn it on and 45857GE is not triggered when operated remotely? Thanks
Check https://github.com/home-assistant/home-assistant/pull/12924
On Fri, Apr 13, 2018, 00:52 kdjordjev notifications@github.com wrote:
@igorbernstein https://github.com/igorbernstein . and @rcloran https://github.com/rcloran Sorry did not see this post and created this issue https://github.com/home-assistant/home-assistant/issues/13766.
Do you have any insight on why i can not turn it on and 45857GE is not triggered when operated remotely? Thanks
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/home-assistant/home-assistant/issues/11847#issuecomment-381023177, or mute the thread https://github.com/notifications/unsubscribe-auth/AFjmcEH9Dh3MZW8yJKXBeF0CHYfD9hx7ks5toC8UgaJpZM4Rl5-v .
Thank you @Adminiuga . this worked for me. I can turn the light off. However the light component in hass.io does not respond to manual operation of the dimmer. It stays in previous state Is this expected. How to fix it?
However the light component in hass.io does not respond to manual operation of the dimmer. It stays in previous state
Yep, same here. async_update() in light/zha.py component should pull the latest state eventually, but right now it is not tied up directly to the operation of the wall switch. I was thinking about adding "attribute reporting" to the zha lights, to make the state update more dynamic.
alternatively you could try "zha: Support switches/buttons/remotes" pull request with should give you a "binary_switch" in HA for 45857GE which you could tie to your lights (or any other lights) using automation. Something like:
Make sure you are running the latest version of Home Assistant before reporting an issue.
You should only file an issue if you found a bug. Feature and enhancement requests should go in the Feature Requests section of our community forum:
Home Assistant release (
hass --version
): 0.61.1Python release (
python3 --version
): Python 3.6.4Component/platform: zha/os x
Description of problem: Device: GE ZigBee Wireless Smart Lighting Control Switch 45856GE Controller: Linear HUSBZB-1
What works: Home assistant is able to discover the device and it appears in the dashboard as
Jasco Products 45856
. Toggling it in the dashboard correctly controls the switch.What doesn't: It doesn't appear that home assistant can read the current status of the switch. Physically changing the state of the switch doesn't update the dashboard.
I'm fairly new to home automation, but I believe the issue is that the switch presents itself as 2 endpoints, where one endpoint is used for writing state and the other is used for reading state.
Output from
bellows devices -D $PWD/.homeassistant/zigbee.db
Expected: No errors during zha.permit and the dashboard to reflect manually changed state of the switch.
Problem-relevant
configuration.yaml
entries and steps to reproduce:brew install python3
hass --open-ui
zha.permit
service callTraceback (if applicable): When adding the switch to hass via
zha.permit
, I can see errors in the logs:Additional info: Output from logs: