[Solved] HABmin rule designer, can't get it to work

Thank you very much, it seems to work now. No error message in log file. I changes the time, and now i am waiting to hear the sound of the vacuum cleaner starting - fingers crossed :slight_smile:

1 Like

You can test your rule by setting up a dummy Item, put it in your sitemap and toggle it

*.items

Switch	Rule_Trig	"Testing Rules"

*.rules

rule "Neato Autostart"
when
	Time cron "0 55 10 ? * MON,WED,THU,FRI,SAT *" or
	Item Rule_Trig changed from OFF to ON
then
	if (AlarmStatus_Hus = OFF) {
	logInfo("Neato.rule","Alarm is OFF, Time triggered, sending CLEAN Command to Neato")
	Neato_SendCommand.sendCommand("CLEAN")
    }
end

Hmm… Now i get this, when it time for the rule to trigger:

2018-11-24 11:42:00.339 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule ‘Neato Autostart’: An error occurred during the script execution: Couldn’t invoke ‘assignValueTo’ for feature JvmVoid: (eProxyURI: (1)_neato_autostart.rules#|::0.2.0.2.0.0.0::0::/1)

I fixed some typos in the rule above.
try to copy it again

can you post your Neato_SendCommand Item definition?

Stil getting this:

2018-11-24 11:50:00.151 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule ‘Neato Autostart’: An error occurred during the script execution: Couldn’t invoke ‘assignValueTo’ for feature JvmVoid: (eProxyURI: neato_autostart.rules#|::0.2.0.2.0.0.0::0::/1)

.Item file:

Number Neato_BatteryLevel “Batteriniveau [%.0f %%]” {channel=""}
String Neato_CurrentState “Status [%s]” {channel=""}
String Neato_CurrentAction “Nuværende aktion [%s]” {channel=""}
Switch Neato_IsDocked “I Dock [%s]” {channel=""}
Switch Neato_IsCharging “Lader [%s]” {channel=""}
String Neato_Error “Fejl [%s]” {channel=""}
String Neato_SendCommand “Send Komando”

I linked the items via the binding in paper UI. In my sitemap i created a mapping switch, and that one is working, when i press the clean button.

Switch item=Neato_SendCommand mappings=[CLEAN=“Clean”,STOP=“Stop”,PAUSE=“Pause”,RESUME=“Resume”, DOCK=“Send to dock”]

oops sorry… more errors in the rule…

rule "Neato Autostart"
when
	Time cron "0 55 10 ? * MON,WED,THU,FRI,SAT *" or
	Item Rule_Trig changed from OFF to ON
then
	if (AlarmStatus_Hus.state == OFF) {
		logInfo("Neato.rule","Alarm is OFF, Time triggered, sending CLEAN Command to Neato")
		Neato_SendCommand.sendCommand("CLEAN")
    }
end

what is the Item definition of AlarmStatus_Hus ? is it a Switch?

Yes, a switch. ON/OFF

I have update the rule here
it should? work :slight_smile:

Nothing is happening? :frowning: And i don’t see anything at all in the log, when the time reach the trigger point

i haven’t validated your cron expression… i can’t find now the online tool that checks it…

did you use a Rule_Trig Item? (no need to wait for the time to trigger)

I did. Nothing happens.

2018-11-24 12:16:36.302 [ome.event.ItemCommandEvent] - Item ‘Rule_Trig’ received command ON

2018-11-24 12:16:36.333 [vent.ItemStateChangedEvent] - Rule_Trig changed from OFF to ON

I don’t get any info in log about the rule bin trigged, just that i changed the rule trig item from off to on.

then there must be some error with the cron expression

try to remove it and see if the rule fires when using only the dummy Item as a trigger

rule "Neato Autostart"
when
	Item Rule_Trig changed from OFF to ON
then
	if (AlarmStatus_Hus.state == OFF) {
		logInfo("Neato.rule","Alarm is OFF, Time triggered, sending CLEAN Command to Neato")
		Neato_SendCommand.sendCommand("CLEAN")
    }
end

Still the same, nothing happens when i delete the cron and fires the rule trigger

check the if condition
what is the current state of the AlarmStatus_Hus Item?
If it’s ON: nothing will happen when the rule triggers :slight_smile:

The AlarmStatus_Hus was “NULL”, it helped when i first trigged it to on, then off. Why was it not updated, and had state:NULL?

without the Item config… noone can help :slight_smile:

when posting configs: use code fences !!! :slight_smile:

I suspect it is because the IHC controller, that sends the “Alarm status” ON/OFF signal, only update openhab items when status has changed in the IHC. Then if i restart Openhabian, it will read “NULL” until the IHC status changes and send updated state to Openhab. It could be nice, if openhab could read the current status and update from IHC, when restarting.

All Items will come up with state NULL when OH2 starts up for the first time (no need to restart your system)

Immediately after startup, the Items will be updated from their bindings.

You can also use a persistence service (e.g. MapDB) to perform restoreOnStartup.
The service will store the last state and restore it back to the Items (before they get binding updates)
The binding updates will arrive based on your specific configuration. It may be based on an interval or immediate.

Well. Thank you very much for your help. It is now working like a charm. I have been strugeling with this for a week or so now. I apriciate :smiley:

1 Like

image