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 -
Why is the output of ACS712 current measurement module unchanged?
General Discussion • 19 Jul 2021, 09:09 • Tessie T 15 days ago -
ESP32 with LoRa
General Discussion • 31 Jan 2023, 11:06 • dhanushmh 11 days ago -
is this project dead?
General Discussion • 3 days ago • perfectom 3 days ago -
No merge into master in the last 5 years, should we use development?
General Discussion • 23 Sept 2024, 17:48 • kiesel 19 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 28 days ago