Received update of a not accepted type (PercentType) for item

Greetings

I have the following item defined:

Switch switch99 "switch node 99 sensor 3: [%s]" { mqtt="<[mysensors:sensor-gw1-out/99/3/1/0/16:state:default]" }

Updating this items results in:

Dez 20 23:27:10 autohome openhab.sh[25211]: 23:27:10.821 [INFO ] [runtime.busevents             :26   ] - switch99 state updated to 1
Dez 20 23:27:10 autohome openhab.sh[25211]: 23:27:10.827 [DEBUG] [ore.internal.items.ItemUpdater:73   ] - Received update of a not accepted type (PercentType) for item switch99

Any idea whats wrong here?

Yes; the 1.7* and previous MQTT binding has a hard-coded set of state types that it runs through, trying to parse the message into the first type that parses correctly. The problem is that the receiving item for the update may not accept that kind of state. The 1.8 version of the binding instead knows the data types that are accepted for the intended item, so there is no chance that an incoming subscribed message will result an in incompatible type.

You can grab a replacement MQTT binding JAR from a link in the pull request that fixes the issue, or from the latest CI build.

hmm not really at all :smiley:

There is new error now:

Dez 21 01:40:59 autohome openhab.sh[3103]: 01:40:59.849 [WARN ] [.c.i.events.EventPublisherImpl:80   ] - given new state is NULL, couldn't post update for 'switch99'

mqtt broker still states:

sensor-gw1-out/99/3/1/0/16 1

maybe the result of mixing the versions?

A Switch item must receive an ON or OFF message. Replace the default with MAP(toOnOff.MAP) and make a map like

0=OFF
1=ON

now it works. Thanks. Is there a way to map this again for the frontend in order to translate off to another language?

problem:
mqtt 1 => openhab: OFF => frontend: AUS

0=OFF results in OFF in the frontent too, but there I want another string.

You can add a map to the labeltext. This only affects display. You can add to the de.map file that comes with openHAB or make a new map file.

Your item would look something like this:

Switch switch99 "switch node 99 sensor 3: [MAP(de.map):%s]" { mqtt="<[mysensors:sensor-gw1-out/99/3/1/0/16:state:MAP(toOnOff.MAP)]" }
1 Like

thx 4 your (fast) supoprt!

1 Like