- Posts: 339
- Thank you received: 28
Do something (run a macro?) on receipt of an MQTT message?
- andrew
- Topic Author
- Offline
- User
-
Less
More
1 year 9 months ago #3543
by andrew
Do something (run a macro?) on receipt of an MQTT message? was created by andrew
Is it possible to do something such as run a macro on receipt of an MQTT message? I'm using myServer as the MQTT broker and messages are getting sent to it. And I've got the hang of server variables being set from the payload of messages. The problem I have is that I'm using a wireless (battery powered) push switch and each time you press it Zigbee2MQTT sends the following:
Can I run something based on an MQTT message arriving?
Andrew
Because the action is 'single' each time the message is sent the myServer server variable called 'zigbee2mqtt_kitchen buttonaction' always has the value 'single' so it doesn't change, so I can't use 'changes value' as a trigger in a macro.Topic: zigbee2mqtt/Kitchen button
Payload: {"action":"single","battery":100,"linkquality":68,"voltage":3100}
Can I run something based on an MQTT message arriving?
Andrew
Please Log in to join the conversation.
- aa6vh
- Offline
- User
-
Less
More
- Posts: 108
- Thank you received: 7
1 year 9 months ago #3544
by aa6vh
Replied by aa6vh on topic Do something (run a macro?) on receipt of an MQTT message?
Just brain storming here (and there may be a better way), but couldn't you save off the current time ({{CURRENT_TIME}} or one of the similar server variables) when a MQTT message is received? Then trigger on that variable changing value.
Please Log in to join the conversation.
- andrew
- Topic Author
- Offline
- User
-
Less
More
- Posts: 339
- Thank you received: 28
1 year 9 months ago #3545
by andrew
Andrew
Replied by andrew on topic Do something (run a macro?) on receipt of an MQTT message?
Thanks, but if I could save the current time on receipt of an MQTT message I could probably do the action I want to do instead. I don't know how to do anything on receipt of a message (rather than on a zigbee2mqtt related server variable changing).Just brain storming here (and there may be a better way), but couldn't you save off the current time ({{CURRENT_TIME}} or one of the similar server variables) when a MQTT message is received? Then trigger on that variable changing value.
Andrew
Please Log in to join the conversation.
- andrew
- Topic Author
- Offline
- User
-
Less
More
- Posts: 339
- Thank you received: 28
1 year 9 months ago #3570
by andrew
Andrew
Replied by andrew on topic Do something (run a macro?) on receipt of an MQTT message?
@David Li @davep Any ideas about this? Or is it just not doable?
Thanks, but if I could save the current time on receipt of an MQTT message I could probably do the action I want to do instead. I don't know how to do anything on receipt of a message (rather than on a zigbee2mqtt related server variable changing).Just brain storming here (and there may be a better way), but couldn't you save off the current time ({{CURRENT_TIME}} or one of the similar server variables) when a MQTT message is received? Then trigger on that variable changing value.
Andrew
Andrew
Please Log in to join the conversation.
Time to create page: 0.175 seconds