Feature Request: Additional States?

Posted on
Fri Jan 01, 2021 10:27 am
Ramias offline
Posts: 272
Joined: Nov 24, 2015

Feature Request: Additional States?

Happy New Year!

Working on some Grafana dashboards. I originally posted https://forums.indigodomo.com/viewtopic.php?f=279&t=24797 over there but not sure it can be done with the InfluxDB.

So my question here: Could the MQTT Shim plugin be extended to support additional state values?

I was looking at the MyQ Garage Door plugin and it has these states:

Code: Select all
states : States : (dict)
     doorStatus : closed (string)
     doorStatus.closed : true (bool)
     doorStatus.closing : false (bool)
     doorStatus.open : false (bool)
     doorStatus.opening : false (bool)
     doorStatus.stopped : false (bool)
     doorStatus.transition : false (bool)
     doorStatus.unknown : false (bool)
     onOffState : on (on/off bool)
     onOffState.ui : locked (string)


the doorStatus.open and doorStatus.closed will always be opposite each other. If the MQTT Shim plugin supported something similar this would really add some flexibility with Grafana queries. Something like sensorStatus.open and sensorStatus.closed. That way instead of querying for onState=False (when my sensor is not in an open state) I could query for sensorStatus.closed=true which when I also query for doorStatus.closed = true for the Garage door I can map the true value to the color I want in Grafana.

Not critical or urgent, just an idea to put on the board.

Thanks

Posted on
Fri Jan 01, 2021 10:32 am
FlyingDiver offline
User avatar
Posts: 7213
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Feature Request: Additional States?

The Shims plugin coverts anything in the multi-keys part of the payload (which could be the entire payload) to states. They can be text, numbers, or booleans. The MyQ states are a weird construct based on the List value type. I can't do the List type in a Shim because it relies on knowing both the current value and the list of possible values. So no, that one is not possible in a Shim.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Fri Jan 01, 2021 10:35 am
FlyingDiver offline
User avatar
Posts: 7213
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Feature Request: Additional States?

Now to solve your actual issue. I'm not sure I understand what you're really looking for. You're using custom code on an rPi to generate the MQTT messages feeding the Shim, right? So why can't you put the exact info you need in the MQTT message? If that's not what's happening, what's the source of the MQTT messages and what do they look like?

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Fri Jan 01, 2021 10:38 am
Ramias offline
Posts: 272
Joined: Nov 24, 2015

Re: Feature Request: Additional States?

Thanks for the quick reply.

My MQTT On/Off Sensor Device shows an onState of False.

I'd just be looking for something like:

sensorOnState.false = true
sensorOnState.true = false

Posted on
Fri Jan 01, 2021 10:42 am
FlyingDiver offline
User avatar
Posts: 7213
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Feature Request: Additional States?

That's your code on an rPi, right? Why not change it to send a JSON payload instead of raw and you'll have the state values you want.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Fri Jan 01, 2021 10:48 am
Ramias offline
Posts: 272
Joined: Nov 24, 2015

Re: Feature Request: Additional States?

It's not my code. I'm using this: https://github.com/tsightler/ring-mqtt in a docker container.

Posted on
Fri Jan 01, 2021 10:54 am
FlyingDiver offline
User avatar
Posts: 7213
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Feature Request: Additional States?

This is the set of messages you're getting? And you're triggering on switch/state for the Shim?
Code: Select all
ring/<location_id>/alarm/<device_id>/switch/state    <-- Get ON/OFF state
ring/<location_id>/alarm/<device_id>/switch/command  <-- Set ON/OF state
ring/<location_id>/alarm/<device_id>/info/state      <-- Device info sensor


What does the info/state message look like?

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Fri Jan 01, 2021 11:00 am
Ramias offline
Posts: 272
Joined: Nov 24, 2015

Re: Feature Request: Additional States?

This is the Info State:
Code: Select all
{"batteryLevel":100,"batteryStatus":"full","commStatus":"ok","lastUpdate":"2021-01-01T16:58:34.680Z","tamperStatus":"ok"}

Posted on
Fri Jan 01, 2021 11:14 am
FlyingDiver offline
User avatar
Posts: 7213
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Feature Request: Additional States?

Bummer, they don't put the contact/sensor data in the info message.

So to summarize, the problem you have is that the sensorValue of the Shim device is the logical opposite of the value you want to feed to Grafana. Correct?

There's several ways to fix this with no new code needed in the Shim. Easiest is to just lie to the Shim. Set the "On value" of the shim to "OFF". Or create another Shim identical to the first with the 'OFF' string for "On value". Or use the Masquerade plugin to create the logical opposite device.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest