Aggregation of QuantityType in Group Items

Building on the introduction of the new openhab-js 4.0 as presented here:

https://community.openhab.org/t/openhab-javascript-library-releases/144137(https://community.openhab.org/t/openhab-javascript-library-releases/144137)

along with its documentation here:https://github.com/openhab/openhab-js/tree/v4.0.0#quantity

After standing corrected around my mixing up as much as I could of java, openhab-js, DSL notation and what not here: Working with Number:Temperature Items in rules:

I have finally upgraded to:
openHAB 3.4.2
openhab-js 4.0.0

and was trying out a few things around the simplier item notation and quantity types.

I have simplified my power generation items:

Group:Number:SUM    El_Load          "Load"                                      
Number:Power        El_GenPower      "PV Power"                     (El_Load)                 
Number:Energy       El_Yield_Year    "PV Production Year"    
    {channel="solaredge:generic:TDI1:aggregate_year#production"}
Number:Power        El_GridPower     "Active Grid Power"            (El_Load)                                           
    {channel="homewizard:p1_wifi_meter:GAP1:active_power" }

The Load is supposed to the sum of GridPower (positive for import, negative for export) and GenPower (zero or positive). These are apparently correctly set as quantityTypes. I was wondering, why Group:Number:SUM El_Load Item doesn’t get cast into the correct quantityType. The sum is done correctly, it just misses the unit. (console.log of item, state, numericState, quantityState, dimension, unit, symbol, float and integer of all items follows)

...3.906 [INFO ] [] - El_Yield_Year (Type=NumberItem, State=143.71 kWh, Label=PV Production Year, Category=null)
...3.923 [INFO ] [] - state 143.71 kWh
...3.934 [INFO ] [] - numericState 143.71
...3.951 [INFO ] [] - quantityState 143.71 kWh
...3.986 [INFO ] [] - d/u/s/f/i [L]²·[M]/[T]² null null 143.71 143
...3.991 [INFO ] [] - -------------------
...3.998 [INFO ] [] - El_GridPower (Type=NumberItem, State=-15 W, Label=Active Grid Power, Category=null, Groups=[El_Load])
...4.005 [INFO ] [] - state -15 W
...4.012 [INFO ] [] - numericState -15
...4.022 [INFO ] [] - quantityState -15 W
...4.047 [INFO ] [] - d/u/s/f/i [L]²·[M]/[T]³ Watt W -15 -15
...4.051 [INFO ] [] - -------------------
...4.058 [INFO ] [] - El_GenPower (Type=NumberItem, State=1200 W, Label=PV Power, Category=null, Groups=[El_Load])
...4.065 [INFO ] [] - state 1200 W
...4.073 [INFO ] [] - numericState 1200
...4.083 [INFO ] [] - quantityState 1200 W
...4.105 [INFO ] [] - d/u/s/f/i [L]²·[M]/[T]³ Watt W 1200 1200
...4.110 [INFO ] [] - -------------------
...4.116 [INFO ] [] - El_Load (Type=GroupItem, BaseType=NumberItem, Members=2, State=1185, Label=Load, Category=null)
...4.123 [INFO ] [] - state 1185
...4.131 [INFO ] [] - numericState 1185
...4.141 [INFO ] [] - quantityState 1185
...4.162 [INFO ] [] - d/u/s/f/i one null  1185 1185
...4.166 [INFO ] [] - -------------------

On a side note, I’m wondering, why the El_Yield_Year while being a correct Energy QuantityType item, has quantityState.unit and quantityState.symbol as null

Note, the Tutorials and Examples category is a place to post tutorials, not to ask for them.

Because you’ve set the base type to Number, not Number:Power. Numbers do not carry units. Group:Number:Power:SUM should work. If not, you’ll likely have to wait until OH 4 where it appears the whole way units are applied to Items might change.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.