-
Notifications
You must be signed in to change notification settings - < 8000 a icon="repo-forked" id="fork-button" href="/login?return_to=%2Fzigpy%2Fzigpy" rel="nofollow" data-hydro-click="{"event_type":"authentication.click","payload":{"location_in_page":"repo details fork button","repository_id":120253126,"auth_type":"LOG_IN","originating_url":"https://github.com/zigpy/zigpy/issues/381","user_id":null}}" data-hydro-click-hmac="b642b2e54339542d8eff40a0244ddc0e65c8d4d4f347f05904eea446cb78fcc5" data-view-component="true" class="btn-sm btn"> Fork 183
RFC: Zigpy/API/Radio schemas #381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
pasting from another repo: Is there a reason for why the device schema is passed to both the API and the UART? There are a few configuration options that the API accesses that would essentially have to be passed from the Application to the API to get around the schema structure, which I'm "fixing" by just extending the device schema: https://github.com/zha-ng/zigpy-znp/blob/a6be2f8b2a801ee61df7871f467828d419bb9424/zigpy_znp/config.py#L25-L41 Also, will this schema be replacing the |
What do you think about this structure? # Core zigpy config
database_path: /config/zigbee.db
# Optional zigpy config
ota:
ikea_provider: False
ledvance_provider: False
otau_directory: /config/zigpy_ota
# Core device config, used by all radios
device:
path: /dev/ttyUSB0
baudrate: 57600
# Optional network config, used by all radios
network:
channels: [15, 16, 20]
network_key: '64249a501265ba33494071bf2a72e3f1'
pan_id: 0x1234
extended_pan_id: 0x12345678
# Optional radio-specific config
ezsp_config:
CONFIG_APS_UNICAST_MESSAGE_COUNT: 10
CONFIG_ROUTE_TABLE_SIZE: 16 The top-level Also, the new changes bring new |
this is the feedback i'm looking for. To answer the 1st part, I was going by But now, since you are asking, I can see how this could be useful. So how about this approach:
znp_config:
auto_reconnect: True # would you really want this off???
tx_power: 0
sreq_timeout: 5
etc Thus there won't be collisions between different radio libs and I'm hoping that should make things easier for ZHA
I was thinking about it, but left it for a later PR, however no reason to not get the feed back. network:
update_id: 1
pan_id: 0x1234
extended_pan_id: 00:11:22:33:44:55:66:77:88
trust_center: 11:22:33:44:55:66:77:88:99
mac_address: 22:33:44:55:66:77:88:99:00 # probably not all radios can change MAC?
network_key: [1, 2, 3, 4, ... 16]
channel_mask: 0x12345678
channel: None
|
1., 2. I think relaxing the structure of the radio modules and just expecting a 2. I haven't looked deeply into other radio modules' handling of channels, but I know that TI's ZNP has a primary and secondary (backup) channel mask that it scans on startup to choose the network's channel. There's no way to actually specify an individual channel other than creating a channel mask with that single channel. Is there a benefit to picking a specific channel while selecting more channels in the channel mask? |
API (or equivalent) is totally up to the radio lib implementation, as it is going to be used only by the
I was torn about it. Since for the But I was thinking about exposing is either as a static class method of the |
I'm not quite following. My intention for for the |
I think the primary channel mask is applicable to all radios. Just not sure whether the coordinator scans the channel and might change channel on every start up or only during network formation. I was under impression that to change the channel you need to send a network update to all devices on the current channel then actually change the channel. But devices get and save channel mask upon joining the network and scan for their pan_id accordingly channel mask on every startup |
@doudz you might also want to be in on this discussion about zigpy API and radio schemas as believe that different zigpy-zigate radios could also be in need of custom configuration options too, or? |
As I understand it #372 is also related to this as a "TX Power" setting is an example of an optional extension that is maybe not used by all radio libraries will use but zigpy / ZHA need to be able to permit and configure its option setting. |
Perhaps it should just be noted that I have read that a few projects out there still use bellows as a stand-alone library without zigpy, and the same might hold true for other radio libraries for zigpy too. |
Regarding serial port path, perhaps also consider also including IP-network configuration there too? (Please excuse ranting below but I been very existed recently reading about the new Sonoff ZBBridge). Anyway, ZiGate WiFi module needs config for IP-address and TCP-port (also user and password?)? https://zigate.fr/produit/zigate-pack-wifi-v1-3/ To configure Wi-Fi ZiGate you need to specify IP-address & TCP-port, ex : socket://192.168.1.10:9999 I have also submitted a remote network-connection (Ethernet/Wi-Fi) related request in #297 because I personally run Home Assistant with ZHA in a virtual machine on a Synology NAS and know that many others also run Home Assistant with ZHA on a server that is physically located poorly in the house for Zigbee reception so I would very much like for it to be simple to connect Zigbee adapter/module remotely via example a networked Raspberry Pi or ESP8266/ESP32 (i.e. a networked Arduino) located somewhere else in the house. As I understand people wanting to add network-connected adapter remotely today just use ser2net https://www.zigbee2mqtt.io/how_tos/how_to_connect_to_a_remote_adapter.html As requested in #297 it would be very nice to in the future see other network-connected adapters remotely on Raspberry Pi via some kind of easy to use bridge/gateway software based on a client-server model idea where it maybe just encapsulate (and preferably for security also encrypt) the serial communication for secure communication over a local LAN network, forcing one to on the client-side (i.e. zigpy / ZHA) enter username and password that has been set on server-side (i.e. the software running on a Raspberry Pi with the Zigbee adapter), or at least some kind of unique-code randomly generated on initialization by the server-side. It would, for example, be cool to see the Zigee2Tasmota subproject for 8000 the Tasmota ESP8266 firmware extended to do something similar for a TI CC2530 module as the ZiGate WiFi module does: Itead has also just announced a similar Sonoff Zigbee Bridge / Gateway based on an EZSP module: So how awesome wouldn't be to run Zigee2Tasmota on Sonoff ZBBridge controlled from zigpy / ZHA? |
There's no need. |
Thanks for the clarification. I've made Regarding the
|
Briefly looking at the individual libraries:
15 seems to be the current (non-configurable) default and users didn't seem to mind so using |
|
Also related to zigpy/zigpy-znp#20 and #384 and zigpy/zigpy-cc#42 as another optional extension? zigpy-znp request # 20 = Allow option to disable and enable LED/LEDs on adapter or board Option to configure settings for disabling and enabling LED/LEDs on the Zigbee radio adapter/dongle. |
Any more thought on allowing configuration of TX Power strength for modules with Power Amplifier? As per requests zigpy/zigpy-znp#11 for zigpy-znp and zigpy/zigpy-cc#33 for zigpy-cc radio libraries. |
Atm can be done by radio lib extending the base schema. |
Tip on a channel guide -> https://www.metageek.com/training/resources/zigbee-wifi-coexistence.html |
Just a comment from my little experience. Most of the devices works on Channel 11. |
Yes, channel 11 is a standard channel so most devices should support worki g on that channel. These were select because they fall between wifi channels and get less interference |
Is there a reason for why we're hardcoding channel 15 as the default? Right now there's no trivial way to force TI radios to use a specific channel and instead the radio finds the best of 15, 20, 25 to form the network on, which seems like good default behavior for other radios as well. |
Cannot you add channel 11 in that list. In such I think that would be a better default as this will embarked Channel 11 |
Zigbee channel 11 overlaps with WiFi channel 1 and Konke devices will not try joining networks that are not on channels 15, 20, 25, which doesn't make it a very good default. |
Ok, but then Legrand works only on 11, so you won't get Legrand devices if you do not specify the channel. So from my end not putting 11 is too restrictive. As you don't have 26, Livolo will not join the network either! My advice today on Zigbee, is to use channel 11 by default, and make sure Wifi is not channel 1 As the Konke devices, you have to make it joining 15 , and then you have to switch your network to 11, and the Konke devices will follow by themselves. |
Hmm, I didn't know about those other devices.
Sill, these are just defaults, you can change them when forming your network. It'd be useful to include the current channel and channel mask in the HA user interface somehow, they're already standard properties on |
I agree. It’s on the radar. That said, it will probably have to go in advanced mode as I don’t think they’ll approve it if it is always front and center. I think we should also do an energy scan and default to the best channel in the 15, 20, 25 group for “normal” mode... thoughts? |
It appears that TI radios do only an active scan (looking just for other Zigbee networks) when forming a network to pick the "best" channel and a non-conflicting PAN ID:
Perhaps letting the radio pick the network settings and then exposing some ZCL-based, adapter-agnostic network scanner for performing energy/active scans would let users pick a better channel if they feel like it (maybe once the channel migration feature is being worked on)? All of this UI stuff is easy to write about but actually implementing it seems like a daunting endeavor. |
Why couldn’t we do the scan on our own before we save the config? Edit: in normal mode, no channel picked by user and config is saved -> energy scan, pick best channel present in the channel mask, persist that in the config, form the network? |
Here is how ZiGate based on the Zigbee 3.0 stack behave. If you ask to form a new network and you give a network mask of 0x00000000, then it will do an energy scan, select the best channel and form the new network with that channel. The main concerns I have with that approach is you don't control it. and as stated earlier @puddly some devices requires specific channel (Konke 15, 20 and 2; Livolo 26; Legrand 11; Schneider 11 and 15). So having a channel mask to a reduced number of channel will always make someone unhappy. [edit] by experience , if you are in a dense zone, the controller and the energy scan is not going to help you as the Wifi is going to overlap most of the zigbee channels. So except if you are in a wild field, I'm afraid that the scan will not really help you (at least that what I have seen in a number of ZiGate users). |
I guess you could somehow balance the results of the energy scan (low non-Zigbee background noise) with the results of an active scan (few Zigbee networks on the same channel) to pick a good initial channel. When I get some more free time I will try to test out how channel migration works with Xiaomi devices. Maybe it's simple. |
I have discussed the matter of interferences with a Zigbee device manufacturer (blinds) and their analysis is as the Zigbee is a low-powered device it is affected by almost everything on the Radio . With Xiaomi devices, just forget. No channel migration. I have seen it working for Konke from 15 to 11, for Livolo from 26 to 11, Heiman seems to be the best. Xiaomi has a lot of defect. They for instance have a firmware bug where if the device receive a Leave and Rejoin command, will leave but never try to rejoin . That is the most annoying bug that we have. |
as about the automatic channel selection, probably better just ask user on what channel to form the network or leave it up to the radio lib implementation. We can have a convention if the Realistically speaking, until now the default channel 15 worked pretty good for everyone. And unless you are dev, it is unlikely you are going to have more than one network on channel 15, but even with two-three zigbee networks on channel 15, including the production one I did not have too many issues. IMO, maybe it is better to have ability to change the channel after the network was formed? |
It's all true, but why Legrand chose channel 11 as the default and only channel is beyond me. I would understand channel 25 or 26, but 11 🤯 |
No clue why they did it. I'll see if I can get an answer on that. |
I'm pretty supporting the approach, and the possibility to move from one channel to an other after network formed is a must. |
FYI, zigbee2mqtt / zigbee-herdsman developers has only managed to get the Hue Tap Switch Model 9290011152X by Philip (which is a ZGP = Zigbee Green Power device) to work on channel 11, 15, 20 or 25. More info in zigpy/zha-device-handlers#477
@pipiche38 Are you sure that all your Legrand and Netatmo devices will only pair on channel 11 or could it be that it supports one or more other specific channels as well? Wonder if the manufacturer has this information about supported channels in the device user-manual? No mention about specific pairing channel for Legrand devices in zigbee2mqtt which they do mention on a few other devices https://www.zigbee2mqtt.io/information/supported_devices.html I read there on zigbee2mqtt supported devices that some other devices are also picky about which channels are supported for initial pairing but you would think that it should say in the manual from the manufacturer. |
Up to now ( 2 years experience) Legrand works on 11. Some works on 15 but not all.
For more insight https://github.com/pipiche38/Domoticz-Zigate-Wiki/blob/master/en-eng/Legrand-Netatmo-corner.md
Envoyé de mon iPhone
… Le 7 sept. 2020 à 13:07, Hedda ***@***.***> a écrit :
FYI, zigbee2mqtt / zigbee-herdsman developers has only managed to get the Hue Tap Switch Model 9290011152X by Philip (which is a ZGP = Zigbee Green Power device) to work on channel 11, 15, 20 or 25. More info in zigpy/zha-device-handlers#477
but why Legrand chose channel 11 as the default and only channel is beyond me. I would understand channel 25 or 26, but 11
No clue why they did it. I'll see if I can get an answer on that.
@pipiche38 Are you sure that all your Legrand devices will only pair on channel 11 or could it be that it supports one or more other specific channels as well? Wonder if the manufacturer has this information about supported channels in the device user-manual?
No mention about specific pairing channel for Legrand devices in zigbee2mqtt which they do mention on a few other devices https://www.zigbee2mqtt.io/information/supported_devices.html I read there on zigbee2mqtt supported devices that some other devices are also picky about which channels are supported for initial pairing but you would think that it should say in the manual from the manufacturer.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
ZHA integration relies on python modules providing interface to Zigbee radios/network and all those modules are using zigpy library for basic ZCL/ZDO interfaces and a basic
ControllerApplication
.With diversification of supported modules/protocols, it become problematic to have an uniform interface between ZHA and respective radio module/library, because technically ZHA is not integrating with Zigpy, but with the radio module itself. In other words
zigpy
has just a subset of configuration options a given radio module could implement.With that in mind in 0.20.0 we introduced schemas/configuration dict as a mean to pass parameters from ZHA integration to radio lib implementing interface with the radio.
Most (All?) Zigpy based libraries are currently following this layout:
zigbee.application.ControllerApplication()
<->API()
<-->Uart()
The idea was to have a "configuration" dict which we could pass to
ControllerApplication()
instance and let it parse, handle and pass the required bits to the underlying layers likeAPI()
andUart/Gateway()
instances.My idea was to allow Zigpy to define schema which affects configuration options independent of the radio being used (e.g. OTA) or options which can be implemented by all the radios (e.g.
permit()
) using zigpy.Radios are allowed to extend this schema and include radio specific options.
ATM, current Zigpy schema could be represented by the following
.yaml
And for example bellows extends the above schema with the following options:
Making it all work with ZHA integration config entry options is going to be an interesting challenge (for @dmulcahey :) but that's another story.
I'm open for feedback/suggestions whether it meets the current needs and/or what could be improved?
@puddly @doudz @sanyatuning @billyburly
The text was updated successfully, but these errors were encountered: