mycontroller-org / server

MyController 2.x server
https://mycontroller.org
Apache License 2.0
29 stars 5 forks source link

MySensors naming scheme #10

Open findnix opened 2 years ago

findnix commented 2 years ago

Hello @jkandasa!

First of all I would like to thank you for your great work. I use v1 since the beginning. Now it's time to move to v2. I welcome this because I have been using influx with telegtaf for a long time. My request now: is it possible in influxdb (1.8) to get a naming scheme that matches the "external server" functionality of v1? I have been using this form for a long time: host=myController,gategatewayName=$gatewayName,nodeName=$nodeName,nodeEui=$nodeEui,sensorName=$sensorName,sensorId=$sensorId,variableType=$variableType,variableTypeId=$variableTypeId

Thank you and greetings from Austria

jkandasa commented 2 years ago

hi @findnix thanks for being a member of MyController since the beginning. The sad news is that, I ​restructured the v2 version completely. There is no exact mapping between these versions ​:(

You have to rewrite your influx query.

sample data from v2.

$ ./influx
Connected to http://localhost:8086 version 1.8.10
InfluxDB shell version: 1.8.5rc0
> use my_db
Using database my_db

> show MEASUREMENTS
name: measurements
name
----
mc_binary_data
mc_gauge_float_data
mc_gauge_int_data

> select * from mc_gauge_float_data limit 3;
name: mc_gauge_float_data
time                fieldid   fieldname gatewayid id                                   nodeid sourceid value
----                -------   --------- --------- --                                   ------ -------- -----
1617465594083318897 V_VOLUME            mysensor  9df7a394-68ee-4053-8fca-4b6b30f24f93 1      1        25.8
1617465604505737014 V_VOLUME            mysensor  9df7a394-68ee-4053-8fca-4b6b30f24f93 1      1        25.8
1617465609945693930 V_VOLTAGE           mysensor  e0ea463f-5b3c-4488-b8b5-9a762e4669af 13     1        235.72

> select * from mc_binary_data limit 3;
name: mc_binary_data
time                fieldid  gatewayid id                                   nodeid         sourceid value
----                -------  --------- --                                   ------         -------- -----
1617466107064094796 POWER    tasmota   6cf0ff66-2cf9-4e1c-b8af-e656e9c33a97 tasmota_D17238 Control  true
1617466121355097265 Fade     tasmota   eced0a2b-63b0-40d6-bea6-f37cd9632e26 tasmota_D17238 Control  true
1617536629723880037 V_STATUS mysensor  7bf5ce37-ae5d-44bc-94fc-176a872c00bc 13             1        true

> select * from mc_gauge_int_data limit 3;
name: mc_gauge_int_data
time                fieldid gatewayid id                                   nodeid sourceid value
----                ------- --------- --                                   ------ -------- -----
1617465593765123775 V_VAR2  mysensor  0fb504e6-2e14-4a0f-8604-060a4abb1972 1      1        128
1617465604182891816 V_VAR2  mysensor  0fb504e6-2e14-4a0f-8604-060a4abb1972 1      1        128
1617465638399227359 V_VAR2  mysensor  0fb504e6-2e14-4a0f-8604-060a4abb1972 1      1        128

In the future we may add additional plugin to publish metrics data to the external database. let me know if you need a help further on this.

findnix commented 2 years ago

Hi @jkandasa ! Thank You for Your fast respond.

I always appreciated Your mapping from the IDs to the long names. Unfortunately this feature is gone. This "forces" me to realize an old idea to write a little wrapper for this. Either catching and rewriting the MQTT topics or simple inject "translated" events into influx. I've to think about now a bit more detailed ;-)

I would be a pleasure to share the code with you on success.

jkandasa commented 2 years ago

@findnix In v2 some changes on the name/id to make it more generic. as a result we have, gatewayid, nodeid, sourceid, fieldid, these are all real values from your sensor network.

I do rethink possibility for this in v2. and update if I get an great idea. meantime you may post one of your existing query, I may get someidea. Thanks!