Changing values with query results?

Posted on
Thu Dec 31, 2020 1:16 pm
Ramias offline
Posts: 272
Joined: Nov 24, 2015

Changing values with query results?

I'm trying to show status for ZWave Locks and Alarm Sensors (doors/windows/garage doors) on the same panel.

The issue is:
Locks show onState of True when locked.
Door sensors show onState of False when the door is closed.

I'd like both of these to map to the same green color on the dashboard. Fortunately locks also have a a value of onOffState.ui which I can use instead of onState so I can map the onOffState.ui Locked of the lock to the same color as onState of False on the door sensors.

But I have a few other edge cases where this could be interesting. Does anybody know if there's a way to do this with Grafana transformations or with a case statement in the SQL query? I'm ok running separate queries for the locks vs the door sensors. I'd like to have both queries query against onState, and then transform one so True/Locked is the same as False/Closed for doors. I've read that grafana can support Case Statements in SQL but not with influxDb.

Thanks

Posted on
Tue Jan 05, 2021 8:57 am
vtmikel offline
Posts: 628
Joined: Aug 31, 2012
Location: Boston, MA

Re: Changing values with query results?

I did some brief looking into this, and I haven't found an obvious way. I personally separate the panels. It doesn't look like Grafana's transformations support changing values, only filtering records. Influx queries also do not seem to support it. I'll keep looking but so far nothing.

Posted on
Tue Jan 05, 2021 4:54 pm
Colly offline
Posts: 535
Joined: Jan 16, 2016
Location: Ireland

Re: Changing values with query results?

Ramias wrote:
I'm trying to show status for ZWave Locks and Alarm Sensors (doors/windows/garage doors) on the same panel.

The issue is:
Locks show onState of True when locked.
Door sensors show onState of False when the door is closed.

Would the Device Extensions plugin work for you and then add the converted state to Grafana?

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest