- Platform information:
- Hardware: Raspberry Pi 4 Model B Rev 1.1/4GB
- OS: Raspbian GNU/Linux 10
- Issue of the topic: Temperature/Humidity and other postUpdate Design Pattern
I have been an OH user for a long time, but recently I started to explore the secrets of this smart home software. While I like the multitude of possibilities in HABPanel, I like the ascetic BasicUI the most thanks to the simplicity and speed of operation in the Android application.
Unfortunately, it has its limitations in the form of 1 line of text + 1 datapoint, which with several sensors of the same type can take up three mobile screens.
To avoid this, I try to combine the data using a rule with the module .postUpdate () which saves me one line of data (although it does not allow me to use valuecolor or labelcolor).
I think that there are data that no loss of legibility can be combined in pairs before displaying eg temperature / humidity data sent / received, sunrise / sunset / moonlight, brightness / full moon.
Currently, I use 6 pairs of temperature / humidity even though I could do so for about 14 pairs.
Currently, the rule looks like this:
rule "merge czort"
when
Item MijiaTemp1 changed
then
SklejCzort.postUpdate(MijiaTemp1.state.toString + "°C / " + MijiaH1.state + "%")
end
and items looks like
Number MijiaTemp1 "Temp wc" (MijiaTG) {channel="mqtt:topic:ble:temp1", expire="5m,state=NULL"}
Number MijiaTemp2 "Temp hall" (MijiaTG) {channel="mqtt:topic:ble:temp2", expire="5m,state=NULL"}
Number MijiaTemp3 "Temp sleep" (MijiaTG) {channel="mqtt:topic:ble:temp3", expire="5m,state=NULL"}
Number MijiaTemp4 "Temp base" (MijiaTG) {channel="mqtt:topic:ble:temp4", expire="5m,state=NULL"}
Number MijiaTemp5 "Temp nowhere" (MijiaTG) {channel="mqtt:topic:ble:temp5", expire="5m,state=NULL"}
Number MijiaTemp6 "Temp somewhere" (MijiaTG) {channel="mqtt:topic:ble:temp6", expire="5m,state=NULL"}
Number MijiaH1 "Hum wc" (MijiaHG) {channel="mqtt:topic:ble:h1", expire="5m,state=NULL"}
Number MijiaH2 "Hum hall" (MijiaHG) {channel="mqtt:topic:ble:h2", expire="5m,state=NULL"}
Number MijiaH3 "Hum sleep" (MijiaHG) {channel="mqtt:topic:ble:h3", expire="5m,state=NULL"}
Number MijiaH4 "Hum base" (MijiaHG) {channel="mqtt:topic:ble:h4", expire="5m,state=NULL"}
Number MijiaH5 "Hum nowhere" (MijiaHG) {channel="mqtt:topic:ble:h5", expire="5m,state=NULL"}
Number MijiaH6 "Hum somewhere" (MijiaHG) {channel="mqtt:topic:ble:h6", expire="5m,state=NULL"}
I`ve read a lecture on Design Rich Koshak pattern but probably still do not feel it and examples contained therein does not apply Number item so I wonder:
Is it possible to create such a rule, design pattern, that one would suffice instead of 14?
I consider only the temperature / humidity pairs because they are the most numerous and repeatable.
What would you recommend? How do you manage overflow of data in BasicUI?