NorthernMan54 / rtl_433_ESP

Trial port of the rtl_433 Library for use with OpenMQTTGateway on a ESP32 and a CC1101 Transceiver
GNU General Public License v3.0
517 stars 123 forks source link

Proper way to change detection order? #108

Open horsey2022 opened 1 year ago

horsey2022 commented 1 year ago

Current Situation

I have two Govee H5054 wtaer leak detection sensor On one device, the push button is recorded as unknown on one device.

I figured out that the problem is that in the contrib/govee.c two versions of the H5054 are supported. one uses checksum and the newer ones uses CRC. But both the CRC and Checksum matches (raw un-inverted code "code":"daf0cfab4931") but the checksum is run first which causing the decode to fail giving Unknown.

The original src/signalDecoder.cpp has memcpy(&cfg->devices[62], &govee, sizeof(r_device)); memcpy(&cfg->devices[63], &govee_h5054, sizeof(r_device));

But I reversed to have the CRC version first and it detects the button correctly memcpy(&cfg->devices[62], &govee_h5054, sizeof(r_device)); memcpy(&cfg->devices[63], &govee, sizeof(r_device));

I makes sense to me that the more robust CRC should be checked first before the older checksum version. I don't know if this is the proper way to fix the problem. as when I search for govee_h5054, it also appears in tools/decoder.fragment and tools/rtl_433_devices.fragment, but just only by changing this one file it builds and detects the button properly.

Logs

N/A

Configuration

OpenMQTTgateway
lilygo-rtl_433

Environment

Process Supervisor

hb-service

Additional Context

No response