mgbowman / openhab-addons

The next-generation open Home Automation Bus (openHAB)
Eclipse Public License 2.0
13 stars 2 forks source link

Update README.md #1

Closed AngelosF closed 5 years ago

AngelosF commented 5 years ago

2 super minor updates: add in the "Full Example" the site="default" conf option add in the transform/unifi.map the NULL mapping also

AngelosF commented 5 years ago

Closing due to updates in README.md for the new version of the binding with $cid

NULL should be added to the map nevertheless :)

mgbowman commented 5 years ago

NULL should be added to the map nevertheless :)

Oops! I forgot this one!

Is it NULL=.. or -=..? I remember seeing some maps that used - as the catch all.

AngelosF commented 5 years ago

I am using the following at the end of all of my MAP files

-=OK
.=UNKNOWN
NULL=UNKNOWN

I am not sure how they work... I found them somewhere on the interweb and I copied them 💃

mgbowman commented 5 years ago

Looks like one of us needs to dig through the code and and figure out which one it is!

I nominate you! 🙊

AngelosF commented 5 years ago

According to this: https://github.com/eclipse/smarthome/blob/a92d3f7ef546e517518b745e3e9fff845f9d635f/extensions/transform/org.eclipse.smarthome.transform.map/src/main/java/org/eclipse/smarthome/transform/map/internal/MapTransformationService.java#L48-L57

There is no catch-all. You just need to define the source to be converted to the target If the result of the target is null, then it throws a TransformationException, complaining that there is no source found.

So: If you want (optional) you can add:

UNDEF=Undefined
NULL=Unknown

Just in case the Item is updated to these 2 states due to an error.

Ref: https://community.openhab.org/t/lifecycle-of-an-item/17473/8