Report state of NGMQTT device

Plugin to control second generation Shelly devices over the MQTT protocol.
SMUSEBY
Posts: 524
Joined: Wed Sep 16, 2009 9:38 pm
Location: California

Report state of NGMQTT device

Post by SMUSEBY »

In my experience, the MQTT Broker / Connector breaks from time to time. For a critical (refrigerator) load, I would like to be able to test the condition, and send an email, or turn it on, etc. For an email, using the format, %%d:123456:some state%%, I have been unable to get the on state condition to report. Sending a status request for a device is not helpful, as there is nothing reported to the Event Log.
Is there a solution?
aaronlionsheep
Posts: 260
Joined: Sun Feb 24, 2019 7:09 pm
Location: Virginia, USA

Re: Report state of NGMQTT device

Post by aaronlionsheep »

Are you looking for the "on" state of the device, or the status of the MQTT Connector broker device connection?
SMUSEBY
Posts: 524
Joined: Wed Sep 16, 2009 9:38 pm
Location: California

Re: Report state of NGMQTT device

Post by SMUSEBY »

I’m looking for the on State of the device.
aaronlionsheep
Posts: 260
Joined: Sun Feb 24, 2019 7:09 pm
Location: Virginia, USA

Re: Report state of NGMQTT device

Post by aaronlionsheep »

What Shelly model are you working with? A standard on/off device in Indigo will have a state called "onOffState" that is not shown in the device states list. Shelly relay devices all use this state and sensor devices will use "sensorValue".

You can right-click on the device in the devices list and choose "Print Device Details to Event Log". There will be an entry called "states" that includes the list of states for the device and their values.
SMUSEBY
Posts: 524
Joined: Wed Sep 16, 2009 9:38 pm
Location: California

Re: Report state of NGMQTT device

Post by SMUSEBY »

I'm using the Shelly Plus1, - Plus1PM, and Plus2PM devices.
I can find the status of the device in the event log by right-clicking as you suggest, but that requires intervention. I would like to automate that process but don't know how to access that information in a trigger or schedule. I would like to do so to build redundancy into key relay/devices, such as for a refrigerator.
aaronlionsheep
Posts: 260
Joined: Sun Feb 24, 2019 7:09 pm
Location: Virginia, USA

Re: Report state of NGMQTT device

Post by aaronlionsheep »

I guess I don't understand what you are trying to do. That onOff state is available in all the Indigo UI components for creating triggers and schedules.

You can trigger when the onOff state becomes a value or changes, and then act accordingly.
Screenshot 2023-08-19 at 10.33.54 AM.png
Screenshot 2023-08-19 at 10.33.54 AM.png (37.69 KiB) Viewed 1711 times
Or you can make a schedule that periodically runs and is conditional on the onOff state being some value, and then act accordingly.
Screenshot 2023-08-19 at 10.34.59 AM.png
Screenshot 2023-08-19 at 10.34.59 AM.png (47.32 KiB) Viewed 1711 times
SMUSEBY
Posts: 524
Joined: Wed Sep 16, 2009 9:38 pm
Location: California

Re: Report state of NGMQTT device

Post by SMUSEBY »

I am familiar with triggers in time date actions. I was unable to get them to work with the Shelly devices. It’s been awhile so I will try again as I don’t remember the specific issue that caused it to fail. Perhaps when the Shelly broker fails (which is the issue I’m attempting to deal with) it might result in the triggers failing to sense the on/off state..
I’ll experiment with this scenario.
SMUSEBY
Posts: 524
Joined: Wed Sep 16, 2009 9:38 pm
Location: California

Re: Report state of NGMQTT device

Post by SMUSEBY »

The issue I'm trying to resolve is the periodic failure of Shelly MQTT devices to respond to a command. When this occurs, reloading the Broker plug-in and repeating the command resolves the issue.
For example, when an On command fails, the Indigo device status will indicate that it is ON, the Shelly Broker indicates "Connected 0", and right clicking on the device and selecting 'print device details to event log' also shows the incorrect device state.
However the correct status is available in MQTT Explorer. After experimenting, I have not discovered an instance when the MQTT Expoloer indicates an erroneous onState.
Is there a way to get the accurate device status into Indigo?
The solution to the periodic broker failure issue that might work would be to follow an Indigo command with a query as to the on state of the device; if wrong, reload the broker plug-in and repeat the device command.
User avatar
FlyingDiver
Posts: 7287
Joined: Sat Jun 07, 2014 10:36 am
Location: Southwest Florida, USA

Re: Report state of NGMQTT device

Post by FlyingDiver »

You can try a different Broker and see if it's more stable.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
SMUSEBY
Posts: 524
Joined: Wed Sep 16, 2009 9:38 pm
Location: California

Re: Report state of NGMQTT device

Post by SMUSEBY »

Merrill Lynch had no idea how to help.
Suggestions?
Post Reply

Return to “ShellyNGMQTT”