Mercurial > code > home > repos > homeauto
changeset 798:cdc76c84e3e2
move conf into subdir
author | drewp@bigasterisk.com |
---|---|
date | Tue, 29 Dec 2020 21:05:32 -0800 |
parents | a3e430b39177 |
children | e0e623c01a69 |
files | service/mqtt_to_rdf/Dockerfile service/mqtt_to_rdf/conf/air_quality_indoor.n3 service/mqtt_to_rdf/conf/air_quality_outdoor.n3 service/mqtt_to_rdf/conf/bed.n3 service/mqtt_to_rdf/conf/bed_bar.n3 service/mqtt_to_rdf/conf/cardreader.n3 service/mqtt_to_rdf/conf/frontdoorlock.n3 service/mqtt_to_rdf/conf/kitchen.n3 service/mqtt_to_rdf/conf/living_lamps.n3 service/mqtt_to_rdf/conf/nightlight_ari.n3 service/mqtt_to_rdf/conf/rf.n3 service/mqtt_to_rdf/config_air_quality_indoor.n3 service/mqtt_to_rdf/config_air_quality_outdoor.n3 service/mqtt_to_rdf/config_bed.n3 service/mqtt_to_rdf/config_bed_bar.n3 service/mqtt_to_rdf/config_cardreader.n3 service/mqtt_to_rdf/config_frontdoorlock.n3 service/mqtt_to_rdf/config_kitchen.n3 service/mqtt_to_rdf/config_living_lamps.n3 service/mqtt_to_rdf/config_nightlight_ari.n3 service/mqtt_to_rdf/config_rf.n3 service/mqtt_to_rdf/mqtt_to_rdf.py service/mqtt_to_rdf/serv.n3 |
diffstat | 23 files changed, 460 insertions(+), 474 deletions(-) [+] |
line wrap: on
line diff
--- a/service/mqtt_to_rdf/Dockerfile Tue Dec 29 20:55:24 2020 -0800 +++ b/service/mqtt_to_rdf/Dockerfile Tue Dec 29 21:05:32 2020 -0800 @@ -9,7 +9,8 @@ RUN pip3 install -U 'https://github.com/drewp/cyclone/archive/python3.zip?v3' RUN pip3 install -U attrs -COPY *.py *.html *.css *.js *.n3 ./ +COPY *.py *.html *.css *.js ./ +COPY conf/ ./conf COPY build/bundle.js build/ EXPOSE 10018:10018
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/service/mqtt_to_rdf/conf/air_quality_indoor.n3 Tue Dec 29 21:05:32 2020 -0800 @@ -0,0 +1,123 @@ +@prefix : <http://projects.bigasterisk.com/room/> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix fr: <http://bigasterisk.com/foaf/> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . +#air_quality_indoor/sensor/bme280_temperature/state 23.7 +#air_quality_indoor/sensor/bme280_pressure/state 1006.5 +#air_quality_indoor/sensor/bme280_humidity/state 40.5 + + +:airQualityIndoorTemperature a :MqttStatementSource; + :mqttTopic ("air_quality_indoor" "sensor" "bme280_temperature" "state"); + + :parser xsd:double; + :conversions (:celsiusToFarenheit + [:ignoreValueBelow -999]); + :graphStatements [ + :outputPredicate :temperatureF; + :statementLifetime "150s"; + # ], [ + # :conversions ([:recentLow "30s"]); + # :outputPredicate :recentLowTemperatureF; + ]; + + :influxMeasurement [ # replaces this block in piNode configs + :measurement "temperatureF"; :pointsAtLeastEvery 30; + :predicate :temperatureF; + :tag [:key "host"; :value "air_quality_indoor"], + [:key "location"; :value "frontRoomShelf"]] . + +:airQualityIndoorPressure a :MqttStatementSource; + :mqttTopic ("air_quality_indoor" "sensor" "bme280_pressure" "state"); + :parser xsd:double; + :graphStatements [ + :outputPredicate :pressure_hPa; + :statementLifetime "150s"; + ]; + :influxMeasurement [ + :measurement "pressure_hPa"; :pointsAtLeastEvery 30; + :predicate :pressure_hPa; + :tag [:key "host"; :value "air_quality_indoor"], + [:key "location"; :value "frontRoomShelf"]] . + + +:airQualityIndoorHumidity a :MqttStatementSource; + :mqttTopic ("air_quality_indoor" "sensor" "bme280_humidity" "state"); + :parser xsd:double; + :graphStatements [ + :outputPredicate :humidity; + :statementLifetime "150s"; + ]; + :influxMeasurement [ + :measurement "humidity"; :pointsAtLeastEvery 30; + :predicate :humidity; + :tag [:key "host"; :value "air_quality_indoor"], + [:key "location"; :value "frontRoomShelf"]] . + + +:airQualityIndoorCo a :MqttStatementSource; + :mqttTopic ("air_quality_indoor" "sensor" "ccs811_eco2_value" "state"); + :parser xsd:double; + :graphStatements [ + :outputPredicate :eco2; + :statementLifetime "150s"; + ]; + :influxMeasurement [ + :measurement "eco2";:pointsAtLeastEvery 60; + :predicate :eco2; + :tag [:key "host"; :value "air_quality_indoor"], + [:key "location"; :value "frontRoomShelf"]] . + +:airQualityIndoorTvoc a :MqttStatementSource; + :mqttTopic ("air_quality_indoor" "sensor" "ccs811_total_volatile_organic_compound" "state"); + :parser xsd:double; + :graphStatements [ + :outputPredicate :tvoc; + :statementLifetime "150s"; + ]; + :influxMeasurement [ + :measurement "tvoc"; :pointsAtLeastEvery 60; + :predicate :tvoc; + :tag [:key "host"; :value "air_quality_indoor"], + [:key "location"; :value "frontRoomShelf"]] . + + +:airQualityIndoorPm10 a :MqttStatementSource; + :mqttTopic ("air_quality_indoor" "sensor" "particulate_matter_10m_concentration" "state"); + :parser xsd:double; + :graphStatements [ + :outputPredicate :pm10; + :statementLifetime "150s"; + ]; + :influxMeasurement [ + :measurement "pm10"; :pointsAtLeastEvery 5; + :predicate :pm10; + :tag [:key "host"; :value "air_quality_indoor"], + [:key "location"; :value "frontRoomShelf"]] . + +:airQualityIndoorPm25 a :MqttStatementSource; + :mqttTopic ("air_quality_indoor" "sensor" "particulate_matter_25m_concentration" "state"); + :parser xsd:double; + :graphStatements [ + :outputPredicate :pm25; + :statementLifetime "150s"; + ]; + :influxMeasurement [ + :measurement "pm25"; :pointsAtLeastEvery 5; + :predicate :pm25; + :tag [:key "host"; :value "air_quality_indoor"], + [:key "location"; :value "frontRoomShelf"]] . + +:airQualityIndoorPm100 a :MqttStatementSource; + :mqttTopic ("air_quality_indoor" "sensor" "particulate_matter_100m_concentration" "state"); + :parser xsd:double; + :graphStatements [ + :outputPredicate :pm100; + :statementLifetime "150s"; + ]; + :influxMeasurement [ + :measurement "pm100"; :pointsAtLeastEvery 5; + :predicate :pm100; + :tag [:key "host"; :value "air_quality_indoor"], + [:key "location"; :value "frontRoomShelf"]] . +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/service/mqtt_to_rdf/conf/air_quality_outdoor.n3 Tue Dec 29 21:05:32 2020 -0800 @@ -0,0 +1,115 @@ +@prefix : <http://projects.bigasterisk.com/room/> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix fr: <http://bigasterisk.com/foaf/> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +:airQualityOutdoorTemperature a :MqttStatementSource; + :mqttTopic ("air_quality_outdoor" "sensor" "bme280_temperature" "state"); + :parser xsd:double; + :conversions (:celsiusToFarenheit + [:ignoreValueBelow -999]); + :graphStatements [ + :outputPredicate :temperatureF; + :statementLifetime "150s"; + ]; + + :influxMeasurement [ # replaces this block in piNode configs + :measurement "temperatureF"; :pointsAtLeastEvery 30; + :predicate :temperatureF; + :tag [:key "host"; :value "air_quality_outdoor"], + [:key "location"; :value "workbench"]] . + +:airQualityOutdoorPressure a :MqttStatementSource; + :mqttTopic ("air_quality_outdoor" "sensor" "bme280_pressure" "state"); + :parser xsd:double; + :graphStatements [ + :outputPredicate :pressure_hPa; + :statementLifetime "150s"; + ]; + :influxMeasurement [ + :measurement "pressure_hPa"; :pointsAtLeastEvery 30; + :predicate :pressure_hPa; + :tag [:key "host"; :value "air_quality_outdoor"], + [:key "location"; :value "workbench"]] . + + +:airQualityOutdoorHumidity a :MqttStatementSource; + :mqttTopic ("air_quality_outdoor" "sensor" "bme280_humidity" "state"); + :parser xsd:double; + :graphStatements [ + :outputPredicate :humidity; + :statementLifetime "150s"; + ]; + :influxMeasurement [ + :measurement "humidity"; :pointsAtLeastEvery 30; + :predicate :humidity; + :tag [:key "host"; :value "air_quality_outdoor"], + [:key "location"; :value "workbench"]] . + + +:airQualityOutdoorCo a :MqttStatementSource; + :mqttTopic ("air_quality_outdoor" "sensor" "ccs811_eco2_value" "state"); + :parser xsd:double; + :graphStatements [ + :outputPredicate :eco2; + :statementLifetime "150s"; + ]; + :influxMeasurement [ + :measurement "eco2";:pointsAtLeastEvery 60; + :predicate :eco2; + :tag [:key "host"; :value "air_quality_outdoor"], + [:key "location"; :value "workbench"]] . + +:airQualityOutdoorTvoc a :MqttStatementSource; + :mqttTopic ("air_quality_outdoor" "sensor" "ccs811_total_volatile_organic_compound" "state"); + :parser xsd:double; + :graphStatements [ + :outputPredicate :tvoc; + :statementLifetime "150s"; + ]; + :influxMeasurement [ + :measurement "tvoc"; :pointsAtLeastEvery 60; + :predicate :tvoc; + :tag [:key "host"; :value "air_quality_outdoor"], + [:key "location"; :value "workbench"]] . + + +:airQualityOutdoorPm10 a :MqttStatementSource; + :mqttTopic ("air_quality_outdoor" "sensor" "particulate_matter_10m_concentration" "state"); + :parser xsd:double; + :graphStatements [ + :outputPredicate :pm10; + :statementLifetime "150s"; + ]; + :influxMeasurement [ + :measurement "pm10"; :pointsAtLeastEvery 5; + :predicate :pm10; + :tag [:key "host"; :value "air_quality_outdoor"], + [:key "location"; :value "workbench"]] . + +:airQualityOutdoorPm25 a :MqttStatementSource; + :mqttTopic ("air_quality_outdoor" "sensor" "particulate_matter_25m_concentration" "state"); + :parser xsd:double; + :graphStatements [ + :outputPredicate :pm25; + :statementLifetime "150s"; + ]; + :influxMeasurement [ + :measurement "pm25"; :pointsAtLeastEvery 5; + :predicate :pm25; + :tag [:key "host"; :value "air_quality_outdoor"], + [:key "location"; :value "workbench"]] . + +:airQualityOutdoorPm100 a :MqttStatementSource; + :mqttTopic ("air_quality_outdoor" "sensor" "particulate_matter_100m_concentration" "state"); + :parser xsd:double; + :graphStatements [ + :outputPredicate :pm100; + :statementLifetime "150s"; + ]; + :influxMeasurement [ + :measurement "pm100"; :pointsAtLeastEvery 5; + :predicate :pm100; + :tag [:key "host"; :value "air_quality_outdoor"], + [:key "location"; :value "workbench"]] . +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/service/mqtt_to_rdf/conf/bed.n3 Tue Dec 29 21:05:32 2020 -0800 @@ -0,0 +1,29 @@ +@prefix : <http://projects.bigasterisk.com/room/> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix fr: <http://bigasterisk.com/foaf/> . + +:buttonMap a :ValueMap; + :map [:from "OFF"; :to :notPressed], [:from "ON"; :to :pressed] + . + +:bedGreenButton a :MqttStatementSource; + :mqttTopic ("bed" "switch" "green_button" "state"); + :parser :buttonMap; + :graphStatements [:outputPredicate :state;] . + +:bedRedButton a :MqttStatementSource; + :mqttTopic ("bed" "switch" "red_button" "state"); + :parser :buttonMap; + :graphStatements [:outputPredicate :state;] . + + +:motionMap a :ValueMap; + :map [:from "OFF"; :to :noMotion], [:from "ON"; :to :motion] + . + + + +:bedHeadboardMotion a :MqttStatementSource; + :mqttTopic ("bed" "switch" "pir" "state"); + :parser :motionMap; + :graphStatements [:outputPredicate :state;] .
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/service/mqtt_to_rdf/conf/bed_bar.n3 Tue Dec 29 21:05:32 2020 -0800 @@ -0,0 +1,27 @@ +@prefix : <http://projects.bigasterisk.com/room/> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix fr: <http://bigasterisk.com/foaf/> . + +:buttonMap a :ValueMap; + :map [:from "OFF"; :to :notPressed], [:from "ON"; :to :pressed] + . + +:bedBarAsherButton1 a :MqttStatementSource; + :mqttTopic ("bed_bar_asher" "binary_sensor" "button_1" "state"); + :parser :buttonMap; + :graphStatements [:outputPredicate :state;] . + +:bedBarAsherButton2 a :MqttStatementSource; + :mqttTopic ("bed_bar_asher" "binary_sensor" "button_2" "state"); + :parser :buttonMap; + :graphStatements [:outputPredicate :state;] . + +:bedBarAsherButton3 a :MqttStatementSource; + :mqttTopic ("bed_bar_asher" "binary_sensor" "button_3" "state"); + :parser :buttonMap; + :graphStatements [:outputPredicate :state;] . + +:bedBarAsherButton4 a :MqttStatementSource; + :mqttTopic ("bed_bar_asher" "binary_sensor" "button_4" "state"); + :parser :buttonMap; + :graphStatements [:outputPredicate :state;] . \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/service/mqtt_to_rdf/conf/cardreader.n3 Tue Dec 29 21:05:32 2020 -0800 @@ -0,0 +1,14 @@ +@prefix : <http://projects.bigasterisk.com/room/> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix fr: <http://bigasterisk.com/foaf/> . + +:cardReader a :MqttStatementSource; + :mqttTopic ("frontwindow" "tag"); + :parser :tagIdToUri; # AA-BB-CC-DD to <http://bigasterisk.com/rfidCard/aabbccdd> + + :graphStatements [ + :outputPredicate :currentRead; + :statementLifetime "5s"; + ] + . + \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/service/mqtt_to_rdf/conf/frontdoorlock.n3 Tue Dec 29 21:05:32 2020 -0800 @@ -0,0 +1,20 @@ +@prefix : <http://projects.bigasterisk.com/room/> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix fr: <http://bigasterisk.com/foaf/> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +:mqttConnectedStatusMap a :ValueMap; + :map [:from "offline"; :to :Offline], + [:from "online"; :to :Online] . + +:frontDoorLockStatus a :MqttStatementSource; + :mqttTopic ("frontdoorlock" "status"); + + :parser :mqttConnectedStatusMap; + + :graphStatements [ + :outputPredicate :connectedStatus + ] + + . +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/service/mqtt_to_rdf/conf/kitchen.n3 Tue Dec 29 21:05:32 2020 -0800 @@ -0,0 +1,24 @@ +@prefix : <http://projects.bigasterisk.com/room/> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix fr: <http://bigasterisk.com/foaf/> . + +:buttonMap a :ValueMap; + :map [:from "OFF"; :to :notPressed], [:from "ON"; :to :pressed] + . + + + +# goal is to read these and have reasoning notice them as the light state so the button works +#sonoff_0/switch/sonoff_basic_relay/state OFF + + +:kitchenCounterLight a :MqttStatementSource; + :mqttTopic ("h801_counter" "light" "kit_r" "state"); + :parser :jsonBrightness; + :graphStatements [:outputPredicate :brightness;] . + +:kitchenLight a :MqttStatementSource; + :mqttTopic ("h801_skylight" "light" "kit_r" "state"); + :parser :jsonBrightness; + :graphStatements [:outputPredicate :brightness;] . + \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/service/mqtt_to_rdf/conf/living_lamps.n3 Tue Dec 29 21:05:32 2020 -0800 @@ -0,0 +1,44 @@ +@prefix : <http://projects.bigasterisk.com/room/> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix fr: <http://bigasterisk.com/foaf/> . + +:buttonMap a :ValueMap; + :map [:from "OFF"; :to :notPressed], [:from "ON"; :to :pressed] + . + + + +# goal is to read these and have reasoning notice them as the light state so the button works +#sonoff_0/switch/sonoff_basic_relay/state OFF + + +:livingLampShelf a :MqttStatementSource; + :mqttTopic ("sonoff_0" "switch" "sonoff_basic_relay" "state"); + :parser :onOffBrightness; + :graphStatements [:outputPredicate :brightness;] . + +:livingLamp1 a :MqttStatementSource; + :mqttTopic ("sonoff_1" "switch" "sonoff_basic_relay" "state"); + :parser :onOffBrightness; + :graphStatements [:outputPredicate :brightness;] . + +:livingLamp2 a :MqttStatementSource; + :mqttTopic ("sonoff_2" "switch" "sonoff_basic_relay" "state"); + :parser :onOffBrightness; + :graphStatements [:outputPredicate :brightness;] . + +:livingLamp3 a :MqttStatementSource; + :mqttTopic ("sonoff_3" "switch" "sonoff_basic_relay" "state"); + :parser :onOffBrightness; + :graphStatements [:outputPredicate :brightness;] . + +:livingLamp4 a :MqttStatementSource; + :mqttTopic ("sonoff_4" "switch" "sonoff_basic_relay" "state"); + :parser :onOffBrightness; + :graphStatements [:outputPredicate :brightness;] . + +:livingLamp5 a :MqttStatementSource; + :mqttTopic ("sonoff_5" "switch" "sonoff_basic_relay" "state"); + :parser :onOffBrightness; + :graphStatements [:outputPredicate :brightness;] . + \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/service/mqtt_to_rdf/conf/nightlight_ari.n3 Tue Dec 29 21:05:32 2020 -0800 @@ -0,0 +1,26 @@ +@prefix : <http://projects.bigasterisk.com/room/> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix fr: <http://bigasterisk.com/foaf/> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + + +:nightlightAriTemperature a :MqttStatementSource; + :mqttTopic ("nightlight_ari" "sensor" "temperature" "state"); + + :parser xsd:double; + :conversions (:celsiusToFarenheit + [:ignoreValueBelow -999]); + :graphStatements [ + :outputPredicate :temperatureF; + :statementLifetime "150s"; + # ], [ + # :conversions ([:recentLow "30s"]); + # :outputPredicate :recentLowTemperatureF; + ]; + + :influxMeasurement [ # replaces this block in piNode configs + :measurement "temperatureF"; + :predicate :temperatureF; + :tag [:key "host"; :value "nightlight_ari"], + [:key "location"; :value "ariRoom"]] . +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/service/mqtt_to_rdf/conf/rf.n3 Tue Dec 29 21:05:32 2020 -0800 @@ -0,0 +1,35 @@ +@prefix : <http://projects.bigasterisk.com/room/> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix fr: <http://bigasterisk.com/foaf/> . + +# to discover new codes: +# mosquitto_sub -v -t rfsetup/rf_received + +:wallButton1 a :MqttStatementSource; + :mqttTopic ("rfsetup" "rf_received"); + :filterPayloadJsonEquals "{\"protocol\":1,\"code0\":0,\"code1\":7906}"; + :parser :rfCode; + :conversions (:buttonPress); + :graphStatements [:outputPredicate :state] . + +:wallButton2 a :MqttStatementSource; + :mqttTopic ("rfsetup" "rf_received"); + :filterPayloadJsonEquals "{\"protocol\":1,\"code0\":0,\"code1\":7905}"; + :parser :rfCode; + :conversions (:buttonPress); + :graphStatements [:outputPredicate :state] . + +:wallButton3 a :MqttStatementSource; + :mqttTopic ("rfsetup" "rf_received"); + :filterPayloadJsonEquals "{\"protocol\":1,\"code0\":0,\"code1\":7908}"; + :parser :rfCode; + :conversions (:buttonPress); + :graphStatements [:outputPredicate :state] . + +:wallButton4 a :MqttStatementSource; + :mqttTopic ("rfsetup" "rf_received"); + :filterPayloadJsonEquals "{\"protocol\":1,\"code0\":0,\"code1\":53825}"; + :parser :rfCode; + :conversions (:buttonPress); + :graphStatements [:outputPredicate :state] . +
--- a/service/mqtt_to_rdf/config_air_quality_indoor.n3 Tue Dec 29 20:55:24 2020 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,123 +0,0 @@ -@prefix : <http://projects.bigasterisk.com/room/> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . -@prefix fr: <http://bigasterisk.com/foaf/> . -@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . -#air_quality_indoor/sensor/bme280_temperature/state 23.7 -#air_quality_indoor/sensor/bme280_pressure/state 1006.5 -#air_quality_indoor/sensor/bme280_humidity/state 40.5 - - -:airQualityIndoorTemperature a :MqttStatementSource; - :mqttTopic ("air_quality_indoor" "sensor" "bme280_temperature" "state"); - - :parser xsd:double; - :conversions (:celsiusToFarenheit - [:ignoreValueBelow -999]); - :graphStatements [ - :outputPredicate :temperatureF; - :statementLifetime "150s"; - # ], [ - # :conversions ([:recentLow "30s"]); - # :outputPredicate :recentLowTemperatureF; - ]; - - :influxMeasurement [ # replaces this block in piNode configs - :measurement "temperatureF"; :pointsAtLeastEvery 30; - :predicate :temperatureF; - :tag [:key "host"; :value "air_quality_indoor"], - [:key "location"; :value "frontRoomShelf"]] . - -:airQualityIndoorPressure a :MqttStatementSource; - :mqttTopic ("air_quality_indoor" "sensor" "bme280_pressure" "state"); - :parser xsd:double; - :graphStatements [ - :outputPredicate :pressure_hPa; - :statementLifetime "150s"; - ]; - :influxMeasurement [ - :measurement "pressure_hPa"; :pointsAtLeastEvery 30; - :predicate :pressure_hPa; - :tag [:key "host"; :value "air_quality_indoor"], - [:key "location"; :value "frontRoomShelf"]] . - - -:airQualityIndoorHumidity a :MqttStatementSource; - :mqttTopic ("air_quality_indoor" "sensor" "bme280_humidity" "state"); - :parser xsd:double; - :graphStatements [ - :outputPredicate :humidity; - :statementLifetime "150s"; - ]; - :influxMeasurement [ - :measurement "humidity"; :pointsAtLeastEvery 30; - :predicate :humidity; - :tag [:key "host"; :value "air_quality_indoor"], - [:key "location"; :value "frontRoomShelf"]] . - - -:airQualityIndoorCo a :MqttStatementSource; - :mqttTopic ("air_quality_indoor" "sensor" "ccs811_eco2_value" "state"); - :parser xsd:double; - :graphStatements [ - :outputPredicate :eco2; - :statementLifetime "150s"; - ]; - :influxMeasurement [ - :measurement "eco2";:pointsAtLeastEvery 60; - :predicate :eco2; - :tag [:key "host"; :value "air_quality_indoor"], - [:key "location"; :value "frontRoomShelf"]] . - -:airQualityIndoorTvoc a :MqttStatementSource; - :mqttTopic ("air_quality_indoor" "sensor" "ccs811_total_volatile_organic_compound" "state"); - :parser xsd:double; - :graphStatements [ - :outputPredicate :tvoc; - :statementLifetime "150s"; - ]; - :influxMeasurement [ - :measurement "tvoc"; :pointsAtLeastEvery 60; - :predicate :tvoc; - :tag [:key "host"; :value "air_quality_indoor"], - [:key "location"; :value "frontRoomShelf"]] . - - -:airQualityIndoorPm10 a :MqttStatementSource; - :mqttTopic ("air_quality_indoor" "sensor" "particulate_matter_10m_concentration" "state"); - :parser xsd:double; - :graphStatements [ - :outputPredicate :pm10; - :statementLifetime "150s"; - ]; - :influxMeasurement [ - :measurement "pm10"; :pointsAtLeastEvery 5; - :predicate :pm10; - :tag [:key "host"; :value "air_quality_indoor"], - [:key "location"; :value "frontRoomShelf"]] . - -:airQualityIndoorPm25 a :MqttStatementSource; - :mqttTopic ("air_quality_indoor" "sensor" "particulate_matter_25m_concentration" "state"); - :parser xsd:double; - :graphStatements [ - :outputPredicate :pm25; - :statementLifetime "150s"; - ]; - :influxMeasurement [ - :measurement "pm25"; :pointsAtLeastEvery 5; - :predicate :pm25; - :tag [:key "host"; :value "air_quality_indoor"], - [:key "location"; :value "frontRoomShelf"]] . - -:airQualityIndoorPm100 a :MqttStatementSource; - :mqttTopic ("air_quality_indoor" "sensor" "particulate_matter_100m_concentration" "state"); - :parser xsd:double; - :graphStatements [ - :outputPredicate :pm100; - :statementLifetime "150s"; - ]; - :influxMeasurement [ - :measurement "pm100"; :pointsAtLeastEvery 5; - :predicate :pm100; - :tag [:key "host"; :value "air_quality_indoor"], - [:key "location"; :value "frontRoomShelf"]] . -
--- a/service/mqtt_to_rdf/config_air_quality_outdoor.n3 Tue Dec 29 20:55:24 2020 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +0,0 @@ -@prefix : <http://projects.bigasterisk.com/room/> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . -@prefix fr: <http://bigasterisk.com/foaf/> . -@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . - -:airQualityOutdoorTemperature a :MqttStatementSource; - :mqttTopic ("air_quality_outdoor" "sensor" "bme280_temperature" "state"); - :parser xsd:double; - :conversions (:celsiusToFarenheit - [:ignoreValueBelow -999]); - :graphStatements [ - :outputPredicate :temperatureF; - :statementLifetime "150s"; - ]; - - :influxMeasurement [ # replaces this block in piNode configs - :measurement "temperatureF"; :pointsAtLeastEvery 30; - :predicate :temperatureF; - :tag [:key "host"; :value "air_quality_outdoor"], - [:key "location"; :value "workbench"]] . - -:airQualityOutdoorPressure a :MqttStatementSource; - :mqttTopic ("air_quality_outdoor" "sensor" "bme280_pressure" "state"); - :parser xsd:double; - :graphStatements [ - :outputPredicate :pressure_hPa; - :statementLifetime "150s"; - ]; - :influxMeasurement [ - :measurement "pressure_hPa"; :pointsAtLeastEvery 30; - :predicate :pressure_hPa; - :tag [:key "host"; :value "air_quality_outdoor"], - [:key "location"; :value "workbench"]] . - - -:airQualityOutdoorHumidity a :MqttStatementSource; - :mqttTopic ("air_quality_outdoor" "sensor" "bme280_humidity" "state"); - :parser xsd:double; - :graphStatements [ - :outputPredicate :humidity; - :statementLifetime "150s"; - ]; - :influxMeasurement [ - :measurement "humidity"; :pointsAtLeastEvery 30; - :predicate :humidity; - :tag [:key "host"; :value "air_quality_outdoor"], - [:key "location"; :value "workbench"]] . - - -:airQualityOutdoorCo a :MqttStatementSource; - :mqttTopic ("air_quality_outdoor" "sensor" "ccs811_eco2_value" "state"); - :parser xsd:double; - :graphStatements [ - :outputPredicate :eco2; - :statementLifetime "150s"; - ]; - :influxMeasurement [ - :measurement "eco2";:pointsAtLeastEvery 60; - :predicate :eco2; - :tag [:key "host"; :value "air_quality_outdoor"], - [:key "location"; :value "workbench"]] . - -:airQualityOutdoorTvoc a :MqttStatementSource; - :mqttTopic ("air_quality_outdoor" "sensor" "ccs811_total_volatile_organic_compound" "state"); - :parser xsd:double; - :graphStatements [ - :outputPredicate :tvoc; - :statementLifetime "150s"; - ]; - :influxMeasurement [ - :measurement "tvoc"; :pointsAtLeastEvery 60; - :predicate :tvoc; - :tag [:key "host"; :value "air_quality_outdoor"], - [:key "location"; :value "workbench"]] . - - -:airQualityOutdoorPm10 a :MqttStatementSource; - :mqttTopic ("air_quality_outdoor" "sensor" "particulate_matter_10m_concentration" "state"); - :parser xsd:double; - :graphStatements [ - :outputPredicate :pm10; - :statementLifetime "150s"; - ]; - :influxMeasurement [ - :measurement "pm10"; :pointsAtLeastEvery 5; - :predicate :pm10; - :tag [:key "host"; :value "air_quality_outdoor"], - [:key "location"; :value "workbench"]] . - -:airQualityOutdoorPm25 a :MqttStatementSource; - :mqttTopic ("air_quality_outdoor" "sensor" "particulate_matter_25m_concentration" "state"); - :parser xsd:double; - :graphStatements [ - :outputPredicate :pm25; - :statementLifetime "150s"; - ]; - :influxMeasurement [ - :measurement "pm25"; :pointsAtLeastEvery 5; - :predicate :pm25; - :tag [:key "host"; :value "air_quality_outdoor"], - [:key "location"; :value "workbench"]] . - -:airQualityOutdoorPm100 a :MqttStatementSource; - :mqttTopic ("air_quality_outdoor" "sensor" "particulate_matter_100m_concentration" "state"); - :parser xsd:double; - :graphStatements [ - :outputPredicate :pm100; - :statementLifetime "150s"; - ]; - :influxMeasurement [ - :measurement "pm100"; :pointsAtLeastEvery 5; - :predicate :pm100; - :tag [:key "host"; :value "air_quality_outdoor"], - [:key "location"; :value "workbench"]] . -
--- a/service/mqtt_to_rdf/config_bed.n3 Tue Dec 29 20:55:24 2020 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -@prefix : <http://projects.bigasterisk.com/room/> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . -@prefix fr: <http://bigasterisk.com/foaf/> . - -:buttonMap a :ValueMap; - :map [:from "OFF"; :to :notPressed], [:from "ON"; :to :pressed] - . - -:bedGreenButton a :MqttStatementSource; - :mqttTopic ("bed" "switch" "green_button" "state"); - :parser :buttonMap; - :graphStatements [:outputPredicate :state;] . - -:bedRedButton a :MqttStatementSource; - :mqttTopic ("bed" "switch" "red_button" "state"); - :parser :buttonMap; - :graphStatements [:outputPredicate :state;] . - - -:motionMap a :ValueMap; - :map [:from "OFF"; :to :noMotion], [:from "ON"; :to :motion] - . - - - -:bedHeadboardMotion a :MqttStatementSource; - :mqttTopic ("bed" "switch" "pir" "state"); - :parser :motionMap; - :graphStatements [:outputPredicate :state;] .
--- a/service/mqtt_to_rdf/config_bed_bar.n3 Tue Dec 29 20:55:24 2020 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -@prefix : <http://projects.bigasterisk.com/room/> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . -@prefix fr: <http://bigasterisk.com/foaf/> . - -:buttonMap a :ValueMap; - :map [:from "OFF"; :to :notPressed], [:from "ON"; :to :pressed] - . - -:bedBarAsherButton1 a :MqttStatementSource; - :mqttTopic ("bed_bar_asher" "binary_sensor" "button_1" "state"); - :parser :buttonMap; - :graphStatements [:outputPredicate :state;] . - -:bedBarAsherButton2 a :MqttStatementSource; - :mqttTopic ("bed_bar_asher" "binary_sensor" "button_2" "state"); - :parser :buttonMap; - :graphStatements [:outputPredicate :state;] . - -:bedBarAsherButton3 a :MqttStatementSource; - :mqttTopic ("bed_bar_asher" "binary_sensor" "button_3" "state"); - :parser :buttonMap; - :graphStatements [:outputPredicate :state;] . - -:bedBarAsherButton4 a :MqttStatementSource; - :mqttTopic ("bed_bar_asher" "binary_sensor" "button_4" "state"); - :parser :buttonMap; - :graphStatements [:outputPredicate :state;] . \ No newline at end of file
--- a/service/mqtt_to_rdf/config_cardreader.n3 Tue Dec 29 20:55:24 2020 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -@prefix : <http://projects.bigasterisk.com/room/> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . -@prefix fr: <http://bigasterisk.com/foaf/> . - -:cardReader a :MqttStatementSource; - :mqttTopic ("frontwindow" "tag"); - :parser :tagIdToUri; # AA-BB-CC-DD to <http://bigasterisk.com/rfidCard/aabbccdd> - - :graphStatements [ - :outputPredicate :currentRead; - :statementLifetime "5s"; - ] - . - \ No newline at end of file
--- a/service/mqtt_to_rdf/config_frontdoorlock.n3 Tue Dec 29 20:55:24 2020 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -@prefix : <http://projects.bigasterisk.com/room/> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . -@prefix fr: <http://bigasterisk.com/foaf/> . -@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . - -:mqttConnectedStatusMap a :ValueMap; - :map [:from "offline"; :to :Offline], - [:from "online"; :to :Online] . - -:frontDoorLockStatus a :MqttStatementSource; - :mqttTopic ("frontdoorlock" "status"); - - :parser :mqttConnectedStatusMap; - - :graphStatements [ - :outputPredicate :connectedStatus - ] - - . -
--- a/service/mqtt_to_rdf/config_kitchen.n3 Tue Dec 29 20:55:24 2020 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -@prefix : <http://projects.bigasterisk.com/room/> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . -@prefix fr: <http://bigasterisk.com/foaf/> . - -:buttonMap a :ValueMap; - :map [:from "OFF"; :to :notPressed], [:from "ON"; :to :pressed] - . - - - -# goal is to read these and have reasoning notice them as the light state so the button works -#sonoff_0/switch/sonoff_basic_relay/state OFF - - -:kitchenCounterLight a :MqttStatementSource; - :mqttTopic ("h801_counter" "light" "kit_r" "state"); - :parser :jsonBrightness; - :graphStatements [:outputPredicate :brightness;] . - -:kitchenLight a :MqttStatementSource; - :mqttTopic ("h801_skylight" "light" "kit_r" "state"); - :parser :jsonBrightness; - :graphStatements [:outputPredicate :brightness;] . - \ No newline at end of file
--- a/service/mqtt_to_rdf/config_living_lamps.n3 Tue Dec 29 20:55:24 2020 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -@prefix : <http://projects.bigasterisk.com/room/> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . -@prefix fr: <http://bigasterisk.com/foaf/> . - -:buttonMap a :ValueMap; - :map [:from "OFF"; :to :notPressed], [:from "ON"; :to :pressed] - . - - - -# goal is to read these and have reasoning notice them as the light state so the button works -#sonoff_0/switch/sonoff_basic_relay/state OFF - - -:livingLampShelf a :MqttStatementSource; - :mqttTopic ("sonoff_0" "switch" "sonoff_basic_relay" "state"); - :parser :onOffBrightness; - :graphStatements [:outputPredicate :brightness;] . - -:livingLamp1 a :MqttStatementSource; - :mqttTopic ("sonoff_1" "switch" "sonoff_basic_relay" "state"); - :parser :onOffBrightness; - :graphStatements [:outputPredicate :brightness;] . - -:livingLamp2 a :MqttStatementSource; - :mqttTopic ("sonoff_2" "switch" "sonoff_basic_relay" "state"); - :parser :onOffBrightness; - :graphStatements [:outputPredicate :brightness;] . - -:livingLamp3 a :MqttStatementSource; - :mqttTopic ("sonoff_3" "switch" "sonoff_basic_relay" "state"); - :parser :onOffBrightness; - :graphStatements [:outputPredicate :brightness;] . - -:livingLamp4 a :MqttStatementSource; - :mqttTopic ("sonoff_4" "switch" "sonoff_basic_relay" "state"); - :parser :onOffBrightness; - :graphStatements [:outputPredicate :brightness;] . - -:livingLamp5 a :MqttStatementSource; - :mqttTopic ("sonoff_5" "switch" "sonoff_basic_relay" "state"); - :parser :onOffBrightness; - :graphStatements [:outputPredicate :brightness;] . - \ No newline at end of file
--- a/service/mqtt_to_rdf/config_nightlight_ari.n3 Tue Dec 29 20:55:24 2020 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -@prefix : <http://projects.bigasterisk.com/room/> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . -@prefix fr: <http://bigasterisk.com/foaf/> . -@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . - - -:nightlightAriTemperature a :MqttStatementSource; - :mqttTopic ("nightlight_ari" "sensor" "temperature" "state"); - - :parser xsd:double; - :conversions (:celsiusToFarenheit - [:ignoreValueBelow -999]); - :graphStatements [ - :outputPredicate :temperatureF; - :statementLifetime "150s"; - # ], [ - # :conversions ([:recentLow "30s"]); - # :outputPredicate :recentLowTemperatureF; - ]; - - :influxMeasurement [ # replaces this block in piNode configs - :measurement "temperatureF"; - :predicate :temperatureF; - :tag [:key "host"; :value "nightlight_ari"], - [:key "location"; :value "ariRoom"]] . -
--- a/service/mqtt_to_rdf/config_rf.n3 Tue Dec 29 20:55:24 2020 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -@prefix : <http://projects.bigasterisk.com/room/> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . -@prefix fr: <http://bigasterisk.com/foaf/> . - -:wallButton1 a :MqttStatementSource; - :mqttTopic ("rfsetup" "rf_received"); - :filterPayloadJsonEquals "{\"protocol\":1,\"code0\":0,\"code1\":7906}"; - :parser :rfCode; - :conversions (:buttonPress); - :graphStatements [:outputPredicate :state] . - -:wallButton2 a :MqttStatementSource; - :mqttTopic ("rfsetup" "rf_received"); - :filterPayloadJsonEquals "{\"protocol\":1,\"code0\":0,\"code1\":7905}"; - :parser :rfCode; - :conversions (:buttonPress); - :graphStatements [:outputPredicate :state] . - -:wallButton3 a :MqttStatementSource; - :mqttTopic ("rfsetup" "rf_received"); - :filterPayloadJsonEquals "{\"protocol\":1,\"code0\":0,\"code1\":7908}"; - :parser :rfCode; - :conversions (:buttonPress); - :graphStatements [:outputPredicate :state] .
--- a/service/mqtt_to_rdf/mqtt_to_rdf.py Tue Dec 29 20:55:24 2020 -0800 +++ b/service/mqtt_to_rdf/mqtt_to_rdf.py Tue Dec 29 21:05:32 2020 -0800 @@ -209,7 +209,7 @@ verboseLogging(arg['-v']) config = Graph() - for fn in Path('.').glob('config_*.n3'): + for fn in Path('.').glob('conf/*.n3'): if not arg['--cs'] or str(arg['--cs']) in str(fn): log.debug(f'loading {fn}') config.parse(str(fn), format='n3')
--- a/service/mqtt_to_rdf/serv.n3 Tue Dec 29 20:55:24 2020 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -@prefix : <http://bigasterisk.com/ns/serv#> . -@prefix auth: <http://bigasterisk.com/ns/serv/auth#> . -@prefix serv: <http://bigasterisk.com/services/> . - -serv:mqtt_to_rdf_image a :DockerImage; - :internalPort 10018; - :prodDockerFlags (); - :localRunDockerFlags ( - "-v" "`pwd`:/opt" -# "-v" "/my/proj/homeauto/lib:/lib_src" - ); - :localRunCmdline ( - "python3" "mqtt_to_rdf.py" "-v" - "--cs" "frontdoor" - ); - :dockerFile "Dockerfile" -. - -serv:mqtt_to_rdf a :Service; - :path "/mqtt_to_rdf/"; - :port 10018; - :openid auth:admin; - :serverHost "bang"; - :image serv:mqtt_to_rdf_image -. -