fasmide / deflux

deconz sensors to influxdb
MIT License
21 stars 10 forks source link

Sensor names instead of "deflux_ZHATemperature" for Grafana ? #7

Open hbkoenig opened 4 years ago

hbkoenig commented 4 years ago

Hi, just yesterday I discovered your project, looks great and I need it;-)

I'm running a deconz network (since 1 week;) with 30+ IKEA routers and 40+ Aquara sensors, more to come. it's mostly for only collecting data and monitoring (only exception right now: 2 OSRAM power plugs which manually can be switched off/on via web page to reset PCs, no rules/schedules). some details and grafana output you can see in the last slides from a talk last weekend: https://programm.froscon.de/2020/events/2620.html https://programm.froscon.de/2020/system/event_attachments/attachments/000/000/609/original/froscon-2020-zigbee.pdf

questions: why are your measurement names deflux_ZHATemperature etc.? how can I change this? right now with my own rest-to-influxdb hack (based on bash/curl/jq/awk/influx) I use sensor names (ZT-xy for temperature, ZR-xy for router, ZS-xy for door/window switches etc.) and these names I can directly select/plot/... in grafana. right now I do not know how to select a single temp sensor in grafana, your choice looks at least impractical for me?!

example -- your db entries:

> select * from deflux_ZHATemperature
name: deflux_ZHATemperature
time            id      name    temperature     type
----            --      ----    -----------     ----
1598427500000   100     ZT-34   22.63           ZHATemperature
1598427505000   49      ZT-16   24.08           ZHATemperature
1598427519000   40      ZT-13   23.01           ZHATemperature

> select * from deflux_ZHAHumidity
name: deflux_ZHAHumidity
time            humidity        id      name    type
----            --------        --      ----    ----
1598427500000   50.12           101     ZT-34   ZHAHumidity
1598427505000   47.17           50      ZT-16   ZHAHumidity
1598427519000   50.56           41      ZT-13   ZHAHumidity

> select * from deflux_ZHAPressure
name: deflux_ZHAPressure
time            id      name    pressure        type
----            --      ----    --------        ----
1598427500000   102     ZT-34   972             ZHAPressure
1598427505000   51      ZT-16   969             ZHAPressure
1598427519000   42      ZT-13   968             ZHAPressure

my current db:

> select * from "ZT-34" where "time" > now() - 2h
name: ZT-34
time            battery humidity        on      pressure        reachable       temperature
----            ------- --------        --      --------        ---------       -----------
1598427499934   100                     1                       1               22.63
1598427500023   100     50.12           1                       1
1598427500030   100                     1       972             1

which could be aggregated/combined to ==>
1598427500030   100     50.12           1       972             1               22.63

> select * from "ZT-16" where "time" > now() - 2h
name: ZT-16
time            battery humidity        on      pressure        reachable       temperature
----            ------- --------        --      --------        ---------       -----------
1598427505205   100                     1                       1               24.08
1598427505309   100     47.17           1                       1
1598427505315   100                     1       969             1

==>
1598427505315   100     47.17           1       969             1               24.08

is this configurable so that I get separate measurements in influxdb for every sensor ?

right now you use seconds precision, I'd like to keep the milliseconds from deconz at least for now (precision ms).

and I'd like to get all nodes infos into influxdb, not only sensors.
I want to see/monitor/verify reachability of routers etc, monitor status of those power plugs or lights (on/off) etc. having an option what to log and what not might be helpful for others, too?

comments/hints/... ?

thanks for any input!!

Harald