Skip to content

Instantly share code, notes, and snippets.

@dustin
Last active June 26, 2020 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dustin/3015d0dee2b5cee3ce8b2d1895aee144 to your computer and use it in GitHub Desktop.
Save dustin/3015d0dee2b5cee3ce8b2d1895aee144 to your computer and use it in GitHub Desktop.
from mqtt://eve/#influxerprod {
match "tesla/x/data" jsonp {
measurement "tesla"
"battery_heater" <- "/charge_state/battery_heater_on"
"battery_level" <- "/charge_state/battery_level" int
"charge_current" <- "/charge_state/charger_actual_current"
"charge_estimate" <- "/charge_state/time_to_full_charge"
"charge_power" <- "/charge_state/charger_power"
"charge_rate" <- "/charge_state/charge_rate"
"charge_voltage" <- "/charge_state/charger_voltage"
"energy_added" <- "/charge_state/charge_energy_added"
"ext_temp" <- "/climate_state/outside_temp"
"heading" <- "/drive_state/heading"
"int_temp" <- "/climate_state/inside_temp"
"lat" <- "/drive_state/latitude"
"lon" <- "/drive_state/longitude"
"odo" <- "/vehicle_state/odometer"
"power" <- "/drive_state/power"
"speed" <- "/drive_state/speed"
"user_present" <- "/vehicle_state/is_user_present"
}
match "sj/influxer/spool" int [site=$1] measurement="influx_spool"
match "sj/+/temp" float [site=$1, sensor=$2] field=$3 measurement="env"
match "sj/+/humidity" float [site=$1, sensor=$2] field=$3 measurement="env"
match "sj/attic/28-04166340a8ff" float [site=$1, sensor=$2] field="temp" measurement="env"
// These are early ones I built before I learned how to make patterns and stuff.
match "sj/basement/plant-humidity" float [site=$1, sensor=$2] field="humidity" measurement="env"
match "sj/basement/plant-temp" float [site=$1, sensor=$2] field="temp" measurement="env"
match "sj/basement/plant-soil" float [site=$1, sensor=$2] field="soil" measurement="env"
match "sj/basement/plant-light" float [site=$1, sensor=$2] field="light" measurement="env"
match "sj/basement/plant-light.ctrl" int [site=$1, thing="plant-light"] measurement="control"
match "+/+/stat/+/POWER" bool [site=$1, sensor=$2] field=$3 measurement="tasmota"
// These match below, but I want to force a specific parser.
match "+/sprinkler/+/ctrl" bool [site=$1, zone=$3] field="on" measurement="sprinkler"
match "+/sprinkler/enabled" int [site=$1, thing="sprinkler-master"] measurement="control"
// Matches that hit the # below, but I want to ignore
match "sj/sprinkler/+/end" ignore
match "sj/sprinkler/+/start" ignore
match "+/+/tele/+" ignore
match "+/+/stat/+" ignore
match "+/+/cmnd/+" ignore
match "sj/basement/plant-light.start" ignore
match "sj/basement/plant-light.end" ignore
// Things we want to watch and how to process them if they weren't overridden.
watch "sj/#" auto
watch "tesla/#" ignore // tesla data is plucked out of JSON
// watch "owntracks/#" ignore
}
from mqtt://localhost/ {
match "oro/+/tele/SENSOR" jsonp {
measurement "powr2" [site=$1, sensor=$2]
"total" <- "/ENERGY/Total"
"yesterday" <- "/ENERGY/Yesterday"
"today" <- "/ENERGY/Today"
"power" <- "/ENERGY/Power"
"voltage" <- "/ENERGY/Voltage"
"current" <- "/ENERGY/Current"
}
// These match below, but I want to force a specific parser.
match "+/+/stat/+/POWER" bool [site=$1, sensor=$2] field=$3 measurement="tasmota"
// match "+/sprinkler/+/ctrl" bool
// match "+/sprinkler/enabled" bool
match "oro/fence/reading" float [sensor=$2] field=$3 measurement="loragate"
match "oro/gate/reading" float [sensor=$2] field=$3 measurement="loragate"
match "oro/gate/temp" float [sensor=$2] field=$3 measurement="loragate"
match "oro/gate/humidity" float [sensor=$2] field=$3 measurement="loragate"
match "oro/fence/+" int [sensor=$2] field=$3 measurement="loragate"
match "oro/gate/+" int [sensor=$2] field=$3 measurement="loragate"
match "oro/oropi/battery/volts" float [sensor=$2] field="ups" measurement="oropi"
match "oro/+/temp" float [site="oro", sensor=$2] field=$3 measurement="env"
match "oro/+/humidity" float [site="oro", sensor=$2] field=$3 measurement="env"
// Cool zigbee stuff
match "oro/zigbee2mqtt/+/temperature" float [site=$1, sensor=$3] field=$4 measurement="env"
match "oro/zigbee2mqtt/+/humidity" float [site=$1, sensor=$3] field=$4 measurement="env"
match "oro/zigbee2mqtt/+/battery" float [site=$1, sensor=$3] field="level" measurement="battery"
match "oro/zigbee2mqtt/+/voltage" float [site=$1, sensor=$3] field=$4 measurement="battery"
// Matches that hit the # below, but I want to ignore
match "+/+/tele/+" ignore
match "+/+/stat/+" ignore
match "+/+/cmnd/+" ignore
match "oro/influxer/spool" int [site=$1] measurement="influx_spool"
match "oro/lorabase/uptime" int field="uptime" measurement="lorabase"
match "oro/lorabase/notunderstood" int field="notunderstood" measurement="lorabase"
match "oro/lorabase/+/+" int [sensor=$4] field=$3 measurement="lorabase"
watch "shellies/oro/+/temperature" float [site=$2, sensor=$3] field=$4 measurement="shelly"
watch "shellies/oro/+/relay/+/power" float [site=$2, sensor=$3, relay=$5] field=$6 measurement="shelly"
watch "shellies/oro/+/relay/+/energy" float [site=$2, sensor=$3, relay=$5] field=$6 measurement="shelly"
watch qos0 "$SYS/broker/clients/+" int [site="oro"] field=$4 measurement="mqttclients"
watch qos0 "$SYS/broker/messages/+" int [site="oro"] field=$4 measurement="mqttmsg"
watch qos0 "$SYS/broker/publish/+/+" int [site="oro", unit=$4] field=$5 measurement="mqttpub"
watch qos0 "$SYS/broker/store/#" int [site="oro", unit=$4] measurement="mqttstore"
watch qos0 "$SYS/broker/bytes/+" int [site="oro"] field=$4 measurement="mqtttraffic"
watch qos0 "$SYS/broker/subscriptions/count" int [site="oro"] measurement="mqttsubs"
watch qos0 "$SYS/broker/runtime/+" int [site="oro"] field=$4 measurement="mqttd"
// Things we want to watch and how to process them if they weren't overridden.
watch "oro/#" ignore
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment