You can use a simple rule triggered by Thing status changes and update an Item, right? That’s probably going to be way easier than mucking with the REST API form a rule.
You could also use executeCommandLine to interact with the karaf console.
If you have a lot of Things to map to Items, you can use Thing Status Reporting [4.0.0.0;4.9.9.9] to make handling that a little easier.
Finally, in JS Scripting and jRuby (perhaps others) you have access to the ThingRegistry
. If you have the ThingUID (which you need to use the REST API too) you can get at the status directly.
if( things.getThing("shelly:my:thing").getStatus().toString() != "ONLINE" )