3 state switch

Hello

I need something like a switch with 3 states: on / off / auto
Does something like this exist?

background: i want a lamp to be on, off or controlled by another light sensor (auto mode)

You can use normal Switches with a Mapping.

I am not at my pc at the moment but it should look like this.

Switch mapping=[on=“On”, auto=“Auto”, off=“Off”]

Take a look at the wiki entry on sitemaps.

1 Like

Keep in Mind: You will have to use a String Item for this (Switch Item is ON or OFF (or uninitialized))
Or you use a Number Item and set up a Mapping like Switch MySwitch mapping=[1=“On”, 2=“Auto”, 0=“Off”], depends on how you bind the item to your Hardware…

1 Like

There are no trinary switches in OH so you will have to implement some of this yourself. @patrickse and @Udo_Hartmann have already suggested answers to part of the problem.

There are three parts to this.

Sitemap:

As @patrickse suggests, you will need to add your Item as a Switch with a Mapping on your sitemap to give you the three buttons on your UI.

Item:

As @Udo_Hartmann suggests, you will need to make your Item be a String or a Number as Switches cannot have three states.

Rule:

You need a rule set up that triggers on changes to the Item and when it switches to ON it sends a command to your lamp Item to switch ON, when OFF it sends the command to the lamp Item to OFF. You also need in your rule that processes updates to your light sensor an if statement that checks whether the Item is AUTO.

1 Like