[SOLVED] Need help with some rules

All

Im banging my head on the wall trying to get a few rules configured. I have several time based rules configured via paper ui and those are working great.

Im not trying to get a rule configured for a bathroom fan. In a nutshell the temperature and humidity sensor is in the bathroom, when the humidity gets to 80% I want the bathroom fan to turn on. There is a 30 minute run timer programmed into the fan controller.

These are the 2 items from my items file

Switch KidsBathFanOn	 "Fan On"	 <switch1-on> 	(SF_KidBath) {http=">[ON:POST:http://192.168.1.152/device/startfan]", autoupdate="false"}

Number Room_Humidity28	"Kids Bathroom R.H. [%.2f r.H.]" <water> (SF_KidBath, Climate, ClimateHumidityChart)

And this is my rule…

rule "Kidsbathroomfan"
when
	Item Room_Humidity28 recieved update
then
	if (Room_Humidity28.state > 80) {
	KidsBathFanOn.sendCommand(ON)
	}
end

What am I missing. Ive read the turotials and even tried some examples from the forum and nothing is working.

Thanks for any help.
Dave

How does this Item get an update? There is no channel definition in {}

Well I’m not entirely sure…it gets it’s data from a mysensors device…those autodiscover when they powerup. It pops up and all I have to do is link it to an item and voila it updates the data when the sensors sends it.

Dave

The state of the item if not available straight away after an update is received. This is due to the time the event bus takes to do what it need to do.
Change your trigger to changed:

rule "Kidsbathroomfan"
when
	Item Room_Humidity28 changed
then
	if (Room_Humidity28.state > 80) KidsBathFanOn.sendCommand(ON)
end

Now, does your fan timer resets every time an “ON” command is sent?
Because for example the humidity will reach 81 and the fan will start for 1/2 hour.
Then 5 minutes later the humidity will reach 82 and the fan will start for 1/2 hour
Or does the fan starts for 1/2 hour and then stops regardless?

The fan will only start the timer on the initial ON command. After 14 minutes an additional ON will extend the timer.
Dave

Then you should be good to go

This is very true for received command. And definitely not true for changed so your suggestion is a good one. But I think that the item will have already transitioned to the updated state by the time the rule triggers. Otherwise we would need a receivedUpdate implicit variable which doesn’t exist.

That’s got it working…

Thanks so much

Dave

That’s good, please mark the fhread as solved. Thanks
hc_292