(Solved)First attempt to rule

Below solved, rule in first post updated with working rule.

Hi,

First post, new to homeautomation, enjoying myself at a slow pace :slight_smile:

So i started to set up my config in text (got some things and items in paperui already)

Added first item

Switch Bedroom_Window_Light "Bedroom Window Light" { channel="zwave:device:958d3dff:node2:switch_binary" }

(I havn´t added the astro channel as an item, do I need to?)

Then went on to make my first rule, wanting to switch on a light at sunset and off at 22:30
I have no imports or anything to my rule (should I?)
Rule is as below:
in ESD i get errors on the channel line: "no viable alternative at input channel"
and at the send.Command lines: “The method or field Bedroom_Window_Light us undefined”

rule "Bedroom Window Light On"

when
	Channel 'astro:sun:local:set#event' triggered START 
then
	Bedroom_Window_Light.sendCommand(ON)
end

rule "Bedroom Window Light Off" 

when
	Time cron "0 30 22 1/1 * ? *"
then
	Bedroom_Window_Light.sendCommand(OFF)
end

So, it aint working, and i do get error messages in the log telling me i messed up
[WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'sovrum.rules' is either empty or cannot be parsed correctly!

Any help is appreciated!
BR
Dennis

Could you edit your post, put a blank line after “Added first item”, select the item text, and click the </> (preformatted text)? This will make it much easier to read. Might as well do this for your rule and the error too :slight_smile:. I’m guessing you have a line feed after the {, which will not work TMK.

An item would not be needed for your current rule.

Imports would not be needed for your current rule.

This will clear up when the item is defined properly.

1 Like

Done!

And thanks for the other clarifications :slight_smile:

//
Dennis

I get one often, I think it’s because I use notepad ++ and im editing a file which the system is using, but Im not sure

1 Like

Also, try:

when
	Channel 'astro:sun:local:set#event' triggered START
then

(set#event instead of set#start)

1 Like

@Moellegaard yup, noticed now that i do get the same warning each time i save the rule even though its working now so ill just ignore it :slight_smile:

@Dim That was it! changed to event and the rule is now working as intended :star_struck:

Took the channel from paperui first where it is “start” but after your advice noticed that its event in the log, bit odd…
image

1 Like