Easy Away Switch / Ruleengine

Hi guys.

I have set up my rollershutters and everything works fine. They go down when the sun goes down etc.

Now i would like to go them down earlier when i am Away.

item file

switch awayswitch

sitemap file

   Switch item=awayswitch label="Away"

Now i would like to set up a rule

if rangeevent sunset is triggered &&
if awayswitch == ON
than sendCommand rollershutter DOWN

I cannot find my awayswitch in the rule engine. Only items which are connected to things.

Hi Toto

You could try and write the rules directly in a .rules file
It would probably be something like this:

rule "Away WindowRoller"
when Item Sunset received update ON
then if (awayswitch.state==ON){


Regards Chris

Thank you :slight_smile:
Next problem: How can i save the state of the item awayswitch

What do you mean by “save the state” ? Are you talking about persistence ? (If so, check the restoreOnStartup strategy)

1 Like

When i switch the awaystate to ON and reload the BasicUI its again OFF

Examples of how to trigger rules based on sunset and/or set times of day:

Example of how to generically track presence:

You will have to decide what sorts of sensors to use to detect presence. The Network Binding tends to be a common first choice for most users.

1 Like

Thank you for the information.

Could you maybe also help me with my complete noob problem above?

When i use the simple away switch in the sitemap its giving me this error:

2017-11-21 20:34:56.497 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'awayswitch' for widget org.eclipse.smarthome.model.sitemap.Switch
2017-11-21 20:34:57.806 [INFO ] [rest.core.internal.item.ItemResource] - Received HTTP POST request at 'items/awayswitch' for the unknown item 'awayswitch'.

Do i have to add a things file to get my lonely switch work?

All I can recommend is to review the Beginner’s Tutorial.

The error indicates that there is no such thing as “awayswitch” in your configuration. And your second question indicates you do not yet understand some of the key concepts of OH, in particular what Things are.

There is not enough information provided to give a specific suggestion. But I do notice that switch awayswitch should be Switch awayswitch.

1 Like

Thank you thank you and once again thank you. That solved it