Struggles with stability

In OH more so than most other platforms or software you may have used, you should always go back to the docs. This is explained there: Persistence | openHAB

Relying on examples or “common sense” does not always end with the right answer so, especially when something isn’t working, it’s always a good idea to return to the docs and reread them to make sure you haven’t made a false assumption.

There are tons of little details like this that can trip you up.

As for the naming convention, I always strongly recommend using names that are meaningful in terms of your actual home automation. Don’t include stuff like what technology it is linked to or some complicated series of fields to name Items. The Items are the model of your home automation so make it a meaningful model. So use names like “Bedroom_Lamp” or “Familyroom_Chandelier” over “Zwave_Node12_Switch”.

Also review Design Pattern: Associated Items for some of the things you can do if you are a little careful with your naming conventions.

It’s not so hard, you just need to cast the states to Number.

(MyNumber1.state as Number) + (MyNumber2.state as Number)

The Rules Engine for Rules DSL isn’t so good at figuring out how to work with DecimalType so just explicitly cast the state to Number every time and you won’t see any problem.

Ah, UoM is different. It does depend on whether you are doing math using the same units or not. For example, if you want to see if the state of a Number:Energy is greater than 5 kWh

MyEnergy.state > 5|kWh

To store that local variable as an kWh units,

var five = 5|kWh

The bar converts the number to the given units. If you are working with two Number:Energy Item’s states, I don’t think you need to do anything assuming they are compatible units.

If you need to remove the units of measurement

(My_UoM_item.state as QuantityType<Number>)
1 Like

Many thanks. I’ll work further on it - it’s all rather addictive, I have to say.