1technophile / OpenMQTTGateway

MQTT gateway for ESP8266 or ESP32 with bidirectional 433mhz/315mhz/868mhz, Infrared communications, BLE, Bluetooth, beacons detection, mi flora, mi jia, LYWSD02, LYWSD03MMC, Mi Scale, TPMS, BBQ thermometer compatibility & LoRa.
https://docs.openmqttgateway.com
GNU General Public License v3.0
3.62k stars 797 forks source link

[DISC] auto-discovery strcmp instead of substring only strstr #1968

Closed DigiH closed 5 months ago

DigiH commented 5 months ago

To avoid auto-discovery issues due to substring comparison at https://github.com/1technophile/OpenMQTTGateway/blob/development/main/ZgatewayRTL_433.ino#L128

strcmp instead of substring only strstr

Checklist:

DigiH commented 5 months ago

@riegelbrau

Could you check if this change from strstr to strcmp makes any difference to your TPMS Jansite-Solar fix at all.

It shouldn't really, but best to double check.

riegelbrau commented 5 months ago

I copied the changed code into my platformio workspace with the actual development branch, compiled and tested the creation of my TPMS sensor. It's still working as expected!

{
    "stat_t": "+/+/RTL_433toMQTT/TPMS/Jansite-Solar/5e512a",
    "dev_cla": "temperature",
    "unit_of_meas": "°C",
    "name": "Temperature",
    "uniq_id": "TPMS-Jansite-Solar-5e512a-temperature_C",
    "val_tpl": "{{ value_json.temperature_C }}",
    "state_class": "measurement",
    "device": {
        "ids": [
            "TPMS-Jansite-Solar-5e512a"
        ],
        "cns": [
            [
                "mac",
                "TPMS-Jansite-Solar-5e512a"
            ]
        ],
        "mdl": "Jansite-Solar",
        "name": "TPMS-Jansite-Solar-5e512a",
        "via_device": "OMG_lilygo_rtl_433_ESP_OOK_CBTEST"
    }
}
DigiH commented 5 months ago

Thanks for the testing and confirmation @riegelbrau

1technophile commented 5 months ago

Thanks