codm / cc2652p2-tcp-zigbee

ZigBee CC2652P2 Ethernet Coordinator
34 stars 6 forks source link

[REQUEST] Zeroconf support to cod.m ZigBee CC2652P2 TCP Coordinator for Home Assistant ZHA network discovery #1

Open Hedda opened 2 years ago

Hedda commented 2 years ago

Please consider adding Zeroconf support to cod.m ZigBee CC2652P2 TCP Coordinator for automatic ZHA network discovery.

Home Assistant OS (formerly HASSIO) supports automatic network scanning and “Service Discovery” via Zeroconf and when a whitelisted Zigbee serial gateway is discovered it can pass along that to a domain like the ZHA integration component in Home Assistant.

For more details see:

https://community.home-assistant.io/t/zha-automatic-discovery-of-zigbee-coordinator-bridges-gateways-ethernet-wifi-network-devices-that-support-zeroconf-or-ssdp/293300

As a proof-of-concept this is now supported by Tube's Zigbee gateways (based on ESPHome firmware):

https://www.home-assistant.io/integrations/zha#discovery-via-usb-or-zeroconf

https://github.com/tube0013/tube_gateways

Once support for Zeroconf has been added to the firmware you also need the firmware to provide DNS TXT records for passing along setting parameters to integration config flows.

DNS TXT records could be used to pass along recommended settings parameters config flow to Home Assistant's ZHA integration:

radio_type=znp baud_rate=value data_flow_control=software tcp_port_serial_gateway=value

Zeroconf DNS TXT records could also be used to pass along hostname, versions, location, MAC address, and more, etc..

http://www.zeroconf.org/Rendezvous/txtrecords.html

https://en.wikipedia.org/wiki/Zero-configuration_networking#DNS-based_service_discovery

https://en.wikipedia.org/wiki/TXT_record

More information about idea of using DNS TXT records for passing along setting parameters in https://github.com/thegroove/esphome-zbbridge#1 and https://github.com/thegroove/esphome-zha-ezsp-zeroconf

PS: 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.

Hedda commented 2 years ago

FYI, PR for ZiGate's Zeroconf has been merged in Home Assistant core making it an example for adding additional more readable:

https://github.com/home-assistant/core/pull/68577

https://github.com/home-assistant/core/blob/dev/homeassistant/components/zha/manifest.json#L85-L88

https://github.com/home-assistant/core/blob/dev/homeassistant/components/zha/config_flow.py#L198-L201

https://github.com/home-assistant/core/blob/dev/tests/components/zha/test_config_flow.py#L80-L107

https://github.com/home-assistant/core/blob/dev/homeassistant/generated/zeroconf.py#L384-L389

codmpm commented 2 years ago

Hey @Hedda, thanks for the headsup.

I totally would like to do that, but sadly the firmware of the used ethernet serial module (USR-K6) is closed source and currently has no option to set this in the config. Writing my reseller right now and ask if they can forward this to pusr, the maker of the usr-modules.

Best, Patrik

Hedda commented 2 years ago

Doh! Maybe you should consider switching to design with either ESP32 or the Raspberry Pi RP2040 (with Ethernet)? See examples:

https://github.com/tube0013/tube_gateways

https://github.com/mercenaruss/zigstar_gateways/

https://github.com/syssi/esphome-zb-gw03

As you can see there already are a few Zigbee bridges with Ethernet-based on ESP32 but not yet seen any based on RP2040. Ref:

https://www.soselectronic.com/products/wiznet/w5100s-evb-pico-359020

https://www.elektor.com/raspberry-pi/rp2040/wiznet-ethernet-hat-for-raspberry-pi-pico

RP2040 would make it interesting as something new not seen yet, however benefit with ESP32 is Tasmota and ESPHome support:

https://tasmota.github.io/docs/Zigbee/

(ESPHome is used as base for https://github.com/tube0013/tube_gateways and https://github.com/syssi/esphome-zb-gw03)

codmpm commented 2 years ago

Working on an ESP32 variant, but only internally at this will be the same as tubes gateway. So I see no need. The plus of the USR variant was, that it could be cheaper while reatining high quality (no ali esp32 ethernet boards).

I know these boards and had prototypes running with tasmota and espeasy. Esphome was on the list but I did not try it as we then used the usr modules. Let me wait what my reseller says... maybe pusr will update the firmware in any way.

I realy would like to use the RP2040 for this but did not see any software. Already built something with it and am totally excited for the architecture: https://github.com/pa-pa/AskSinPP/discussions/294#discussioncomment-2470725 The WizNet W5500 is at least available. We are checking what we can do.

Hedda commented 2 years ago

Working on an ESP32 variant, but only internally at this will be the same as tubes gateway. So I see no need.

I think there probably is a demand and a need for another ESP32 based gateway if shipping from within the European Union.

Tube's gateway is great from an end-user perspective but they have the downside of being out of stock or low stock and believe being shipped from Australia or the United States(?) which as I'm sure you know gets very costly for customers living in the European Union after both high shipping costs and taxes are added on top of both the actual product and shipping cost.

ZigStar Gateways shipping location from Moldova is a little closer but stil not shipping from within the European Union.

Other than that I think that support for mDNS Zeroconf out-of-the-box and automatic discovery adds value to new users of HA.

PS: Both Tube and ZigStar now also offer PoE (Power-over-Ethernet) models which are more niche but there is also a market for.

codmpm commented 2 years ago

Yeah, thought about the shipping argument... had the same experience with our WLED controller.

PoE for cheap is currently not possible. The best way would be to use the Olimex PES32-POE as tube does. We sell our coordinator with a generic PoE splitter for that. Albeit not many choose this solution.

Checking out the rp2040 variant though and have something in mind for the ESP32 way. Hopefully with PoE.

Hedda commented 2 years ago

Cool, as you said, will probably sell more without PoE, however, if could offer two variants models then catch those customers too.

codmpm commented 2 years ago

Thinking about that and leave the PoE part on the PCB unpopulated.

Hedda commented 2 years ago

Thinking about that and leave the PoE part on the PCB unpopulated.

FYI, that is what Electrorama have done in order to offer multiple variant models of their zoe and zoe-lite + zoe2 and zoe2-lite.

https://electrolama.com/projects/zoe/

https://www.tindie.com/products/electrolama/zoe-lite-zigbee-radio-for-raspberry-pi/

https://www.tindie.com/products/electrolama/zoe-poe-zigbee-radio-rtc-poe-for-raspberry-pi/

https://electrolama.com/projects/zoe2/

So they have the same PCB but sell some with presoldered PoE module as "zoe2" and some without as "zoe2-lite" https://shop.electrolama.com/collections/raspberry-pi-addons/products/zoe2-cc1352p-radio-for-raspberry-pi?variant=37646452883617

https://shop.electrolama.com/collections/raspberry-pi-addons/products/zoe2-cc1352p-radio-rtc-poe-for-raspberry-pi?variant=37646454161569

image

image

Hedda commented 2 years ago

Another good "pro" idea tip from them is to include an RTC (Real-Time-Clock) and clock-battery so that it can be better used as a offline gateway/hub to keep schemas and schedules even when the internet goes down and it reboot, like when there is a power backout.

I read that the new “ITead SONOFF Zigbee Bridge Pro” also has an onboard RTC -> https://github.com/arendst/Tasmota/discussions/14419

With both ESP32 and an RTC it would make it very suitable as a Zigbee2Tasmota gateway -> https://tasmota.github.io/docs/Zigbee/