Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
12.32k stars 1.69k forks source link

ZY-M100-S_1 sensors report every second #19045

Open seblu opened 1 year ago

seblu commented 1 year ago

What happened?

The Tuya ZY-M100-S_1 (_TZE204_sxm7l9xa) is reporting its values every second. This values can or can not changes.

Here is an example with values not changing: Screenshot_20230921_231622

What did you expect to happen?

A delay or minimal value change that can be configured in the Reporting tab.

How to reproduce it (minimal and precise)

Pair the sensor and it starts sending data every second or 2.

Zigbee2MQTT version

1.33.0

Adapter firmware version

20221226

Adapter

Silicon_Labs_Sonoff_Zigbee_3.0_USB_Dongle_Plus_0001

Debug log

debug 2023-09-21 23:20:33: Received Zigbee message from 'Toilet Presence', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,0],"type":"Buffer"},"datatype":2,"dp":109}],"seq":6912}' from endpoint 1 with groupID 0
info  2023-09-21 23:20:33: MQTT publish: topic 'zigbee2mqtt/Toilet Presence', payload '{"detection_delay":0,"fading_time":5,"illuminance_lux":3,"last_seen":"2023-09-21T21:20:33.910Z","linkquality":105,"maximum_range":1.95,"minimum_range":0.75,"presence":false,"radar_sensitivity":0,"target_distance":0}'
debug 2023-09-21 23:20:35: Received Zigbee message from 'Toilet Presence', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,0],"type":"Buffer"},"datatype":2,"dp":109}],"seq":7168}' from endpoint 1 with groupID 0
info  2023-09-21 23:20:35: MQTT publish: topic 'zigbee2mqtt/Toilet Presence', payload '{"detection_delay":0,"fading_time":5,"illuminance_lux":3,"last_seen":"2023-09-21T21:20:35.506Z","linkquality":105,"maximum_range":1.95,"minimum_range":0.75,"presence":false,"radar_sensitivity":0,"target_distance":0}'
debug 2023-09-21 23:20:37: Received Zigbee message from 'Toilet Presence', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,0],"type":"Buffer"},"datatype":2,"dp":109}],"seq":7424}' from endpoint 1 with groupID 0
info  2023-09-21 23:20:37: MQTT publish: topic 'zigbee2mqtt/Toilet Presence', payload '{"detection_delay":0,"fading_time":5,"illuminance_lux":3,"last_seen":"2023-09-21T21:20:37.101Z","linkquality":105,"maximum_range":1.95,"minimum_range":0.75,"presence":false,"radar_sensitivity":0,"target_distance":0}'
debug 2023-09-21 23:20:38: Received Zigbee message from 'Toilet Presence', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,0],"type":"Buffer"},"datatype":2,"dp":109}],"seq":7680}' from endpoint 1 with groupID 0
info  2023-09-21 23:20:38: MQTT publish: topic 'zigbee2mqtt/Toilet Presence', payload '{"detection_delay":0,"fading_time":5,"illuminance_lux":3,"last_seen":"2023-09-21T21:20:38.697Z","linkquality":102,"maximum_range":1.95,"minimum_range":0.75,"presence":false,"radar_sensitivity":0,"target_distance":0}'
debug 2023-09-21 23:20:40: Received Zigbee message from 'Toilet Presence', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,0],"type":"Buffer"},"datatype":2,"dp":109}],"seq":7936}' from endpoint 1 with groupID 0
info  2023-09-21 23:20:40: MQTT publish: topic 'zigbee2mqtt/Toilet Presence', payload '{"detection_delay":0,"fading_time":5,"illuminance_lux":3,"last_seen":"2023-09-21T21:20:40.293Z","linkquality":105,"maximum_range":1.95,"minimum_range":0.75,"presence":false,"radar_sensitivity":0,"target_distance":0}'
debug 2023-09-21 23:20:41: Received Zigbee message from 'Toilet Presence', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,0],"type":"Buffer"},"datatype":2,"dp":109}],"seq":8192}' from endpoint 1 with groupID 0
info  2023-09-21 23:20:41: MQTT publish: topic 'zigbee2mqtt/Toilet Presence', payload '{"detection_delay":0,"fading_time":5,"illuminance_lux":3,"last_seen":"2023-09-21T21:20:41.889Z","linkquality":109,"maximum_range":1.95,"minimum_range":0.75,"presence":false,"radar_sensitivity":0,"target_distance":0}'
debug 2023-09-21 23:20:43: Received Zigbee message from 'Toilet Presence', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,0],"type":"Buffer"},"datatype":2,"dp":109}],"seq":8448}' from endpoint 1 with groupID 0
info  2023-09-21 23:20:43: MQTT publish: topic 'zigbee2mqtt/Toilet Presence', payload '{"detection_delay":0,"fading_time":5,"illuminance_lux":3,"last_seen":"2023-09-21T21:20:43.684Z","linkquality":105,"maximum_range":1.95,"minimum_range":0.75,"presence":false,"radar_sensitivity":0,"target_distance":0}'
debug 2023-09-21 23:20:45: Received Zigbee message from 'Toilet Presence', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,0],"type":"Buffer"},"datatype":2,"dp":109}],"seq":8704}' from endpoint 1 with groupID 0
info  2023-09-21 23:20:45: MQTT publish: topic 'zigbee2mqtt/Toilet Presence', payload '{"detection_delay":0,"fading_time":5,"illuminance_lux":3,"last_seen":"2023-09-21T21:20:45.081Z","linkquality":102,"maximum_range":1.95,"minimum_range":0.75,"presence":false,"radar_sensitivity":0,"target_distance":0}'
debug 2023-09-21 23:20:46: Received Zigbee message from 'Toilet Presence', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,0],"type":"Buffer"},"datatype":2,"dp":109}],"seq":8960}' from endpoint 1 with groupID 0
info  2023-09-21 23:20:46: MQTT publish: topic 'zigbee2mqtt/Toilet Presence', payload '{"detection_delay":0,"fading_time":5,"illuminance_lux":3,"last_seen":"2023-09-21T21:20:46.674Z","linkquality":105,"maximum_range":1.95,"minimum_range":0.75,"presence":false,"radar_sensitivity":0,"target_distance":0}'
debug 2023-09-21 23:20:48: Received Zigbee message from 'Toilet Presence', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,0],"type":"Buffer"},"datatype":2,"dp":109}],"seq":9216}' from endpoint 1 with groupID 0
info  2023-09-21 23:20:48: MQTT publish: topic 'zigbee2mqtt/Toilet Presence', payload '{"detection_delay":0,"fading_time":5,"illuminance_lux":3,"last_seen":"2023-09-21T21:20:48.272Z","linkquality":105,"maximum_range":1.95,"minimum_range":0.75,"presence":false,"radar_sensitivity":0,"target_distance":0}'
debug 2023-09-21 23:20:49: Received Zigbee message from 'Toilet Presence', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,0],"type":"Buffer"},"datatype":2,"dp":109}],"seq":9472}' from endpoint 1 with groupID 0
info  2023-09-21 23:20:49: MQTT publish: topic 'zigbee2mqtt/Toilet Presence', payload '{"detection_delay":0,"fading_time":5,"illuminance_lux":3,"last_seen":"2023-09-21T21:20:49.866Z","linkquality":109,"maximum_range":1.95,"minimum_range":0.75,"presence":false,"radar_sensitivity":0,"target_distance":0}'
debug 2023-09-21 23:20:51: Received Zigbee message from 'Toilet Presence', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,0],"type":"Buffer"},"datatype":2,"dp":109}],"seq":9728}' from endpoint 1 with groupID 0
info  2023-09-21 23:20:51: MQTT publish: topic 'zigbee2mqtt/Toilet Presence', payload '{"detection_delay":0,"fading_time":5,"illuminance_lux":3,"last_seen":"2023-09-21T21:20:51.462Z","linkquality":105,"maximum_range":1.95,"minimum_range":0.75,"presence":false,"radar_sensitivity":0,"target_distance":0}'
debug 2023-09-21 23:20:53: Received Zigbee message from 'Toilet Presence', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,0],"type":"Buffer"},"datatype":2,"dp":109}],"seq":9984}' from endpoint 1 with groupID 0
info  2023-09-21 23:20:53: MQTT publish: topic 'zigbee2mqtt/Toilet Presence', payload '{"detection_delay":0,"fading_time":5,"illuminance_lux":3,"last_seen":"2023-09-21T21:20:53.058Z","linkquality":105,"maximum_range":1.95,"minimum_range":0.75,"presence":false,"radar_sensitivity":0,"target_distance":0}'
debug 2023-09-21 23:20:54: Received Zigbee message from 'Toilet Presence', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,0],"type":"Buffer"},"datatype":2,"dp":109}],"seq":10240}' from endpoint 1 with groupID 0
info  2023-09-21 23:20:54: MQTT publish: topic 'zigbee2mqtt/Toilet Presence', payload '{"detection_delay":0,"fading_time":5,"illuminance_lux":3,"last_seen":"2023-09-21T21:20:54.653Z","linkquality":105,"maximum_range":1.95,"minimum_range":0.75,"presence":false,"radar_sensitivity":0,"target_distance":0}'
debug 2023-09-21 23:20:56: Received Zigbee message from 'Toilet Presence', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,0],"type":"Buffer"},"datatype":2,"dp":109}],"seq":10496}' from endpoint 1 with groupID 0
info  2023-09-21 23:20:56: MQTT publish: topic 'zigbee2mqtt/Toilet Presence', payload '{"detection_delay":0,"fading_time":5,"illuminance_lux":3,"last_seen":"2023-09-21T21:20:56.250Z","linkquality":109,"maximum_range":1.95,"minimum_range":0.75,"presence":false,"radar_sensitivity":0,"target_distance":0}'
tandarra commented 2 months ago

Take a look here - https://github.com/wzwenzhi/Wenzhi-ZigBee2mqtt/issues/11

Pretty sure your device can be OTA updated by Wenzhi to disable distance reporting.

mremedi2023 commented 2 months ago

@java-devilIntentaré hacer todo lo posible por seguir los pasos que seguí. No estoy seguro de si todo era necesario, pero así es como hice que funcionara el mío.

Primero conéctelos a zigbee2mqtt para ver qué modelo tiene y confirmar qué firmware necesita

zigb2mqtt

Seguir@Andrik45719Guía de Github: https://github.com/Andrik45719/ZY-M100

Modificadores:

  • Informe de distancia objetivo (DP: 9) deshabilitado.
  • El intervalo del informe de configuración (DP: 1, 4, 2, 3, 6, 101, 102, 103, 104) aumentó a 60 s, FW estándar 10 s.
  • El intervalo de informe de lux de iluminancia (DP 104) se aumentó a 10 s, FW estándar 500 ms

Modelos compatibles: a fecha 20/09/24

  • ZY-M100_L (_TZE204_ztc6ggyl)
  • ZY-M100-S_1 (_TZE204_sxm7l9xa, _TZE204_e5m9c5hl)
  • ZY-M100-S_2 (_TZE204_qasjif9e)
  • ZY-M100-24G (_TZE204_ijxvkhd0)
  • ZY-M100-24GV2 (_TZE204_7gclukjs)

Supongo que los binarios vinieron primero de Andrik, quien los respaldó, los leyó y los modificó para que se adaptaran; es posible que otros modelos hayan recibido ayuda de otros miembros, como@jgarridoalcazarTambién los envío, no quiero asumir lo que está pasando, pero ciertamente aprecio el aporte de todos para que lleguemos hasta aquí. https://github.com/Andrik45719/ZY-M100/issues/4

  • Descargue e instale MSYS2 - https://www.msys2.org/
  • Encontré un problema durante la instalación y tuve que crear manualmente estas cuatro carpetas: C:\Windows\System32\drivers\etc

cuatro carpetas

  • Ejecute msys2 e ingrese "pacman -Sy mingw-w64-86_64-openocd" para instalar OpenOCD

msys2-openocd

Zadig

  • Descargue los controladores de libusb y coloque libusb-1.0.dll en la biblioteca mingw64: C:\msys64\mingw64\lib (no estoy seguro de si esto era realmente necesario ya que los archivos se ven similares, simplemente me encontré con otra persona que hacía esto en línea)

libusb

  • Conecte su dispositivo como se indica a continuación
  • Azul: 3,3 V, verde: GND, morado: SWDIO, naranja: SWCLK (si no se conecta, intercambie el morado y el naranja. La alimentación y la GND siempre deben ser los dos primeros pads)

Imagen 202409200016491 yhiub1z1 7stymrc5

  • Desde aquí intentamos hacer una copia de seguridad del firmware original usando el símbolo del sistema y usando "openocd -f interface/stlink-v2.cfg -f target/gd32e23x.cfg -c init -c "reset halt" -c "flash read_bank 0 ZY-M100_L.bin" -c "reset" -c shutoff"

respaldo

  • Encuentre dónde guardó la copia de seguridad para mí: C:\Users\Kurt

copia de seguridad1

  • Descargue el firmware correcto para su dispositivo y cámbiele el nombre a "ZY-M100_L-TargetDistance_disable"

usuariobin

  • Ahora flasheamos usando "openocd -f interface/stlink-v2.cfg -f target/gd32e23x.cfg -c init -c "reset halt" -c "flash erase_sector 0 0 last" -c "flash write_bank 0 ZY-M100_L-TargetDistance_disable.bin" -c "flash verified_bank 0 ZY-M100_L-TargetDistance_disable.bin" -c "reset" -c shutoff"

flashfi

  • Debe escribir el firmware bin, luego leerlo y verificarlo para confirmar que fue exitoso.
  • Luego vuelva a encenderlo y observe cómo funciona en Zigbee2mqtt.

Como@jgarridoalcazarMencioné que solo hice un dispositivo de repuesto mientras escribía esto y no soldé el pin a las almohadillas, solo dejé los pines del puente allí bajo su propia tensión y funcionó, súper fácil.

¿Quieres decir que no tienes acceso físico a los dispositivos porque todavía están en el techo? Simplemente apaga el disyuntor y quítalos. Sinceramente, postergar y esperar una solución de OTA llevará más tiempo que hacerlo. Parece abrumador, pero debería ser bastante sencillo ahora que puedes seguirlo.

Los míos también se instalaron en el techo, así que puedo entender la frustración y tienes razón, una actualización OTA sería increíble; simplemente no tuve la paciencia para esperar mientras tenía tantos problemas en mi red Zigbee.

Animo a todos a criticar mis pasos, estoy más que feliz de aprender una mejor manera de hacer algo y hacerlo más fácil para la siguiente persona.

Thanks for the amazing work, I did everything following your steps rigorously (no mistakes) and it ended up like this, is what I did right? Sorry but I'm a newbie

image1 image2

mremedi2023 commented 2 months ago

It seems to be working correctly

I have these sensors:

2: Tuya ZY-M100-S_2 (1 with "ZY-M100_L-TargetDistance_disable") work ok, No more annoying messages. I'll be flashing the other one soon 4: Tuya MTG275-ZB-RL 5: Tuya MTG075-ZB-RL

Does anyone know if there is firmware for the other models?

tandarra commented 2 months ago

@mremedi2023 looks like your translate has changed the script you wrote. Can see "shutoff" instead of "shutdown"

copy and paste from github as it appears without translating

To backup -

openocd -f interface/stlink-v2.cfg -f target/gd32e23x.cfg -c init -c "reset halt" -c "flash read_bank 0 ZY-M100_L.bin" -c "reset" -c shutdown

To flash use -

openocd -f interface/stlink-v2.cfg -f target/gd32e23x.cfg -c init -c "reset halt" -c "flash erase_sector 0 0 last" -c "flash write_bank 0 ZY-M100_L-TargetDistance_disable.bin" -c "flash verify_bank 0 ZY-M100_L-TargetDistance_disable.bin" -c "reset" -c shutdown

begemotik commented 2 months ago

Following @tandarra guidance I constantly get the message while trying to make a fw backup.

Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : clock speed 1000 kHz
Info : STLINK V2J34S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.285562
Error: init mode failed (unable to connect to the target)

It seems that I'm either connecting it wrong or stick/wires don't work. Would appreciate any clues on what I'm doing wrong

2024-09-30 20 47 30 2024-09-30 20 49 00

djcrawleravp commented 2 months ago

I don't know if this is too much to ask (I have never "JTAGed" anything before) If someone could make a video about this should be very very helpfull and I'll be more than grateful.

I have 7 ZY-M100-S_1 5ghz version spamming my network, they work just fine though but I rather do the firmware update in order to improve my overall performance.

tandarra commented 2 months ago

Following @tandarra guidance I constantly get the message while trying to make a fw backup.

Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : clock speed 1000 kHz
Info : STLINK V2J34S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.285562
Error: init mode failed (unable to connect to the target)

It seems that I'm either connecting it wrong or stick/wires don't work. Would appreciate any clues on what I'm doing wrong

It looks like it's connected correctly. So most likely the issue somewhere with the laptop. Do you have a second sensor to try on?

I would be checking the pins are touching the pads, can confirm with multimeter doing a continuity check to the STM side of jumper pins. (soldering is a good way to eliminate this error, but it's not needed)

Run zadig and confirming USB drivers are up to date. Confirm libusb files are in OpenOCD directory Restarting laptop to confirm windows has correctly installed and initialized drivers on boot

bsaurusrex commented 2 months ago

Does the unit have a red led when you first connect to it? If not then the power/ground arent connecting fully.

begemotik commented 2 months ago

Thanks for your assist @tandarra. I managed to flush the firmware eventually.

The reason why it didn't work at the beginning was indeed the wiring - 2,4,6,8 connection pins I used, whereas I needed to actually use 2,4,6,7. I suppose it might be some specifics of my stick only.

bundoon commented 2 months ago

Excellent work lads.. Just flashed 5 of my sensors, looking forward to a more stable experience..

itwtds commented 2 months ago

FYI - I had a chat with my AE seller, loginovo and ultimately they decided to send me another device for free (ZY-M100-24GV3/ _TZE204_ya4ft0w4). Now, with the recently added converter, I now have the distance switch to turn off distancing completely. https://github.com/Koenkk/zigbee-herdsman-converters/pull/7909. Suggest others that do not have the JTAG capability/understanding/applicable models to reach out to their sellers to see what can be done.

tandarra commented 2 months ago

So they did infact send the new V3?

Are you able to attach photos of the internals to build out the knowledge of this issue for everyone?

They sent me a new script to try after I had flashed all mine.

https://drive.google.com/file/d/1VmTh3M0pOEgX3nfO1Y940wkIi2GoK8SA/view?usp=sharing

bsaurusrex commented 2 months ago

Internals: https://github.com/Andrik45719/ZY-M100/issues/7

echupin commented 2 months ago

@tandarra, thanks a lot, everything worked out. I flashed 3 ZY-M100-S_2 sensors. Good luck!

thargy commented 2 months ago

Thank you so much @Andrik45719! I have 20 of the _TZE204_ztc6ggyl devices active on a dedicated Zigbee network and would have liked 30, but the defaults are killing the network daily. This will be a complete game changer for me - and might even help me look less like a moron to the wife!

Many of the ceiling-mounted ones are inaccessible (like 4m up), so before I start going through the very long process of trying to flash them, I noticed that you were looking at the option of OTA as of a couple of weeks ago. I've been dealing with this mess for well over a year so I can wait a while for an OTA update if it's coming. Do you think that's likely (and if so do you have an ETA - if not, don't worry, I understand the pressures on time that OSS brings)? I want to decide whether to start ripping down devices and manually updating now or being patient and waiting for an OTA, and your views would be invaluable.

Again, thank you so much for doing this - it has been incredibly frustrating trying to work around the spam issues for what would otherwise be a great device.

jvdburgt commented 2 months ago

Thank you so much @Andrik45719! I have 20 of the _TZE204_ztc6ggyl devices active on a dedicated Zigbee network and would have liked 30, but the defaults are killing the network daily. This will be a complete game changer for me - and might even help me look less like a moron to the wife!

Many of the ceiling-mounted ones are inaccessible (like 4m up), so before I start going through the very long process of trying to flash them, I noticed that you were looking at the option of OTA as of a couple of weeks ago. I've been dealing with this mess for well over a year so I can wait a while for an OTA update if it's coming. Do you think that's likely (and if so do you have an ETA - if not, don't worry, I understand the pressures on time that OSS brings)? I want to decide whether to start ripping down devices and manually updating now or being patient and waiting for an OTA, and your views would be invaluable.

Again, thank you so much for doing this - it has been incredibly frustrating trying to work around the spam issues for what would otherwise be a great device.

I wholeheartedly second this request (as well as the well-deserved compliments of course) :)

martinmasera commented 2 months ago

I saw that Andrik has added new flash file for ZY-M10024Gv3 which can be added via upload, how to do that in zigbee2MQTT?

jvdburgt commented 1 month ago

Okay, I decided I will give it a go, but I'm a bit lost about exactly what to order. I see various J-Link and USB-stick options. Can someone post the link to AE versions that are guaranteed to work? And do I also need to order other peripherals, like the cables, or are they included?

In other words: I need a shopping list ;)

walberjunior commented 1 month ago

Okay, I decided I will give it a go, but I'm a bit lost about exactly what to order. I see various J-Link and USB-stick options. Can someone post the link to AE versions that are guaranteed to work? And do I also need to order other peripherals, like the cables, or are they included?

In other words: I need a shopping list ;)

I use this:

https://pt.aliexpress.com/item/1005006998022759.html?spm=a2g0o.order_list.order_list_main.17.b7a8caa42TecOY&gatewayAdapt=glo2bra

jvdburgt commented 1 month ago

Okay, I decided I will give it a go, but I'm a bit lost about exactly what to order. I see various J-Link and USB-stick options. Can someone post the link to AE versions that are guaranteed to work? And do I also need to order other peripherals, like the cables, or are they included? In other words: I need a shopping list ;)

I use this:

https://pt.aliexpress.com/item/1005006998022759.html?spm=a2g0o.order_list.order_list_main.17.b7a8caa42TecOY&gatewayAdapt=glo2bra

Great thank you! I see only the ST-Link v2 here, though. What about the J-Link, and the pinned cables I need to connect to the sensor module?

Or is only the ST-link v2 needed? Now I'm confused, I thought the J-Link was also required. but in @tandarra guide only the ST-link v2 is mentioned... Can anyone calrify please.

kenni commented 1 month ago

@jvdburgt A ST-Link v2 (clone or original) dongle and some male<->female dupont wires are all you need. You do not need to solder the wires, they only need to have good contact for ~5 seconds while flashing.

ST-Link v2 clone: https://a.aliexpress.com/_Ewizxk5

Dupont wires male<->female: https://a.aliexpress.com/_EGtBG8h

jvdburgt commented 1 month ago

Awesome, many thanks!

walberjunior commented 1 month ago

@jvdburgt 20240919_142727 20240919_142639

I used some wire jumpers and a female PCB connector that came with some esp32 I bought.

mitchins commented 1 month ago

I've just bought the devices and am attempting to read this thread. Could someone please tell me if there's a current guide to the state of these? From what I can tell some of the models may have firmware updates available that ameliorate the issue that require manual flashing via an ST-Link V2.

jonathanathe commented 1 month ago

@java-devil I'll try my best to run through the steps I used. Unsure if everything was needed but this is how I got my one to work.

First connect them to zigbee2mqtt to see what model you have to confirm which firmware you need

zigb2mqtt

Follow @Andrik45719 github guide - https://github.com/Andrik45719/ZY-M100

Mods:

  • Target distance (DP: 9) reporting disabled.
  • Settings report interval (DPs: 1, 4, 2, 3, 6, 101, 102, 103, 104) increased to 60s, stock FW 10s.
  • Illuminance Lux report interval (DP 104) increased to 10s, stock FW 500ms

Suppoted models: as of 20/09/24

  • ZY-M100_L (_TZE204_ztc6ggyl)
  • ZY-M100-S_1 (_TZE204_sxm7l9xa, _TZE204_e5m9c5hl)
  • ZY-M100-S_2 (_TZE204_qasjif9e)
  • ZY-M100-24G (_TZE204_ijxvkhd0)
  • ZY-M100-24GV2 (_TZE204_7gclukjs)

I assume the binaries first came from Andrik backing them up, reading them and modifying them to suit, other models possibly have been assisted from other members such as @jgarridoalcazar submitting them also, I don't want to assume what is going on, but I certainly appreciate everyone's input to get us here so far. https://github.com/Andrik45719/ZY-M100/issues/4

  • Download and install MSYS2 - https://www.msys2.org/
  • I ran into an issue installing and had to manually create these four folders - C:\Windows\System32\drivers\etc

four folders

  • Run msys2 and enter "pacman -Sy mingw-w64-86_64-openocd" to install OpenOCD

msys2-openocd

zadig

  • Download libusb drivers and put libusb-1.0.dll into mingw64 library - C:\msys64\mingw64\lib (Unsure if this was actually needed as files look similar, I just had stumbled across someone else doing this online)

libusb

  • Connect your device as per below
  • Blue - 3.3V, Green - GND, Purple - SWDIO, Orange - SWCLK (If it doesn't connect swap Purple and orange around. Power and GND should* always be those first two pads)

IMG202409200016491 yhiub1z1 7stymrc5

  • From here we try backup original firmware using Command Prompt and using "openocd -f interface/stlink-v2.cfg -f target/gd32e23x.cfg -c init -c "reset halt" -c "flash read_bank 0 ZY-M100_L.bin" -c "reset" -c shutdown"

backup

  • Find where it saved the back up for me was - C:\Users\Kurt

backup1

  • Download correct firmware for your device and rename it to "ZY-M100_L-TargetDistance_disable"

userbin

  • Now we flash using "openocd -f interface/stlink-v2.cfg -f target/gd32e23x.cfg -c init -c "reset halt" -c "flash erase_sector 0 0 last" -c "flash write_bank 0 ZY-M100_L-TargetDistance_disable.bin" -c "flash verify_bank 0 ZY-M100_L-TargetDistance_disable.bin" -c "reset" -c shutdown"

flashfi

  • Should Write the bin firmware, then read and verify it to confirm it was successful.
  • Then power it back on and take a look at how its operating in Zigbee2mqtt

As @jgarridoalcazar mentioned, I just did a spare device whilst writing this out and didn't solder the pin to the pads just had the jumper pins sitting there under its own tension and worked, super easy.

You mean you don't have physical access to the devices as they are still in the ceiling? Just turn the breaker off to the power and remove them, honestly procrastinating and waiting for an OTA fix will take longer than doing. It seems daunting but should be fairly straightforward now you can follow along.

Mine were installed in the ceiling also so I can understand the frustration and you're right an OTA update would be amazing; I just didn't have the patience to wait while having so many issues on my zigbee network

I encourage everyone to critic my steps, more than happy to learn a better way of doing something and make it easier for the next person.

Change made to my 6 devices ZY-M100-S_2_TZE204_qasjif9e: I can tell that the drop in calls has drastically reduced, but before confirming that it works, I want to wait a bit more than a week since, on many occasions, my Zigbee network didn’t drop immediately, and I want to check its stability.

Thank you very much!

thargy commented 1 month ago

Hi, I have now moved from 20 _TZE204_ztc6ggyl on a single dedicated network to 26, split evenly across 2 networks, each with ~100 devices on them. I have a a mixture of wall mounted and ceiling mounted versions.

Some observations:

I also tested one of the newer _TZE204_ya4ft0w4, which is supposed to fix the 'issues' by providing a switch for distance reporting. Frankly, the older devices with this firmware are significantly better, which provides a bit of a dilemma when you're trying to source the correct solution.

This is a significant step forward after a year of presence sensor hell, so thank you @Andrik45719. Longer term it would be nice to crack the OTA approach as it is frankly dangerous replacing ceiling sensors for many people. Other features that would be nice:

However, that's a lot more work than just changing some of the default values already encoded in the existing firmware.

For now, my sincere thanks!

Andrik45719 commented 1 month ago

ZY-M100-24GV3_TZE204_ya4ft0w4_increased_report_interval

JackTalisker commented 1 month ago

I want to thank @tandarra for the really useful starting point he gave with his post, btw I have to clarify some details to help those who want to try their hand:

Now a big thank you to @Andrik45719 for giving us the modified firmware! I was finally able to flash my _TZE204_ijxvkhd0

tandarra commented 1 month ago

Cheers, updated the spelling mistake in pacman command.

jvdburgt commented 1 month ago

@JackTalisker and @tandarra : many thanks and perfect timing! My ST-Link v2 should arrive tomorrow and I'll get to it immediately 😬

JackTalisker commented 1 month ago

@Andrik45719 As I wrote yesterday here I successfully flashed your "TagetDistance_disabled" fw to my _TZE204_ijxvkhd0 and there is a a significant reduction in mqtt messages, especially those about distance that used to arrive every second (now suppressed) but there is a behaviour which (imho) is really weird (this happened with original fw too). The device instead of sending one mqtt state message about every minute, it sends from 8 to 12 message at a time (screenshot below).

Is there a way to correct it? Thank you for your patience. Screenshot 2024-10-11 094132

begemotik commented 1 month ago

I have a similar problem with Moes BHT-002/BHT-006 Thermostat. It seems that it uses the same chip inside. Is there any chance some similar setting might be applied for it as well?

thargy commented 1 month ago

@Andrik45719 As I wrote yesterday here I successfully flashed your "TagetDistance_disabled" fw to my _TZE204_ijxvkhd0 and there is a a significant reduction in mqtt messages, especially those about distance that used to arrive every second (now suppressed) but there is a behaviour which (imho) is really weird (this happened with original fw too). The device instead of sending one mqtt state message about every minute, it sends from 8 to 12 message at a time (screenshot below).

I've noticed a lot spamming of identical message as well. The issue is the current fix is just some tweaks of timeouts, addressing unnecessary spam messages directly would require recoding which I'm not sure is as easy.

mremedi2023 commented 1 month ago

Same here

El vie, 11 oct 2024 a la(s) 5:22 a.m., Ihar Filimonau ( @.***) escribió:

I have a similar problem with Moes BHT-002/BHT-006 Thermostat https://www.zigbee2mqtt.io/devices/BHT-002_BHT-006.html#moes-bht-002-bht-006. It seems that it uses the same chip inside. Is there any chance some similar setting might be applied for it as well?

— Reply to this email directly, view it on GitHub https://github.com/Koenkk/zigbee2mqtt/issues/19045#issuecomment-2406887303, or unsubscribe https://github.com/notifications/unsubscribe-auth/BENWU6RLLOTRGNG7OB5WKYTZ26DFTAVCNFSM6AAAAAA5CFPYD2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBWHA4DOMZQGM . You are receiving this because you were mentioned.Message ID: @.***>

thargy commented 1 month ago

I want to thank @tandarra for the really useful starting point he gave with his post, btw I have to clarify some details to help those who want to try their hand:

  • Since pacman was unable to find the package, the right command to install openocd with MSYS2 MSYS is "pacman -Sy mingw-w64-x86_64-openocd" (there was an "x" missing);
  • In my case the 4 directories Tandarra missed are 4 files that where correctly created by the installer;
  • To run openocd I had to launch it with MSYS2 MINGW64 (because openocd is a Mingw-w64 executable);
  • In my kind of setup the backupped bin file went to C:\msys64\home\YourUser (you have to copy there the new modified bin file as well).

Now a big thank you to @Andrik45719 for giving us the modified firmware! I was finally able to flash my _TZE204_ijxvkhd0

If you download OpenOCD from it's releases page. The .tar.gz can be unzipped and you will find a windows executable in bin\openOCD.exe.

Open a terminal window and navigate to the bin directory and then you can execute the command directly:

e.g. from a Powershell terminal:

./openocd.exe -f interface/stlink.cfg -f target/gd32e23x.cfg -c init -c "reset halt" -c "flash read_bank 0 ZY-M100-{YOUR MODEL}.bin" -c "reset" -c shutdown

You do not need to install msys2 for it to work, and this is a much easier way of doing it on Windows. I've updated well over 20 devices using this method so far. At least I certify it as 'Tested as Works 4 Me ® ™' 🤣

JackTalisker commented 1 month ago

If you download OpenOCD from it's releases page. The .tar.gz can be unzipped and you will find a windows executable in bin\openOCD.exe.

Open a terminal window and navigate to the bin directory and then you can execute the command directly:

e.g. from a Powershell terminal:

./openocd.exe -f interface/stlink.cfg -f target/gd32e23x.cfg -c init -c "reset halt" -c "flash read_bank 0 ZY-M100-{YOUR MODEL}.bin" -c "reset" -c shutdown

You do not need to install msys2 for it to work, and this is a much easier way of doing it on Windows. I've updated well over 20 devices using this method so far. At least I certify it as 'Tested as Works 4 Me ® ™' 🤣

I've already had MSYS installed for other reasons but your advice will help who is going to start from scratch 👌

jonathanathe commented 1 month ago

Change made to my 6 devices ZY-M100-S_2_TZE204_qasjif9e: I can tell that the drop in calls has drastically reduced, but before confirming that it works, I want to wait a bit more than a week since, on many occasions, my Zigbee network didn’t drop immediately, and I want to check its stability.

Thank you very much!

Honestly, very happy, and the sensors are still working perfectly. Thank you.

mindtripper commented 1 month ago

Using @tandarra steps I was able to successfully firmware update two TS0601_TZE204_ijxvkhd0 and three TS0601_TZE204_sxm7l9xa. Using ST-Link V2 clone and a DuPont Wire Kit. No soldering. Just plugged them in the holes on the board. Worked on 5 out of 5 without issues.

The devices have been moved back to my primary ZigBee network and it is stable.

Thank you @tandarra!

jvdburgt commented 1 month ago

Okay guys (and gals), I can't believe how easy that was!

I mean, standing on your shoulders with you having done all the hard work. But I have to say that the instructions come across as way scary and complex (at least for a n00b like me), while in reality I set it up and executed it on multiple devices in mere minutes.

To whomever is doubting whether to do this: climb on the shoulders of the giants who went before us, honestly it's a breeze :)

thargy commented 1 month ago

I have now updated multiple types of sensor, in both ceiling and wall. I've noticed that the newer sensors have had several improvements made, including a cover over where the ceiling reset button used to be exposed, and an additional led on the wall mounted sensor. Also some of the ceiling sensors now use standard Philips screws.

For the ZY-M100-S_2_TZE204_qasjif9e and ZY-M100-24GV3_TZE204_ya4ft0w4 ceiling sensors (both 5 & 24 GHz), I noted that the original JTAG pins are no longer in the same place, nor is the vertical daughter board. Instead, 4x 2mm holes (instead of the usual 2.54mm) can be found on the very bottom of the board:

IMG_0324

I used some right angle pins to allow me to get a good grip and reduce the spacing.

Note the order is also different, with SWCLK and SWDIO swapped from the older models:

Hole Connection
Sqaure 3.3V
2 Ground
3 SWClk
4 SWDIO

The same model wall sensors still have the older hole layout.

Also, I notice a lot of people are still following the instructions from @tandarra - but it is important to note this comment, which details a much easier and cleaner way to use openocd on windows.

jvdburgt commented 1 month ago

Took out and flashed all 17 (in-ceiling) presence sensors, and now the network is quiet like a Summer meadow :)

jvdburgt commented 1 month ago

Okay, allthough the sensors generally are working fine after the update, my log is now full of errors with regard to automations that turn on the lights based on presence, of the type "ZIGBEE_MAX_MESSAGE_LIMIT_REACHED: 3075".

I'm not sure what to make of this, the presence sensors are on a dedicated MQTT network, while the lights are on a separate ZHA network.

Not sure what is causing this, and if/how it is related to flashing the sensors. Any ideas anyone?

cowbe0x004 commented 1 month ago

EDIT: direct link http://www.st.com/st-web-ui/static/active/en/st_prod_software_internet/resource/technical/software/utility/stsw-link004.zip

can anyone share the necessary software to flash this? I keep getting errors download st software even if I sign up for an account.

cowbe0x004 commented 1 month ago

EDIT: had to apply pressure to the wires so they have good contact, able to flash without error.

I'm getting write error, anyone know what might be wrong here? I can backup fine. image image PXL_20241020_020741310

bundoon commented 1 month ago

I see you didn't rename your downloaded file to : ZY-M100_L-TargetDistance_disable

You did manage to download your existing firmware from the device, so it is working.

Don't know if it make a difference but I followed these commands and it wotked.

You should put your new renamed file in the same folder that your existing firmware wrote to.

Download correct firmware for your device and rename it to "ZY-M100_L-TargetDistance_disable"

Now we flash using "openocd -f interface/stlink-v2.cfg -f target/gd32e23x.cfg -c init -c "reset halt" -c "flash erase_sector 0 0 last" -c "flash write_bank 0 ZY-M100_L-TargetDistance_disable.bin" -c "flash verify_bank 0 ZY-M100_L-TargetDistance_disable.bin" -c "reset" -c shutdown"

jvdburgt commented 1 month ago

As for the pins, to ensure they make contact, what I did was bend them a little, and let the module "hang" on the cables (instead of laying it down on the desk), which ensures all pins will make contact.

pawel-tomkiel commented 1 month ago

I followed https://github.com/Koenkk/zigbee2mqtt/issues/19045#issuecomment-2362489362 and https://github.com/Andrik45719/ZY-M100 and can confirm it works on MacOs as well, I basically:

  1. installed openocd with brew install openocd
  2. connected ST-Link with my ZY-M100-24GV2_TZE204_7gclukjs as described
  3. downloaded proper .bin file from Andrik45719/ZY-M100 repository
  4. as I was missing stlink-v2.cfg and gd32e23x.cfg I downloaded openocd-*.tar.gz release from https://github.com/openocd-org/openocd/releases, extracted it and found those files in share/openocd/scripts/target so I just copied those to my working directory
  5. then I ran openocd commands as described (with slight modifications of path/filename for .cfg and .bin files)

Thank you all for your great work!

firstchair commented 1 month ago
  1. as I was missing stlink-v2.cfg and gd32e23x.cfg I downloaded openocd release from https://github.com/openocd-org/openocd/releases and extracted those files from latest release

How did you extract those?

pawel-tomkiel commented 1 month ago

How did you extract those?

I updated my comment, should be more clear now

Andrik45719 commented 1 month ago
  1. as I was missing stlink-v2.cfg and gd32e23x.cfg I downloaded openocd-*.tar.gz release from https://github.com/openocd-org/openocd/releases, extracted it and found those files in share/openocd/scripts/target so I just copied those to my working directory

Manual updated to use actual config

openocd -f interface/stlink.cfg -f target/gd32e23x.cfg -c init -c "reset halt" -c "flash read_bank 0 ZY-M100_bkup.bin" -c "reset" -c shutdown