-
-
Notifications
You must be signed in to change notification settings - Fork 25
[REQUEST] Zeroconf DNS TXT records parameters in ZigStarGW-FW to support Home Assistant ZHA network discovery #7 #3
Comments
@Hedda by the way, I took the idea in your request for the original ZigStar gateway. So thank you! |
Cool! It does look like missing a unique service name for the zigstar_zb_gw, baud_rate, and default tcp port is probably not good or? I am not a C/C++ developer and at least not see in the code that you set baud_rate to a specific speed and looks like using the default service name and port? Looks like it uses strings so assume that it is set in configuration via web interface or something? Note that while the service name does not need to contain type of Zigbee MCU (e.i. "cc2652p") however it should perhaps do so because the others have done so. I believe that the important part is that both its unique hostname and unique service name starts with the word "zigstar". Looks like you set the service name now to "zig_star_gw" so wondering if that is on purpose when product is called ZigStar without a space in its name? Anyway, in order to get it working Zeroconf and the ZHA integration in Home Assistant is going to first need to get these things:
Can you maybe post the test results obtained with A compatible result from
@xyzroe @mercenaruss Since I don't have a ZigStar Gateway I can't test it so maybe best would be if you test and submit together? I believe only thing needed you is to change there is these two files (looking at how "tube*" was added for the "zha" domain): https://github.com/home-assistant/core/blob/dev/homeassistant/generated/zeroconf.py Copy this and replace it with your service and name (plus remove https://github.com/home-assistant/core/blob/dev/homeassistant/generated/zeroconf.py#L79
So think should your unique zigstar service discovery for the zha domian should read something like:
Then in the other file copy this and under it replace the matching type and name with your service and name:
So think should your unique zigstar service discovery in the zha integration manifest should read something like:
|
@Hedda thanks for the detailed answer.
|
@mercenaruss Since are its founder I am wondering what your opinion is in regards to how the ZigStar Gatewaty DNS name should be presented via local mDNS? I do not mean to bike-shead this because believe it or not this is imporant for the future as the name you select for local mDNS you will be stuck with in order to keep backwards compatibility with Home Assistant Zeroconf discovery. The problem there is that Home Assistant core should only need to use one name containing a single wildcard for Zeroconf disocvery based on its local mDNS name. As in detection in Home Assistant will use either "zigstar*", "zig-star*", or "zig_star*", but not more than one of them those. With that, I mean that I do not think that we should ask Home Assistant to whitelist more than a single name for Zeroconf discovery of any ZigStar gateway. So the name you select now you will be stuck with forever. Please only pick one and stick with that. So the question is if the local mDNS name for the zigstar gateway firmware should it be "zigstar" or "zig-star", or "zig_star"?
I can do a quick PR in the blind with a [WIP] (Work-In-Progress) tag to Home Assistant core if and when you are sure about hostname and service name but I currently do not have the possibility to test it myself, so you or another user (s) would have to test it and give a thumbs-up when it is OK to remove that [WIP] tag. |
Hi @Hedda , now really busy with work. But in case with ZHA only one coordinator is possible to be used at the moment, so not sure actually what local mDNS to use:
Can you advice on this? With which one we should stick? Btw i dont know what Tubezb used to 2 names for the same cc2652 setup. |
I like to suggest that you either use "zig-star*" or "zigstar*" as the default hostname and the default mDNS/Zeroconf service name. Nothing that it only the "zig-star*" or "zigstar*" prefix that you need to decide and nail down now, anything after that can change. I only mean that "zig_star*" (with a space symbol in its name) does not make sense for consistency when the products are called "ZigStar" (without space or hyphen symbol in it) however your official website currently uses zig-star.com as its domian name. Just be aware but for consistency reason it really makes no sense to use a space symbol in the local mDNS address. Either of the other two makes more sense, regardless you only want to pick one and stick with just that one. Personally think that I recommend you should use "zig-star" as zig-star.local makes sense when the product website is zig-star.com Zeroconf and ZHA integrations in HA don't care about hostname, but need to whitelist both the mDNS prefix and the service prefix. Keep in mind that you might make other models or of the gateway in the future so might want to add model and version too. Example: "zig-star-gateway-cc2652p-v1.local" or "zigstar-gateway-cc2652p-v1.local" If a user has multiple ZigStar gateways they want discoverable on the network then they could add a number or location to those. Example: "zig-star-gateway-cc2652p-v1-1.local" or "zig-star-gateway-cc2652p-v1-livingroom.local" Note! While you are technically allowed to use space symbols in FQDN (Fully Qualified Domain Name) specification please know that Active Directory (AD) does not support space symbol in hostnames, so if your AD entries represent hostnames which you want to match the host public FQDN then understand that space is not a valid character. PS: Yes I have CDO..., it is like OCD, but all the letters are in alphabetical order, as they should be! ;) |
Draft WIP PR posted here now -> home-assistant/core#58224 Can you test and verify? -> https://github.com/Hedda/home-assistant/tree/patch-7 Only two files updated compared to in the dev branch of Home Assistant core:
@mercenaruss The question remains if you wish to change to use different mDNS and service names such as ex. zig-star? |
Then you likely want to change https://github.com/xyzroe/ZigStarGW-FW/blob/main/src/main.cpp#L648-L652 Lines 648 to 652 in fd41317
Again, personally, I think it currently would make the most sense to use However, if you also buy the zigstar.com domain name and migrate to it as your primary public domain then it would make more sense to me to use |
@Hedda I will do it as it will be in the PR in the home-assistant/core that you do, but your draft PR does not pass some checks, could you look and fix it? home-assistant/core/pull/58224 You can leave the service name as it is, that's okay. Personally, I see no reason to make any changes to the name of the service. |
FYI, Zero-configuration networking (zeroconf) looks to have been changed and improved in the Home Assistant 2022.02 release: https://www.home-assistant.io/integrations/zeroconf/ This change is only a concern for custom integration developers. Currently zeroconf matching only allows matching the Since properties are arbitrarily defined by the zeroconf service, the list of named properties has grown over time. Matching now allows for any arbitrarily defined property. All property matches must be lowercase, wildcards are supported The top level keys For example:
|
By the way, Home Assistant founders/leads now explicitly said this year they will prioritize focus on features like these types: https://www.home-assistant.io/blog/2022/01/19/streamlining-experiences/ Check out this video at around 11 min 55 sec in where talk about that focus point about making it easier to get started, etc. https://www.youtube.com/watch?v=t_2D_KoFIfU&t=710s Hopefully, it should be a greater chance of getting more help from other Home Assistant developers with this if ask them. |
FYI, PR home-assistant/core#58224 for Home Assistant core has been closed since cannot test it myself to confirm working or not. It would be more than welcomed if anyone (who owns a ZigStar LAN Gateway) could take over to get zeroconf discovery in ZHA. https://www.home-assistant.io/integrations/zha#discovery-via-usb-or-zeroconf Again, other than Tube's Zigbee Gateways you can also checkout syssi's and thegroove's implementations as proof-of-concept: https://github.com/syssi/esphome-zb-gw03 https://github.com/thegroove/esphome-zeroconf https://github.com/thegroove/esphome-zha-ezsp-zeroconf |
FYI, for reference, noticed that fairecasoimeme from ZiGate is working on PR for Home Assistant to add ZiGate discovery support: See -> home-assistant/core#68577 ("Add ZiGate device on automatic integration USB and ZEROCONF") It will add automatic ZeroConf (MDNS) discovery of ZiGate Ethernet Gateway (not WiFi Gateway), as well as ZiGate USB adapters. https://www.home-assistant.io/integrations/zha#discovery-via-usb-or-zeroconf As you can see in PR, ZHA and Home Assistant developers are assisting fairecasoimeme from ZiGate once PR was submitted. Hopefully, it should be a greater chance of getting more help from other Home Assistant developers with this if you submit a PR. |
@Hedda unfortunately I don't have the opportunity to do this at the moment. |
Don't have a ZigStar to test myself. Hopefully @mercenaruss can look at this after home-assistant/core#68577 been merged. |
@mercenaruss Do you know when the war will end? Other than that, I can't figure out what is required of me? Firmware has long supported Zeroconf DNS TXT records. This mechanism is used to search for ZigStars in the Multitool. If we need to correct some values, please let us know which ones. |
FYI, PR for ZiGate's Zeroconf has been merged in Home Assistant core making it an example for adding additional more readable: |
@mercenaruss any news about ZigStar's Zeroconf merging in Home Assistant ? |
@xyzroe yes,i make the test,give me some days. |
Nice! Looking forward to ZHA supporting. Again you can look at home-assistant/core#58224 as an untested example. Note to not manually edit the https://www.home-assistant.io/integrations/zha#discovery-via-usb-or-zeroconf |
@Hedda Integration of zeroconf is done. |
@mercenaruss Nice, see you submitted home-assistant/core#78237 as pull request to Home Assistant core (for ZHA integration). Note that they also want a matching ZHA docs PR to the
|
@xyzroe Please consider adding Zeroconf DNS TXT Reconds parameters in your firmware for automatic ZHA network discovery, see:
https://community.home-assistant.io/t/zha-automatic-network-discovery-of-zigbee-coordinator-bridges-gateways-ethernet-wifi-network-adapters-that-support-zeroconf/293300
This was previously requested for the original ZigStar gateway firmware here:
mercenaruss/zigstar_gateways#2
As you can see there, Home Assistant needs not only a service to be presented via Zeroconf but also parameters via Zeroconf DNS TXT records which include radio_type, baud_rate, and data_flow_control, which ZHA config flow use during initial configuration. Once your firmware provide those via Zeroconf then patches can be submitted to Home Assistant core which both makes its Zeroconf whitelist it for discovery as well as pass it along to the ZHA domain which uses the DNS TXT record parameters and puts them into the config flow to ZHA. What this achieved is that the user get a pop-up notification that a new device has been discovered and if they use they can go in to get your adapter automatically configured which makes the whole process very user-friendly to new users.
Since you based your new firmware on ZiGate-Ethernet you might also be interested in this same request posted to fairecasoimeme:
fairecasoimeme/ZiGate-Ethernet#7
PS: Please note I'm just a big fan Zigbee based hardware and of the ZHA integration in Home Assistant (as well as the zigpy project which it depends on) but do not actually own a ZigStar. My only wish with this request is to make it easier for users to get started.
The text was updated successfully, but these errors were encountered: