Hi :) I have a problem creating Rules Unmanageable! Help Me!

How to turn on the heater. off automatically at a temperature of 38 °C
And turn on the fan at a temperature of 38 °C Wait for the heat to decrease And turn off 28 °C

rule “Heater”
when
Item Sonoff3 changed from OFF to ON
then
if (Temperature.state => 38) {
Sonoff3.sendCommand(OFF)
}
end

rule “Fan”
when
Item Temperature changed
then
if (Temperature.state => 38) {
Sonoff2.sendCommand(ON)
} else if(Temperature.state <= 28) {
Sonoff2.sendCommand(OFF)
}
end

You might find this recent post helpful, you need to find out if you have created your Item as a Quantity type with units.

I’m not sure what your "heater"rule is about. It will run only once just as Sonoff3 (whatever that is) gets switched on, then it might or might not switch it back off again depending on Temperature.

The “Fan” rule looks sensible.

1 Like

Hey @Man_You

The trigger for your heater rule will only trigger once in the state change from OFF to ON and is not one that is usable.

You want the rule to trigger when you something has changed and you need to do something maybe.

So lets say I want that when the temp changes I want to check if I need the heater on. So if it is above 38 and the heater is on, turn it off.

rule "Heater"
  when
    Item Temperature changed 
  then
    if (Temperature.state => 38 && Sonoff3.state == ON) Sonoff3.sendCommand(OFF)
end
1 Like

I will try :pray:t2:

image image

I don’t know why Rules Inoperative or it type item wrong ? :sob:

You need to change items`s type definition from String into Number I suppose.

Capture4 image

Try to change Type “Nubber” Parameter show “NaN”

But if Type “String” Parameter normal show But the rules don’t work.

NaN

Not a Number

What is the value of SonoffS22_Temperature

You have the on off condition of => so it will never be on

You can’t just randomly change your Item types when they are linked to channels. The Item type must match the channel type.

You have kept secret your channels, so you are on your own with that.

When your Item types are correct, then we can work the rule to suit the Items.

Ok Thank you :revolving_hearts:

But now Rules only work Code.
*** mark ( < ) = work ***
*** mark ( > ) = not work ***

[WORK]
rule “Fan”
when
Item Temperature changed
then
if (Temperature.state < 28) {
Fan.sendCommand(OFF)
}
end

[NOT WORK]
rule “Fan”
when
Item Temperature changed
then
if (Temperature.state > 28) {
Fan.sendCommand(OFF)
}
end

I don’t know why :disappointed_relieved:

Neither do we, because we have no idea what the conditions are at your end. Let’s guess you’ve changed your Items, again. We don’t know what to, it’s your secret.

Perhaps you can show us just one line from your events.log that shows your Item named Temperature changing ?

What do you think? I don’t know why I don’t follow the condition (=>) but follow the condition (<). Do you have an example?

Item Name Sonoff_temperature (temperature)
Item Name Sonoff5 (Switch Sonoff)
*** mark ( < ) = work ***
*** mark ( > ) = not work ***

[WORK]
rule “Fan”
when
Item Temperature changed
then
if (Temperature.state < 28) {
Fan.sendCommand(OFF)
}
end

[NOT WORK]
rule “Fan”
when
Item Temperature changed
then
if (Temperature.state > 28) {
Fan.sendCommand(OFF)
}
end

Neither of these items is named Temperature

What is this list? it doesn’t make much sense.

So neither of those Items has anything to do with this rule, which is triggered by an Item named Temperature.

If you look in your events.log and find a changed entry for your real temperature Item, we would be able to help you.

1 Like

Thank you very much :100: :pray: