Storing custom data points

Hey there everyone. Super new to OpenHAB, but a longtime developer. Here’s what I’m trying to do… Myself, my girlfriend and my two kids each have a cellphone. I also have a Zwave system including a ZWave thermostat. I’ve bound the MAC of each cellphone to a specific IP in the DHCP settings of my router and I’m using the Network binding to use that for presence detection. I’m also able to access the Zwave thermostat successfully.

My problem is that I want to set the desired temperatures based on who’s home, but can’t figure out one silly thing… How so I store the desired temperature of each person… There’s no “Person” object (aka “Thing”), and even if there was, I can’t seem to add my own properties (aka “Items”) like “Desired maximum temperature” or “Desired minimum temperature” to the existing Things. Persistence stuff seems to be geared towards keeping track of how existing items change over time for graphing purposes… Where would I store arbitrary, custom data like this? Thanks in advance!

welcome! :slight_smile:

I can think of 2 ways to implement what you want:

a) With “dummy” items (not bound to a config)

//in [items]:
Number Person01_Temp "Desired Temp Setpoint for Person01 [%.1f °C]"
// in [sitemap]:
Setpoint item=Person01_Temp icon="temperature" minValue=10 maxValue=40 step=1

b) As values within a rule

val	Integer	P01_Temp = 25
rule "Set_Temp"
	Item P01_Presence changed from OFF to ON

Of course, you can combine:


Note1: I haven’t tried out any of the above :slight_smile:
Note2: The desired temperature value will be stored within the state of the (dummy) item. Use persistence to restore that value to the state of the item even after OH2 restart.

Just to clear up some confusion. One does not add Items to Things. One links Items to one of a Thing’s Channels.

1.x version bindings do not have Things so Items are bound to a binding directly.

Items do not require being linked or bound. These are often called “unbound” or “virtual” Items. Dim called them “dummy” Items in his suggestions.

1 Like