Is there a way to create a relational table to interpret error codes?

Platform information:

  • Hardware: x86 desktop computer, 16GB RAM, 1TB SSD, Nortek HUSBZB-1 USB Zwave and Zigbee controller, networked through Ethernet (not wi-fi)
  • OS: 64bit Ubuntu 20.4 headless server with Apache2, Nextcloud, MySQL, SubSonic, MQTT server, zigbee2mqtt
  • Java Runtime Environment: Zulu 11 64 bit
  • openHAB version: openHAB 3.2.0.M1
  • Issue of the topic:

I am receiving data from a Fronius Symo inverter through the Fronius binding in OH3, it’s working fine (as far as I can tell).

The binding reads a lot of data and communicates that back to OH3, including but not limited to the inverter state codes and any error codes. Fronius language is a little confusing here in that error codes do not necessarily indicate an error in the operation of the inverter - sometimes an error code can simply communicate that there is no DC power being received from the solar array…usually the cause of this is because it’s night time!

I have a table of error codes for my inverter and what each means in plain language (a web page, I don’t have a table in OH3). I am able to access these codes in OH3, I currently have them published to my Sitemap in raw form i.e. as they are read from the channel of my Symo Inverter Thing, which is a number.

I would like to create an Item to hold the interpreted String State of the inverter error code, as updated from the appropriate channel of the Symo Inverter Thing.

Is there a way to create a lookup table in OH3 so that in a rule, I would be able to read the error code as it is updated from the appopriate channel of the Symo Inverter Thing and update an Item with the equivalent plain language state (in a string)?

I could then use the string item in my sitemap.

You could either create a Map<Number, String> in a rules file that you can use when updating a String Item, or you can use a map transformation or the state description of the item to display the text in the UI instead of the number.

1 Like

Understood, thank you. This gives me a direction in which to research, I’ll look into it.

If your main concern is display, use the Map transformation. Then in the State Descriptions/Item labels use that transformation to map the error code with the text description.

1 Like

Display is, yes. Functionality in terms of reading the codes works very well.

I’m looking into map transformations and documentation.

Thank you.

A limitation of the MAP transform is that there is no “pass-through” for unknown/unlisted inputs, which in this particular case might be exciting unexpected errors.
You could work around this when using MAP in a rule, exploiting the (fixed) catch-all MAP option to detect unlisted codes, and modifying the output to include or substitute the original code.