[SOLVED]New to Rules - Rule Runs but Not Working

  • Platform information:
    • Hardware: Pi 3B+
    • openHAB version: 2.4.0

I’m trying to get a very basic rule to work where a plug (attached to a water pump) goes off every few hours, I’ve set up a cron for it to activate every minute for testing purposes. The switch will then expire after 20 seconds using the expire binding and turn off.
The rule appears to be working, however the switch isn’t doing anything IRL (there’s a light indicator to show when on).
I feel like I’ve missed something, can anyone help?

Item File:

Switch GF_ChameleonPump	 "Chameleon Pump" <poweroutlet> (GF_DiningRoom, gPower) [ "Outlet" ] {channel="zwave:device:fc2908ae:node16", expire="20s,command=OFF"}


rule "Chameleon Pump Schedule"
		Time cron "0 0/1 * 1/1 * ? *"

		logInfo("Chameleon Pump","Rule has successfully triggered")


2020-01-11 12:50:00.031 [INFO ] [marthome.model.script.Chameleon Pump] - Rule has successfully triggered

==> /var/log/openhab2/events.log <==

2020-01-11 12:50:00.033 [ome.event.ItemCommandEvent] - Item 'GF_ChameleonPump' received command ON

2020-01-11 12:50:00.046 [nt.ItemStatePredictedEvent] - GF_ChameleonPump predicted to become NULL

2020-01-11 12:50:20.915 [ome.event.ItemCommandEvent] - Item 'GF_ChameleonPump' received command OFF

2020-01-11 12:50:20.920 [nt.ItemStatePredictedEvent] - GF_ChameleonPump predicted to become NULL

Are you able to toogle the device using the item in a Sitemap manuell (without a rule)?

Your rule runs and does what you want, but your Item is not linked to a Thing channel. You linked it directly to the Thing.

I can only guess what is correct because you have given us no details on the powe routlet. I would guess this may work.

Switch GF_ChameleonPump	 "Chameleon Pump" <poweroutlet> (GF_DiningRoom, gPower) [ "Outlet" ] {channel="zwave:device:fc2908ae:node16:binary_switch", expire="20s,command=OFF"}

It will not work because they linked directly to the Thing and not a switch channel.

Wow, ok that was so simple, i added the “:switch_binary” to the items file and it works. Thank you!

Stupid question, should I always link the the thing channel in my items file for all devices or just for items wanting to use for rules? As everything else works fine!

Actually just for Items you want to read or control in openHAB. You should really read the documentation on openHAB concepts.

I have a crazy, but serious question for you. How did you determine openHAB would serve your purpose without understanding the basics of how it works??

1 Like

That sounds like a bit of a dig at me, I’m sorry but I’m still learning, and i thought the idea of community forums was so that people could ask questions without being made to feel dumb. Thank you for your help, but in future maybe reconsider offering help if your attitude is to belittle inexperienced users.

Sorry, I am sometimes too direct.

When I am looking for a useful system or software solution I tend to look for candidates and then learn as much as I can about how they work to determine how to configure them. The official documentation & tutorial for OH are pretty good starting point with one major exception. The majority of user here would avoid the Simple mode used in the tutorial.

I agree that years of experience can be good, or get in the way. I was in a similar position to you last year bur decided to try a different solution before coming here.