4u2fast
(Thomas Kranz)
October 16, 2021, 9:13am
1
Hi,
I’m using a Zigbee2Mqtt bridge based on Raspi4 with CC2652R USB Stick to get messages from IKEA Zigbee devices to openhab via MQTT.
This solution is working perfect but i’m not abe to get the information from the rotary encoder to as String.
here the configuration
Thing topic Ikea_Drehencoder_1 {
Channels:
Type string : action "Action" [stateTopic = "zigbee2mqtt/Ikea_Drehencoder_1", transformationPattern="JSONPATH:$.actionnREGEX:.*(brightness_move_up|brightness_move_down|brightness_stop).*"]
Type number : battery "Battery level" [stateTopic = "zigbee2mqtt/Ikea_Drehencoder_1", transformationPattern="JSONPATH:$.battery"]
Type number : linkquality "Link quality" [stateTopic = "zigbee2mqtt/Ikea_Drehencoder_1", transformationPattern="JSONPATH:$.linkquality"]
}
String Ikea_Drehencoder_1_action "Zigbee Drehencoder Aktion" (Status) {channel="mqtt:topic:mysecureBroker:Ikea_Bewegungsmelder_1:action"}
Number Ikea_Drehencoder_1_Battery "Zigbee Drehencoder Batterie [%d %%]" (Status) {channel="mqtt:topic:mysecureBroker:Ikea_Bewegungsmelder_1:battery"}
Number Ikea_Drehencoder_1_linkquality "Zigbee Drehencoder linkquality [%d %%]" (Status) {channel="mqtt:topic:mysecureBroker:Ikea_Bewegungsmelder_1:linkquality"}
in the MQTT explorer i reveive the following updates
{“action”:“brightness_stop”,“battery”:87,“linkquality”:30,“update”:{“state”:“idle”}}
{“action”:“brightness_move_up”,“action_rate”:195,“battery”:87,“linkquality”:63,“update”:{“state”:“idle”}}
{“action”:“toggle”,“battery”:87,“linkquality”:54,“update”:{“state”:“idle”}}
{“action”:“brightness_move_down”,“action_rate”:195,“battery”:87,“linkquality”:42,“update”:{“state”:“idle”}}
any suggested how to fix this ?
thanks
Thomas
rossko57
(Rossko57)
October 16, 2021, 9:39am
2
I’ve little idea what your REGEX is supposed to do.
Start simple, just leave that out.
transformationPattern="JSONPATH:$.action"
Does that work?
4u2fast
(Thomas Kranz)
October 16, 2021, 9:50am
3
have tried that before, but doesn’t return anything
maybe because of the quotation marks ?
{“action”:“brightness_move_down”,“action_rate”:195,“battery”:87,“linkquality”:54,“update”:{“state”:“idle”}}
Check your syntax just before REGEX
- that looks like an n
to me, but you need the intersection character ∩
rossko57
(Rossko57)
October 16, 2021, 9:56am
5
If it didn’t work when starting simple, why would adding more complexity help…
Don’t forget when making edits to xxx.things
file that the binding isn’t very good about picking up changes. Restart binding or openHAB after you have made your best guess.
4u2fast
(Thomas Kranz)
October 16, 2021, 9:59am
6
yes, i know restarting openhab after mqtt changes is required
Still i need to figure out how to read this value in quotation marks
rossko57
(Rossko57)
October 16, 2021, 10:04am
7
Show us your channel now. Strings in JSON always come in quotation marks, just like the field names, its quite ordinary.
4u2fast
(Thomas Kranz)
October 16, 2021, 10:33am
8
found the issue ! my mistake in Item definition used the wrong device
error due to copy past from other Ikea Item
2021-10-16 12:31:59.424 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Ikea_Drehencoder_1_linkquality' changed from 3 to 72
2021-10-16 12:31:59.424 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Ikea_Drehencoder_1_action' changed from toggle to brightness_move_up
2021-10-16 12:31:59.615 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Ikea_Drehencoder_1_action' changed from brightness_move_up to brightness_stop
2021-10-16 12:31:59.736 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Ikea_Drehencoder_1_linkquality' changed from 72 to 75
2021-10-16 12:31:59.736 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Ikea_Drehencoder_1_action' changed from brightness_stop to brightness_move_up
2021-10-16 12:31:59.931 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Ikea_Drehencoder_1_linkquality' changed from 75 to 78
2021-10-16 12:31:59.932 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Ikea_Drehencoder_1_action' changed from brightness_move_up to brightness_stop
2021-10-16 12:32:02.057 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Ikea_Drehencoder_1_linkquality' changed from 78 to 75
2021-10-16 12:32:02.058 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Ikea_Drehencoder_1_action' changed from brightness_stop to brightness_move_down
2021-10-16 12:32:02.243 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Ikea_Drehencoder_1_action' changed from brightness_move_down to brightness_stop
2021-10-16 12:32:03.570 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Ikea_Drehencoder_1_linkquality' changed from 75 to 72
2021-10-16 12:32:03.570 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Ikea_Drehencoder_1_action' changed from brightness_stop to brightness_move_down
2021-10-16 12:32:03.762 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Ikea_Drehencoder_1_action' changed from brightness_move_down to brightness_stop
2021-10-16 12:32:05.663 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Ikea_Drehencoder_1_action' changed from brightness_stop to brightness_move_up
2021-10-16 12:32:05.833 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Ikea_Drehencoder_1_linkquality' changed from 72 to 78
2021-10-16 12:32:05.833 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Ikea_Drehencoder_1_action' changed from brightness_move_up to brightness_stop
2021-10-16 12:32:06.432 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Ikea_Drehencoder_1_linkquality' changed from 78 to 72
2021-10-16 12:32:06.433 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Ikea_Drehencoder_1_action' changed from brightness_stop to brightness_move_down
2021-10-16 12:32:06.628 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Ikea_Drehencoder_1_linkquality' changed from 72 to 69
2021-10-16 12:32:06.629 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Ikea_Drehencoder_1_action' changed from brightness_move_down to brightness_stop
2021-10-16 12:32:08.950 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Ikea_Drehencoder_1_linkquality' changed from 69 to 60
2021-10-16 12:32:08.951 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Ikea_Drehencoder_1_action' changed from brightness_stop to toggle
1 Like