amidarius / Countdown

A MakeCode project
https://amidarius.github.io/Countdown/
0 stars 0 forks source link

Question about ESP32 HA Z2M intégration of esp32 zigbee #1

Open 0rion12 opened 6 months ago

0rion12 commented 6 months ago

Hello,

Really sorry to bother you via this channel, I know it's not the right place to post this message, but there is no private message option on github, so I didn't know how to contact you.

I just got questions about the message you posted on a esp-zigbee-sdk thread : https://github.com/espressif/esp-zigbee-sdk/issues/302#issuecomment-2029267901

I tried to use the light example of the esp-zigbee-sdk. It is working as expected. I use Z2M with HA. I am able to make it join the network. But then since it is not a supported device, I got nothing under the expose tab.

image

So I was wondering how you manage to get data from your device ? Did you create a custom config or modified the example code of the esp32 to match the configuration of a commercial reference known by Z2M ?

Thank you very much!

amidarius commented 6 months ago

Hello 0rion12, first of all, you do not bother me at all ! 😃

I acquired this ESP32-H2 board last week so i just wanted to play a little bit with this new toy and, after successfully compiled my first example HA_temperature_sensor, well, it was partially successfull. Yes, recognized, still not supported by Z2M (That is another story i am willing and ready to learn !) and i have got some readings from the device as expected. After that, i tried other examples and than, cold shower ! 😄

First problem was that no matter i just compiled and flashed all other examples (As end devices.) to the board and previously deleted that device from Z2M, Z2M still recognized it as HA_temperature_sensor ? 🙄 I suspect that somewhere mac address of ESP32-H2 board is stored/cached inside Zigbee coordinator and pulled from there with all previously acquired infos ? 🤔

As a coordinator for Z2M (Windows 10) i am using Sonoff Zigbee Plus device + Mosquitto (W10) + Node Red (W10) + HASS (VM inside VMware workstation 17 Pro.) + Grafana (For all kind of graphs.) + OpenMQTTGateway + SQLServer (Developer edition.) + MQTT Explorer (For all kind of MQTT debugging related stuff.)

Second, i studied all readme files (Inside .\esp-zigbee-sdk\examples\esp_zigbee_HA_sample\ ) and concluded that all these examples (Acting as end device _HA_color_dimmable_light, HA_on_offlight and _HA_temperaturesensor.) were actually ment to work in pair with other device loaded with apropriate demo example. (Acting as coordinator?)

Look what they said in readme file of HA_temperature_sensor example :

Hardware Required

* One development board with ESP32-H2 SoC acting as Zigbee end-device (loaded with HA_temperature_sensor example)
* A USB cable for power supply and programming
* Choose another ESP32-H2 as Zigbee coordinator (see [HA_thermostat example](../HA_thermostat/))

After that i concluded that support for H2 is in early stages so i do not plan to do anything with that untill they develop much more supported/developed version of this library. Maybe in 6 months/1 year.

At the other side, there are much better supported CC2530/31 modules so, i will try that path in next few weeks/months/devices.

Also, if you need something now, done in no time look at this Zigbee Configurable Firmware and this one of realworld examples DIY Zigbee weather station.

I know that i am not very helpfull with this answer but that is my conclusion regarding ESP32-H2. Little bit dissapointed but did not expected even this much after all.

My email is amidarius at yahoo.com, so any talk about our mutual hobby is welcome ! 😄 And again, you are not bothering me. 😎

lhespress commented 5 months ago

@0rion12 Please Add an new device as the follow links: https://www.zigbee2mqtt.io/advanced/support-new-devices/01_support_new_devices.html, BTW, you can create an new issue for this on https://github.com/espressif/esp-zigbee-sdk/issues.

0rion12 commented 5 months ago

Hello @amidarius,

Thank you for your kind response !

I bought almost the same board but based on esp32-C6 which supports zigbee but also wifi.

I only tried the HA_on_off_light HA_on_off_switch examples, the first I tried is the light and I was able to join the zigbee network but then the device is not recognized. Then after deleting the device from Z2M, I tried to use the switch example but I couldn't get it joigning the zigbee network. Maybe as you say, the address of the esp32 is stored somewhere and the Z2M says "we already saw a device with the same mac address but that was an other type of sensor, it's strange, so we do not accept it inside the network" ? I don't know.

So I just focused on the light example which at least was able to join the network.

As coordinator for Z2M I use the same than you with a raspberry pi 4 with Home Assistant OS and the zigbee2mqtt addon for HA.

Thanks for all the tips and links ! I'm quite familiar with ESP32 microcontrollers, so if possible, I would really like to succeed in using my esp32-C6 board with Z2M.

So I tried to make a "custom config" for the esp32 in Z2M following the same link that you posted @lhespress, but I do not understand everything and how to adapt it to my use case. And I couldn't find a lot of other ressources on how to do it. So for the moment, I haven't managed to get my esp32 to work with Z2M.

For the moment, I can't retrieve the Z2M logs so I'm having trouble understanding what's wrong with my custom configuration. I will first make sure I can recover the logs. Then, I will try to improve my skills on the subject and on zigbee in general.

In the next few weeks I won't have much time to do this, but anyway, I think I'll open a ticket on https://github.com/espressif/esp-zigbee-sdk/issues as you suggest @lhespress to either share my results if I succeeded or ask for help.

Thank you both !