Virtual Items

I’m new to OpenHab, running OpenHab2 on a Pine64 with their ZWave board. I’m testing it out and considering moving away from Domoticz.

Now my question is I have stuff in the house that don’t fall into a generic category or binding. Specifically I have a thermometer connected to a RasPi and a motorized blinds with soldered remote hooked to another RasPi’s GPIO. How do I get these two items into OpenHab?

  1. For the thermometer, I would create an item like this (from Tutorial):
    Number Sensor_Temperature “The Temperature is [%.1f °C]” (gTemperature, gSensor) {knx=“1/0/15+0/0/15”}
    What do put in the bindings? I expect the pi to periodically make a REST call to set the temperature, so it’s passive.

  2. For the blinds, I would have to add a virtual item like the thermometer as a switch or rollingshutter, Then how do I get it to call a script or a REST/URL to open/lower the blinds?


If the item is updated through REST, you don’t need to define any binding, just omit the {} part :slight_smile:
For the roller shutter, I would suggest the exec or http binding.

As Udo said, for 1) just omit the stuff in { }. You are making a REST call so don’t need any binding at all. This is the very definition of a “Virtual Item” (I still hate that term but haven’t thought of a better one).

For 2) I don’t really know what the “it” is you need to call a script? If you mean openHAB needs to call the script there are several approaches. You can use the Exec binding or the executeCommandLine action to call a script or python program or what not on the OH machine. You can use the HTTP binding or the http actions to make REST calls from OH, or you can set up a messaging bus and use MQTT for all this sort of messaging (which is what I’ve done).

In all of these cases you need some sort of server on the remote Pi to catch the commands and trigger the GPIO pins appropriately. Or, if you use Exec you can do an ssh to the remote Pi to trigger the command.

Look into raspbian’s built in REST API for commanding the GPIOs.

Maybe an unbound item would be more figural?

I really like that! Henceforth I shall use “unbound item”. Thanks!