Eric
(Eric Tsai)
June 22, 2018, 6:54am
1
This worked all day long for me in previous version of OpenHAB, but doesn’t seem to anymore.
Number itm_washer "Washer Status [MAP(laundry.map):%s]" (ALL) {mqtt="<[mymosquitto:/+/+/c8dbdb869c92/vib:state:MAP(laundry.map)]"}
I’ve also tried state:default instead of state:MAP
sitemap:
Text item=itm_washer
Transform file laundry.map
1=Running
0=Idle
NULL=unknown
I see the label Washer Status, but no text or number on the right side of it. It’s just blank.
/var/log/openhab2/openhab.log gives this error:
[rm.AbstractFileTransformationService] - Could not transform ‘-’ with the file ‘laundry.map’ : Target value not found in map for ‘-’
The error might be startup error.
I’m publishing this to MQTT:
mosquitto_pub -h localhost -t '/ble/livingroom/c8dbdb869c92/vib' -m '1'
Dim
(Angelos)
June 22, 2018, 7:02am
2
add another entry in your laundry.map file:
1=Running
0=Idle
NULL=unknown
-=unknown
This will not solve your problem of course…
Something is not working with your subscription. The item state is currently -
Try not to use the single level wildcard (+
) and don’t use the leading separator to see if things improve:
Number itm_washer "Washer Status [MAP(laundry.map):%s]" (ALL) {mqtt="<[mymosquitto:ble/livingroom/c8dbdb869c92/vib:state:MAP(laundry.map)]"}
and of course, check your logs for connection problems between OH and the broker
vzorglub
(Vincent Regaud)
June 22, 2018, 9:25am
3
Add a space after the {
and before the }
Number itm_washer "Washer Status [MAP(laundry.map):%s]" (ALL) { mqtt="<[mymosquitto:/+/+/c8dbdb869c92/vib:state:MAP(laundry.map)]" }
rlkoshak
(Rich Koshak)
June 22, 2018, 2:18pm
4
You have a Number Item.
Presumably your MQTT message is a Number.
But you apply laundry.map to the MQTT message which returns a String (Running, Idle, unknown) which cannot be assigned to a Number Item.
You then apply the same laundry.map to the label.
So you either need to
Change the Item to a String Item and remove the MAP in the label
Remove the MAP in the MQTT config and change it to default
.
Eric
(Eric Tsai)
June 23, 2018, 2:05am
5
@rlkoshak ,
Well, that was strange. I tried state:default before and it didn’t work. Tried it again just now and everything works correctly.
Thanks!