Lightwave switch initial state

Hi, I’m very new to OpenHab so apologies in advance if this is a stupid question but…

My openhab installation currently has a switch set up and is linked to my Lightwave socket (controlling a lamp). When I start up openhab it doesn’t seem to detect whether the Lightwave socket is on or off, the browser just shows the switch in the “Off” position even although it is on.

I have to manually toggle it to get it in the correct state in OpenHab. Is there a way for the state of the socket to be detected when openhab is initially started up so it shows the correct state of the socket?

Thanks

Im new to openhab myself

But from what I’ve learned you want some kind of persistence like rrd4j
wiki: https://github.com/openhab/openhab/wiki/rrd4j-Persistence

This tutorial was very helpful to me. The rrd4j persistence info is near the end. just ctrl-f to find the rrd4j section.

(after reading that)
The key function you are looking for is

// persist everything when the value is updated, just a default, and restore them from database on startup
* : strategy = everyChange, restoreOnStartup

Hope that helps I used that to set up my temperature logging and got it to work.

@Cyberzoid is right, when openHAB starts it needs to load the ‘existing’ states from the persistence engine.

However, if you mean that you’d like openHAB to query the physical socket to find out whether it is switched on or off. Then you’re out of luck, the lightwave switches cannot transmit their current state, they only receive commands.

C

I also have a home built lightswitch that only receives commands (will change soon)

One method of knowing which state the lightswitch is in would be to let openhab be the sole controller for the light. The idea being "I know its on cause i told it to be on"
Powerfailure being a failure point of this. However if the light stays off after a power loss, you can use a rule to set the state of the light to off during openhab’s startup to resync states.
That or some pesky human using their app to change the light without telling openhab about the action.

With the latest lightwave binding if someone uses the app on your network OH will update (it doesn’t work if they do it over the internet). However as you say there is no way to query the light switch to find out it’s state so if a message doesn’t arrive you also can’t tell.

This is one way that zwave is better but it is more expensive and doesn’t have any well designed light switches for the UK.

Also if you use Moods or All off I suggest creating a rule that does a postUpdate to the devices you know it changes…

Item:

Switch Bedroom_AllOff { lightwaverf=">room=4,type=ALL_OFF" }

Rule:

rule "ALL OFF"
when
    Item Bedroom_AllOff received update ON
then
  postUpdate(Ceiling, OFF)
  postUpdate(SideLight, OFF)
  postUpdate(FloorLight, OFF)
  postUpdate(Bedroom_AllOff, OFF)
end