-
-
Notifications
You must be signed in to change notification settings - Fork 97
Question to all users: Change sensor mqtt format? #540
Comments
The alias 'sensor' works much nicer than the long ID. Nobody can remember the difference between 28-EA41-9497-0E03-5F and 28-233D-9497-0C03-8B. If a specific sensor is giving an alias sensor1, sensor2 that should not change anymore if one of the sensors is removed. |
I get the problem but I thought it was an alias all along. |
I thought about that. For a real alias we have to store the sensors to filesystem, with possibility to clear the growing database. This is a lot of work and than we can also add offset, gain and 2.order for #520. But the main problem is that sensors are renumbered in one is missing (dead or temporary fail) in normal running. But after a reboot, this sensor8 will becomes 1, 1-4 are shifted and 5 isn't detected anymore. It seems that all other users do not have a preference of mqtt-single-format. Maybe i should change to my preferred format and wait for the complains. |
makes sense to remove the id (which is the order the sensors are detected) and replace it with the sensor's real ID. |
As bbqkees wrote "The alias 'sensor' works much nicer than the long ID" and "if a specific sensor is giving an alias sensor1, sensor2 that should not change anymore if one of the sensors is removed." That's what i have working here, the numbers do not change until next reboot. On startup i make 3 scans to be sure the numbering is stable. But i preferre a always stable detection with only id. But maybe a compromise:
I can push these changes to my github if you want to have a look, or try out. |
sounds good, I'm fine with what you propose. I just did a big change so sync up first. Hope I didn't break anything. I think the new report command will be useful. |
would it not make more sense to use the float values in the JSON payload instead of the rendered strings? In case someone wants to use gafana or something else to actually do something with the values.
|
I made some edits. Can you take a look?
|
And once again my favorite format is killed :-(
All device values in web uses render_value via print_value_json, why not sensors? If you want localization you want it only for the sensors? As shown in the picture above i wanted to show sensor and id but empty value it a sensor fails (crc-error or loose contact). With float the web crashes if only the value is empty.
boiler HA works without nested format, so it's not really needed, only the config-settings were wrong. With the float output you have to check |
the reason I made the edits was because the MQTT payload was to sending the sensor values as strings and not floats anymore which broke my grafana logs and for other users too. Also the (unit) tests were failing and the GitHub build broke and rejected the PR. But what I didn't realize is that you wanted also non-functioning sensors to be recognized and an empty temperature to be sent. I missed that in the screen-shot and you didn't explicitly mention that. Is this only in the Web or also in the MQTT payloads? What should the value be, just blank? Let me know and I'll make the changes. You're right about all values being sent to the web are converted to strings, so i18n wouldn't work there. I was mistaken. |
ok, think its ok now. I made one change to show "(not available)" in the WebUI when you have a sensor that is present but can't take a reading. It's never happened to me so I tested it manually. |
@MichaelDvP you ok with the latest changes? happy now? :) |
So are the sensors numbers now persistent between reboots or not? |
Sensornumbers scanned on boot and kept until powerloss, The numbering is not stored to nonvolatile mem, on next reboot a missing sensor is skiped and numbers change. But temporary resorting while running if there is a crc-error is fixed. Also every sensor is retried 5 times (~ 30 sec) before marked as missing. |
@MichaelDvP what's the difference between your Custom format and what we have now? |
We have now: Nested+HA: I want to have (custom): |
I honestly thought we decided to replace the single format with your custom one? I don't think anyone would notice or mind. Let's just get it right. As long as HA works and the values are sent to MQTT as floats I'm happy |
Ok, but imho there was no decision, there was only one vote (my) for change and one against. A voting participation of 0,2% users can never be a decision. But i change it an see what happen. |
99.8% of users use the default MQTT format which is Nested, so it'll be fine. By the way, the initial reason I made the 'single' format was for Home Assistant since the components couldn't parse JSON objects and I needed to have seperate topics and payloads for each heating circuit. Now with MQTT Discovery that problem has been resolved. In my opinion I don't really see a need for having the single option anymore, but best to leave it as not to upset anyone. Also in Sensors its not really 'single' as all the sensors are posted in one json payload. single should really be 'sensor_data_1', 'sensor_data_2', etc |
Maybe there are other systems that does not like nested. Also splitting the thermostat can be good for 4 heatingcircuits getting to long in one nested message. |
Me too! :D |
The dallas sensors can be published in two different formats (nested/single), and i see disadvantages in both formats.
Nested (and HA):
The sensors are numbered to sensor1, sensor2, ..., but if a sensor fails or is temporary disturbed the numbering changes. Reading only sensor3.temp will give the value of sensor4 every time sensor1, 2, or 3 fails a readout. To make sure the right sensor is read, we have to search the right
id
in all sensors.Single format publishes each sensor as a single message, topic
sensor<id>
Here the sensors are clearly identified, but the messages are published one after another. If you want to calculate the difference between two sensors, say solar flow and backflow, you have to check the timing. If calculated on publish the difference is always calculated alternating with a new and a old value, and than with both new. This looks like fluctuation.
Both massage formats are not consistent with other published values, the boiler always publishes {name:value}, i.e
{wwtemp:45}
and not{wwtemp:{temp:45}}
and also not as a own topic boiler_wtemp = {temp:45}.I want to ask all users: Can we change the single format to:
Than all simultaniously measured values are published the same time and the sensors are clearly identified. Also i find it more consistent to the other mqtt messages.
The text was updated successfully, but these errors were encountered: