Warnings from OpenMQTTGateway

  • Platform information:
    • Hardware: Raspberry Pi, Theengs plug
    • OS: Raspbian Bullseye
    • Java Runtime Environment: Azul 17
    • openHAB version: 4.1.1
    • I have installed the Jinja and JSONPath bindings

I’m getting a few warnings from items from my Inkbird temperature sensor.

  1. Exception while formatting value ‘100’ of item KitchenRefrigeratorBattery with format ‘%s %’: Conversion = ‘%’
  • I’m guessing this is because a single % is not valid. Should it be %% ?
  1. Command ’ off’ from channel ‘mqtt:homeassistant_C8F09EB93B38:f2399099:TheengsPlugKitchen:C8F09EB93B38_2DinUseRN8209#sensor’ not supported by type ‘OnOffValue’: No enum constant org.openhab.core.library.types.OnOffType. off
  • Is this because of the leading space in ’ off’ ?
  1. Could not transform state ‘3.1 °C’ with function ‘{{ value_json.tempc }}’ and format ‘%s’
  • This is surprising because I’m converting to Fahrenheit and it seems to be working fine.

This is my first device using OpenMQTTGateway. Have I done something wrong? Are there any setting that I can try to work around these?

Thanks

Hi @LennyG

It seem you didn’t use auto-discovery for your Inkbird thermometer, which is fine, but

As the battery level is being received as a integer it should be formatted as such, with

%d %%

Again, the temperature here is a float, so should be formatted as such with however many decimal places you want. If you want the temperature in Fahrenheit, there is no need to convert it, as OpenMQTTGateway already sends both the tempc and tempf in its MQTT JSON. So tempf with

%.1f °F

I’m not too sure which channel you are talking about with the Command OFF with a space. I’m getting this with the same OpenMQTTGateway Plug you are using

using the JSON .cmd 0 and 1 as ON/OFF with a transformation, with my manual text configuration like

[ stateTopic="home/OpenMQTTGateway/ONOFFtoMQTT", commandTopic="home/OpenMQTTGateway/commands/MQTTtoONOFF", formatBeforePublish="{\"cmd\":%s}", transformationPattern="JSONPATH:$.cmd", on="1", off="0" ]

Hope this helps with your setup

Thanks for your thorough response.

I thought I was using auto discovery, which is one of the reasons I’m so confused by these errors. I forgot to mention that I set ohdisc to true on the plug. Am I supposed to also do something like that on the thermometer?

The MQTT configuration section for the thing shows:

binary_sensor/49240110079A-extprobe
sensor/49240110079A-batt
sensor/49240110079A-hum
sensor/49240110079A-tempc

There’s no tempf, even though when I use mosquitto_sub I see tempf. On a similar note, I’d like to create an item for rssi, which is on the topic but didn’t get auto discovered.

I’m not sure which channel is complaining about the space in " off", but from the error it looks like it’s complaining about in_use. I don’t see any channel with that name.

Thanks again for your help.

OK, I’m getting close. I added the pattern you suggested for the battery and that fixed that problem. The temperature channel that was giving errors was the temperature of the plug, not of the Inkbird sensor.

One remaining question @Hans_Lree . Which directory/file do you have that transformation in? I have some .map files that I created in the transform directory a long time ago. Is that the directory you’re referring to?

Thanks again,
Lenny

Hi @LennyG

Correct, in general the transformations are in the transform directory, so a .map transformation file could work there, even though I defined the transformation in the textual Thing definition itself above.

Also important is the publish command, with "{\"cmd\":%s}", or respectively "{\"cmd\":1}" and "{\"cmd\":0}"switching the Plug on and off.

Hope this helps.

Sorry if I’m being dense, but I can’t find the place you’re defining this transform on the UI. Is it on the Thing, Channel, or the Item? What’s the label on the field? Could you maybe include a screen shot of the whole page?

I can show you how my textual configuration comes up in the UI.

It’s when selecting the Plug Thing > Channels > State channel > Configure Channel > Show advanced

Hope this helps.

None of my channels have the Show Advanced checkbox. Is there some trick to getting that displayed? Here’s the one that is causing the warnings.

Correct, if you use auto-discovery there won’t be any Show Advanced check boxes, but the required definitions will be in the bottom field.

The problem here being that openHAB doesn’t implement the Home Assistant discovery convention fully compatible, and certain types are not supported at all, this specific binary_sensor type inUseRN8209 being one of them. For other types like switches there is also a problem with the assigned name, as you might have also discovered.

You might want to delete this point to avoid the warnings until we may find out how the HA discovery convention has only been partially implemented. Unfortunately incomplete and missing documentation about discovery conventions doesn’t make it a straight forward endeavour at the moment.

I don’t have a point for this so there’s nothing to delete. I’m getting a lot of other noise in the log from this Thing too. I’m thinking of starting over without auto discovery. What do you think? How would I do that? Just set ohdisc on the device to false?

Thanks

Just set the general disc to false, so that there are no more discovery messages created under the homeassistant topic. At the same time you should also delete the already existing respective discovery entries entries under the homeassistant topic.

Or you could just delete the affected entries after setting disc to false, as openHAB seems to have implemented sensor and number entries correctly, but just cannot deal properly with switch, binary_sensor, device_tracker etc. entries at this stage.