johane
(Johan Eriksson)
May 18, 2022, 6:20am
1
Hi,
I’m trying to get the availabilityTopic for a IKEA trådfri socket.
I have managed to get state and linkquality working, but I can’t get the availabilityTopic.
Here is my current “Thing” setup:
Thing topic ZT007 "ZT007" @ "House" [availabilityTopic="zigbee2mqtt/ZT007/available/state", on="online", off="offline", payloadAvailable="online", payloadNotAvailable="offline"]
{
Channels:
Type switch : state "state" [ stateTopic = "zigbee2mqtt/ZT007", commandTopic = "zigbee2mqtt/ZT007/set/state", on="ON", off="OFF", transformationPattern="JSONPATH:$.state" ]
Type number : linkquality "linkquality" [ stateTopic = "zigbee2mqtt/ZT007" , transformationPattern="JSONPATH:$.linkquality"]
}
Using MQTT Explorer (OS X) I can see the messages as:
Any ideas?
Your availabilityTopic
is
zigbee2mqtt/ZT007/available
by the looks of your screenshot.
Then your on
payload seems to be
{"state":"online"}
johane
(Johan Eriksson)
May 18, 2022, 6:54am
3
Thanks, I didnt realise you could put json in the payloadAvailable , I had to escape the quotation marks.
This is now working:
Thing topic ZT007 "ZT007" @ "House" [availabilityTopic="zigbee2mqtt/ZT007/availability", payloadAvailable="{\"state\":\"online\"}", payloadNotAvailable="{\"state\":\"offline\"}"]
{
Channels:
Type switch : state "state" [ stateTopic = "zigbee2mqtt/ZT007", commandTopic = "zigbee2mqtt/ZT007/set/state", on="ON", off="OFF", transformationPattern="JSONPATH:$.state" ]
Type number : linkquality "linkquality" [ stateTopic = "zigbee2mqtt/ZT007" , transformationPattern="JSONPATH:$.linkquality"]
}
1 Like
No problem.
You don’t need to rename the topic - just click the check box on the post that contains the solution - this way the solution will appear together with the top post, and a check mark will appear in the title automatically.
2 Likes