I have a Meross Wi-Fi switch configured to run connected to a local (On-Premise) MQTT Server.
I want to trigger an event based on Power Consumption changes.
Unfortunately, the Meross switch doesn’t post power consumption changes to the queue unless you send an MQTT command first. That is, you send a message to the queue requesting power consumption, and the device sends a response to the queue with the current power consumption.
I’m guessing that the best way to do this is to create a rule that runs at a specific interval (once per minute would do for me) that sends the MQTT command.
This seems a little clunky, so I wondered if there was a better way?
you could write a shellscript/pythonscript/NodeRed/… doing the #4. part for you - but somewhere you have to trigger the power consumption message, if the device can’t do that alone.
(if you don’t like an item for it, you could also just trigger the channel from the rule, but that’s cosmetics)
Just to be clear, some bindings do let you set up a polling period in the Thing. The HTTP binding comes to mind.
However, the nature of MQTT is that it’s supposed to be a push. When a device has something to say, it should publish it. Let the subscribers decide what’s worth processing or not. I truth, your Meross Switch is miss using MQTT by forcing you to “query” for this information.
So while the concept of a binding that can poll is not unheard of, it would be a misuse of MQTT and therefore the MQTT binding doesn’t directly support it.
But that’s OK, that’s one of the things that rules are for, to handle those use cases that are outside the norm. And it’s really no more difficult to set up a rule to do this than it is to set up the HTTP binding to do this.
Hi, I also have some Meross Wi-Fi switches (MSS310) that should provide power consumption.
Currently I am only able to switch them on or off.
What is the command you send to get power consumption via MQTT?