Reason for all the different sensor-types (but same datatypes)?
-
Hi, i am a new but very excited user of the mysensors-library and i am not a native english-speaker. I hope you understand what i am trying to ask and tell.
There is one thing, i dont understand why it was made this way:There are a lot of sensor-types, but all of them only consist of only some different datatypes: bool, float, integer (...) Wouldnt it be easier to create a general "sensor-type" instead of creating a lot of different sensors?
My idea is to make something like a "constructor" for a sensor i want to use. In this constructor i define the datatype, the name, and additional (standardized) parameters like:
- arm- / disarmable
- min / max-value
- other "read" and writeable values...
In this way i can "build" my sensor-type as i need it. For example i can create a sensor, which reports batterylevel as integer or as float - or just as boolean (batt-ok-value). I can define a "setable" min-value (or max) and so on... The battlevel-feature included today only allows percent-values. This is a bit a limitation, i think...
Greetings
Andreas
-
@ahhk If you are ready for some reading.... there were a few discussions on the subject already..
-
It is main reason for the current datatypes is historic. If we would redo things from scratch it would probably look much different.
Here is an embryo I did way back on a future OTA protocol.
https://github.com/henrikekblad/Arduino/blob/old-development/libraries/MySensors/MyMessage.hThese types of changes will affect/break controller plugins, so we cannot do them just for fun.
It will be much easier to support different protocols soon (using the same codebase) this opens up for changes more easily.
-
Hi,
thats a LOT of text - wow. but very interesting (didnt read everything until now).
Is there a topic or discussion ongoing on this?Maybe it can be redone with "mysensors 2.0" (in parallel to 1.5)..
I will make a deep-dive into the source code now. Its too interesting and i like this kind of codingAt last: Sry that i opened another topic for this question. looks like i didnt use the right words in the search
Greetings
Suggested Topics
-
Update RF24 library to latest version
Bug Reports • 23 Mar 2014, 23:37 • andriej 24 Mar 2014, 22:52 -
Code Garage to the rescue.
General Discussion • 11 Jan 2025, 11:25 • skywatch 15 days ago -
ESP-NOW
General Discussion • 22 Apr 2018, 05:58 • NeverDie 17 Feb 2025, 22:24 -
ESP32 with LoRa
General Discussion • 31 Jan 2023, 11:06 • dhanushmh 23 days ago -
Which device I have to use to connect with accelerometer before connecting to my pc?
General Discussion • 24 Jan 2023, 17:16 • Yada Kijsathan 16 Mar 2025, 20:17 -
No merge into master in the last 5 years, should we use development?
General Discussion • 23 Sept 2024, 17:48 • kiesel 25 Mar 2025, 15:30