The MUSH-MACHINE: Rule triggering on mqtt values, storing and displaying it

co2_sitemap

Why can´t I show the PPM value properly in the frontend?

Remove the label parameter in the sitemap.
It is already defined in the item

Yes and no!
Yes: i removed the label in the sitemap as you´re right - not needed
No: That wasn´t the problem: I did not realize that the value PPM hast 2 digits. corrected that and it worked


Then I created another item for the Sonoff TH16 switch (the one that will later switch the fan) to blow out the Co2.
See:
Worked right away : proud!!
See the working sitemap and the frontend
co2_sitemap

Still not clear:

  • I have to refresh the page to renew the values
  • I would like to visualize the values in a graph and don´t know how
  • Can i use the rule that you created months ago to switch the fan on at a level of 2000ppm and switch it on at a falling level of 1500 ppm and below?

good night…

var Timer timer

rule “Too much CO2”
when
Item_co2 received update
then
if (Item_CO2_.value > 1500) {
if (timer === null) {
Item_Ventil.sendCommand(ON) //turn on the vent
timer = createTimer(now.plusMinutes(10), [ | //start and create the timer
Item_Ventil.sendCommand(OFF) //end of timer action
timer = null //reset the timer
] )
}
}
end

Please use the code fences

Hi Vincent,
I created the co2.rules in the rules directory. The item ventil (see above) ist steering the sonoff relais, which is working via mqtt. I could test it positiv via a switch in my sitemap

rule “Too much CO2”
when
    Item_co2 received update
then
    if (Item_co2_.state > 1500) {
        if (timer === null) {
            Item_Ventil.sendCommand(ON) //turn on the vent
            timer = createTimer(now.plusMinutes(10), [ | //start and create the timer
                Item_Ventil.sendCommand(OFF) //end of timer action
                timer = null //reset the timer
            ] )
        }
    }
end

Yes of course … fences… are there just beeing ruined by the editor.
sorry!

ps: in a world without borders and fences who needs gates and windows ;-)))

how can i test if Item_Ventil.sendCommand(ON) //turn on the vent really works. I doubt a bit that “ON” will passed on correctly to the mqtt string. see items:

I can’t read that
Please copy and paste the text

Switch ventil “Entlüftung” (LR,gLight) { mqtt=">[ohbroker:cmnd/ventilator/POWER:command:*:default], <[ohbroker:cmnd/ventilator/POWER:state:default]" }

if you click on the jpg it would show you the text larger.

What about:
Switch ventil “Entlüftung” (LR,gLight) { mqtt=">[ohbroker:cmnd/ventilator/POWER:command:*:default], <[ohbroker:cmnd/ventilator/POWER:state:default]" }

:grinning::sunglasses:

Aehm … yes the switch is working perfectly right, i just doubt that the quote… Item_Ventil.sendCommand(ON) in the ruleset will work… and how can I test that?

:flushed: ok understood:

Codefences

Aehm … yes the switch is working perfectly right, i just doubt that the quote…

Item_Ventil.sendCommand(ON)

in the ruleset will work… and how can I test that?

sorry for my “slow wire” …:worried:

1 Like