Reload Thing within Rule

Hi all,

I’m currently struggling with the following use case, so maybe somebody has an idea how to solve it.

As my home cinema is rarely in use I want to switch it off completely via Sonoffs. So far so good.
Behind the Sonoff switch there’s a Yamaha surround receiver (besides other things) which is also set up as thing in openHAB.
When I switch of the Sonoff of course the Yamaha receiver becomes offline. Now the problem is that when I switch on the Sonoff the receiver stays offline.

What I’d like to do is to define a rule that reloads the Yamaha thing when the Sonoff is switched on. One option would be to define the thing file based and “touch” the file via the rule, but I don’t really want to mess around with file things and rather keep the thing definition via Paper UI.

Does somebody have an idea how this could be achieved? Is there a way to “reload” things within rules?

Thx upfront! :slight_smile:

Not so much ‘reload’ a Thing, as set it online?

I think that should prompt the binding to try connect. Depends on the binding, which one is involved here?
If there is a thing hierarchy, you might have to try different levels.

An alternative might be to issue a REFRESH command to one of the Items, again it depends on binding what would happen (if anything).

Thanks @rossko57!
That was the right hint I needed…

Following rule (wip) does does the job!

rule "HomeCinema OnOff"
	Item sonHomeCinema received update
	if(sonHomeCinema.state == ON)
		logInfo("HomeCinema Rule", "Switching on Home Cinema")

		logInfo("HomeCinema Rule", "Waiting for Yamaha Receiver to boot")

		logInfo("HomeCinema Rule", "Trying to enable Yamaha Receiver")
		sendHttpPutRequest("http://localhost:8080/rest/things/yamahareceiver:yamahaAV:9ab0********8/enable", "application/json", 'true')

		logInfo("HomeCinema Rule", "Switching on Yamaha Receiver")

		//switch on projector
		logInfo("HomeCinema Rule", "Switching off Yamaha Receiver")

		//switch off projector

		logInfo("HomeCinema Rule", "Disabling Yamaha Receiver")
		sendHttpPutRequest("http://localhost:8080/rest/things/yamahareceiver:yamahaAV:9ab0********8/enable", "application/json", 'false')
		logInfo("HomeCinema Rule", "Switching Off Home Cinema")
1 Like