Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autodiscovery handles negative integer id wrong #2164

Open
alexxx-k opened this issue Feb 17, 2025 · 1 comment
Open

autodiscovery handles negative integer id wrong #2164

alexxx-k opened this issue Feb 17, 2025 · 1 comment

Comments

@alexxx-k
Copy link

Context
My sensor is a Bresser 5in1 that uses the 6in1 Protocol by autodetection. I use the prebuild lilygo-rtl_433-fsk

Describe the bug
The autodiscovery message is replacing a leading "-" by "/", what renders the sensor to not subscribe to the right topic.

{
"stat_t": "+/+/RTL_433toMQTT/Bresser-6in1/0//2059337613",
"dev_cla": "precipitation",
"unit_of_meas": "mm",
"name": "Rain",
"uniq_id": "Bresser-6in1-0--2059337613-rain_mm",
"val_tpl": "{{ value_json.rain_mm | is_defined }}",
"stat_cla": "measurement",
"device": {
"ids": [
"Bresser-6in1-0--2059337613"
],
"cns": [
[
"mac",
"Bresser-6in1-0--2059337613"
]
],
"mdl": "Bresser-6in1",
"name": "Bresser-6in1-0--2059337613",
"via_device": "OMG_lilygo_rtl_433_ESP_FSK"
}
}

the message is then published to topic:
home/OMG_lilygo_rtl_433_ESP_FSK/RTL_433toMQTT/Bresser-6in1/0/-2059337613

manually fixing the autodiscovery message fixes the issue.
(replacing "stat_t": "+/+/RTL_433toMQTT/Bresser-6in1/0//2059337613" by "stat_t": "+/+/RTL_433toMQTT/Bresser-6in1/0/-2059337613")

Expected behavior
handle negative integer values in ids correctly or maybe the negative value itself is an integer overflow

Embedded Device (please complete the following information):
Running on LilyGo_SSD1306
using [Theengs OpenMQTTGateway v1.8.1]
https://docs.openmqttgateway.com/prerequisites/boards/lilygo-rtl_433-fsk.html

I created an issue here, https://github.com/matthias-bs/BresserWeatherSensorReceiver, because mixed up the projects.
Maybe using the BresserWeatherSensorReceiver could in the OpenMQTTGateway may fix also #2145

@DigiH
Copy link
Collaborator

DigiH commented Feb 18, 2025

As we'd never really want a state topic to have a double // , best to check after the - > / replace for any such occurrence to then replace again with /- !?!

Just a quick stab at a theoretical fix.

@alexxx-k Can you make your own build with this change to test this?

development...DigiH:OpenMQTTGateway:rtldiscovery

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants