Current state monitoring with esphome

This commit is contained in:
Moritz Graf 2022-10-31 17:00:57 +01:00
parent 57f870d4f8
commit d0caae5515
No known key found for this signature in database
GPG Key ID: 74908B979B924E74
5 changed files with 253 additions and 83 deletions

View File

@ -9,20 +9,72 @@ Various links:
## devices ## devices
| esp host | sensor name | mac | For credentials see repective esphome config file in subdirectory `./config`.
|---------------|-------------|-------------------|
| muc_kitchen | outside | A4:C1:38:D5:9C:BD | | esp host | sensor name | mac | IP |
| muc_kitchen | kitchen | A4:C1:38:AA:5F:9E | |---------------|-------------|-------------------|-----------------|
| muc_kitchen | bathroom | A4:C1:38:98:BA:CC | | muc-kitchen | outside | A4:C1:38:D5:9C:BD | 192.168.178.200 |
| muc-kitchen | kitchen | A4:C1:38:AA:5F:9E | 192.168.178.200 |
| muc-kitchen | bathroom | A4:C1:38:98:BA:CC | 192.168.178.200 |
| muc-living | outside | A4:C1:38:04:1A:70 | 192.168.178.201 |
| muc-living | living | A4:C1:38:01:90:9A | 192.168.178.201 |
| muc-living | sleeping | A4:C1:38:CF:6D:2E | 192.168.178.201 |
| rgbg-living | living | A4:C1:38:E1:36:C0 | |
| rgbg-living | outside | A4:C1:38:9B:18:D0 | |
| rgbg-living | outside-flora | A4:C1:38:67:44:95 | |
| rgbg-living | krasser-kaktus | A4:C1:38:67:42:34 | |
## setup ## setup
### esphome
Setup is based on [this guide](https://esphome.io/guides/getting_started_command_line.html).
```sh
brew install esphome
# wizard to create new devices
esphome wizard muc-kitchen.secret.yml
# flash to device
# -hold boot button to enable flashing on esps
esphome run ./config/muc-kitchen.secret.yml
esphome run ./config/muc-living.secret.yml
```
### custom firmware for hygrometers
To flash a custom firmware for this sensor.
* Android handy, go to [this page](https://pvvx.github.io/ATC_MiThermometer/TelinkMiFlasher.html).
* Flash firmware.
To test everything, check this YouTube Video and use the app "nRF Connect for mobile".
### dyndns-muc
See file `dyndns-muc.moritzgraf.secret`.
TODO: Not sure why the respective update URL does not work.
### prometheus
Metrics are provided on `/metrics` link see in config file.
## no longer relevant
Switched from MQTT to prometheus exporter setup.
### MQTT testing ### MQTT testing
To test MQTT a cli can be used. See [hivemq install instructions](https://hivemq.github.io/mqtt-cli/docs/installation/#homebrew). To test MQTT a cli can be used. See [hivemq install instructions](https://hivemq.github.io/mqtt-cli/docs/installation/#homebrew).
```sh ```sh
mqtt sub -h moritzgraf.de -p 30024 --user sender -pw <password> -t demo
############# general mqtt
# get nodeport of mosquitto # get nodeport of mosquitto
kubectl get svc mosquitto -n datalab kubectl get svc mosquitto -n datalab
# for password see `cat ../k8s/datalab/mosquitto.secret.yml` # for password see `cat ../k8s/datalab/mosquitto.secret.yml`
@ -38,64 +90,3 @@ kubectl get svc mosquitto -n datalab
pip install paho-mqtt pip install paho-mqtt
python publish.py python publish.py
``` ```
### custom firmware for hygrometers
To flash a custom firmware for this sensor.
* Android handy, go to [this page](https://pvvx.github.io/ATC_MiThermometer/TelinkMiFlasher.html).
* Flash firmware.
To test everything, check this YouTube Video and use the app "nRF Connect for mobile".
### esphome
Setup is based on [this guide](https://esphome.io/guides/getting_started_command_line.html).
```sh
brew install esphome
# wizard to create new devices
esphome wizard muc_kitchen.secret.yml
# flash to device
# -hold boot button to enable flashing on esps
esphome run ./config/muc_kitchen.secret.yml
```
### debug info
```sh
[21:20:43][C][mqtt.sensor:027]: MQTT Sensor 'muc_kitchen-outside Temperature':
[21:20:43][C][mqtt.sensor:031]: State Topic: 'muc_kitchen/sensor/muc_kitchen-outside_temperature/state'
[21:20:43][C][mqtt.sensor:027]: MQTT Sensor 'muc_kitchen-outside Humidity':
[21:20:43][C][mqtt.sensor:031]: State Topic: 'muc_kitchen/sensor/muc_kitchen-outside_humidity/state'
[21:20:44][C][mqtt.sensor:027]: MQTT Sensor 'muc_kitchen-outside Battery-Level':
[21:20:44][C][mqtt.sensor:031]: State Topic: 'muc_kitchen/sensor/muc_kitchen-outside_battery-level/state'
[21:20:44][C][mqtt.sensor:027]: MQTT Sensor 'muc_kitchen-outside Battery-Voltage':
[21:20:44][C][mqtt.sensor:031]: State Topic: 'muc_kitchen/sensor/muc_kitchen-outside_battery-voltage/state'
[21:20:44][C][mqtt.sensor:027]: MQTT Sensor 'muc_kitchen-outside Signal':
[21:20:44][C][mqtt.sensor:031]: State Topic: 'muc_kitchen/sensor/muc_kitchen-outside_signal/state'
[21:20:44][C][mqtt.sensor:027]: MQTT Sensor 'muc_kitchen-kitchen Temperature':
[21:20:44][C][mqtt.sensor:031]: State Topic: 'muc_kitchen/sensor/muc_kitchen-kitchen_temperature/state'
[21:20:44][C][mqtt.sensor:027]: MQTT Sensor 'muc_kitchen-kitchen Humidity':
[21:20:44][C][mqtt.sensor:031]: State Topic: 'muc_kitchen/sensor/muc_kitchen-kitchen_humidity/state'
[21:20:44][C][mqtt.sensor:027]: MQTT Sensor 'muc_kitchen-kitchen Battery-Level':
[21:20:44][C][mqtt.sensor:031]: State Topic: 'muc_kitchen/sensor/muc_kitchen-kitchen_battery-level/state'
[21:20:44][C][mqtt.sensor:027]: MQTT Sensor 'muc_kitchen-kitchen Battery-Voltage':
[21:20:44][C][mqtt.sensor:031]: State Topic: 'muc_kitchen/sensor/muc_kitchen-kitchen_battery-voltage/state'
[21:20:44][C][mqtt.sensor:027]: MQTT Sensor 'muc_kitchen-kitchen Signal':
[21:20:44][C][mqtt.sensor:031]: State Topic: 'muc_kitchen/sensor/muc_kitchen-kitchen_signal/state'
[21:20:44][C][mqtt.sensor:027]: MQTT Sensor 'muc_kitchen-bathroom Temperature':
[21:20:44][C][mqtt.sensor:031]: State Topic: 'muc_kitchen/sensor/muc_kitchen-bathroom_temperature/state'
[21:20:44][C][mqtt.sensor:027]: MQTT Sensor 'muc_kitchen-bathroom Humidity':
[21:20:44][C][mqtt.sensor:031]: State Topic: 'muc_kitchen/sensor/muc_kitchen-bathroom_humidity/state'
[21:20:44][C][mqtt.sensor:027]: MQTT Sensor 'muc_kitchen-bathroom Battery-Level':
[21:20:44][C][mqtt.sensor:031]: State Topic: 'muc_kitchen/sensor/muc_kitchen-bathroom_battery-level/state'
[21:20:44][C][mqtt.sensor:027]: MQTT Sensor 'muc_kitchen-bathroom Battery-Voltage':
[21:20:44][C][mqtt.sensor:031]: State Topic: 'muc_kitchen/sensor/muc_kitchen-bathroom_battery-voltage/state'
[21:20:44][C][mqtt.sensor:027]: MQTT Sensor 'muc_kitchen-bathroom Signal':
[21:20:44][C][mqtt.sensor:031]: State Topic: 'muc_kitchen/sensor/muc_kitchen-bathroom_signal/state'
```

View File

@ -1,5 +1,5 @@
esphome: esphome:
name: muc_kitchen name: muc-kitchen
esp32: esp32:
board: nodemcu-32s board: nodemcu-32s
@ -18,7 +18,7 @@ mqtt:
port: "30024" port: "30024"
username: "sender" username: "sender"
password: "ahQueteiRietufeko8do" password: "ahQueteiRietufeko8do"
topic_prefix: "muc_kitchen" topic_prefix: "muc-kitchen"
ota: ota:
password: "" password: ""
@ -34,42 +34,50 @@ wifi:
captive_portal: captive_portal:
# http://ahfahfoozuVeezoong6c:aeThoom4deiNgeici0Th@muc-kitchen.local/metrics
web_server:
auth:
username: ahfahfoozuVeezoong6c
password: aeThoom4deiNgeici0Th
prometheus:
esp32_ble_tracker: esp32_ble_tracker:
sensor: sensor:
- platform: pvvx_mithermometer - platform: pvvx_mithermometer
mac_address: "A4:C1:38:D5:9C:BD" mac_address: "A4:C1:38:D5:9C:BD"
temperature: temperature:
name: "muc_kitchen-outside Temperature" name: "muc-kitchen-outside Temperature"
humidity: humidity:
name: "muc_kitchen-outside Humidity" name: "muc-kitchen-outside Humidity"
battery_level: battery_level:
name: "muc_kitchen-outside Battery-Level" name: "muc-kitchen-outside Battery-Level"
battery_voltage: battery_voltage:
name: "muc_kitchen-outside Battery-Voltage" name: "muc-kitchen-outside Battery-Voltage"
signal_strength: signal_strength:
name: "muc_kitchen-outside Signal" name: "muc-kitchen-outside Signal"
- platform: pvvx_mithermometer - platform: pvvx_mithermometer
mac_address: "A4:C1:38:AA:5F:9E" mac_address: "A4:C1:38:AA:5F:9E"
temperature: temperature:
name: "muc_kitchen-kitchen Temperature" name: "muc-kitchen-kitchen Temperature"
humidity: humidity:
name: "muc_kitchen-kitchen Humidity" name: "muc-kitchen-kitchen Humidity"
battery_level: battery_level:
name: "muc_kitchen-kitchen Battery-Level" name: "muc-kitchen-kitchen Battery-Level"
battery_voltage: battery_voltage:
name: "muc_kitchen-kitchen Battery-Voltage" name: "muc-kitchen-kitchen Battery-Voltage"
signal_strength: signal_strength:
name: "muc_kitchen-kitchen Signal" name: "muc-kitchen-kitchen Signal"
- platform: pvvx_mithermometer - platform: pvvx_mithermometer
mac_address: "A4:C1:38:98:BA:CC" mac_address: "A4:C1:38:98:BA:CC"
temperature: temperature:
name: "muc_kitchen-bathroom Temperature" name: "muc-kitchen-bathroom Temperature"
humidity: humidity:
name: "muc_kitchen-bathroom Humidity" name: "muc-kitchen-bathroom Humidity"
battery_level: battery_level:
name: "muc_kitchen-bathroom Battery-Level" name: "muc-kitchen-bathroom Battery-Level"
battery_voltage: battery_voltage:
name: "muc_kitchen-bathroom Battery-Voltage" name: "muc-kitchen-bathroom Battery-Voltage"
signal_strength: signal_strength:
name: "muc_kitchen-bathroom Signal" name: "muc-kitchen-bathroom Signal"

View File

@ -0,0 +1,83 @@
esphome:
name: muc-living
esp32:
board: nodemcu-32s
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
password: ""
mqtt:
broker: "moritzgraf.de"
port: "30024"
username: "sender"
password: "ahQueteiRietufeko8do"
topic_prefix: "muc-living"
ota:
password: ""
wifi:
ssid: "Bababaambox"
password: "mopRulezmopRulez"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Muc Living Fallback Hotspot"
password: "iCMaF8TURlPg"
captive_portal:
# http://Gul3zooSa5Waphophuag:eeLie9Mai9ahfi5ahy2i@muc-living.local/metrics
web_server:
auth:
username: Gul3zooSa5Waphophuag
password: eeLie9Mai9ahfi5ahy2i
prometheus:
esp32_ble_tracker:
sensor:
- platform: pvvx_mithermometer
mac_address: "A4:C1:38:04:1A:70"
temperature:
name: "muc-living-outside Temperature"
humidity:
name: "muc-living-outside Humidity"
battery_level:
name: "muc-living-outside Battery-Level"
battery_voltage:
name: "muc-living-outside Battery-Voltage"
signal_strength:
name: "muc-living-outside Signal"
- platform: pvvx_mithermometer
mac_address: "A4:C1:38:01:90:9A"
temperature:
name: "muc-living-living Temperature"
humidity:
name: "muc-living-living Humidity"
battery_level:
name: "muc-living-living Battery-Level"
battery_voltage:
name: "muc-living-living Battery-Voltage"
signal_strength:
name: "muc-living-living Signal"
- platform: pvvx_mithermometer
mac_address: "A4:C1:38:CF:6D:2E"
temperature:
name: "muc-living-sleeping Temperature"
humidity:
name: "muc-living-sleeping Humidity"
battery_level:
name: "muc-living-sleeping Battery-Level"
battery_voltage:
name: "muc-living-sleeping Battery-Voltage"
signal_strength:
name: "muc-living-sleeping Signal"

View File

@ -0,0 +1,88 @@
esphome:
name: rgbg-living
esp32:
board: m5stick-c
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
password: ""
ota:
password: ""
wifi:
ssid: "Bababaambox"
password: "mopRulezmopRulez"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "rgbg living Fallback Hotspot"
password: "iCMaF8TURlPg"
captive_portal:
# http://oot6ainge9aef6iaf4Cu:oonohNaej6soh7TooPha@rgbg-kitchen.local/metrics
web_server:
auth:
username: oot6ainge9aef6iaf4Cu
password: oonohNaej6soh7TooPha
prometheus:
esp32_ble_tracker:
sensor:
- platform: pvvx_mithermometer
mac_address: "A4:C1:38:9B:18:D0"
temperature:
name: "rgbg-living-outside Temperature"
humidity:
name: "rgbg-kilivingtchen-outside Humidity"
battery_level:
name: "rgbg-living-outside Battery-Level"
battery_voltage:
name: "rgbg-living-outside Battery-Voltage"
signal_strength:
name: "rgbg-living-outside Signal"
- platform: pvvx_mithermometer
mac_address: "A4:C1:38:E1:36:C0"
temperature:
name: "rgbg-living-living Temperature"
humidity:
name: "rgbg-living-living Humidity"
battery_level:
name: "rgbg-living-living Battery-Level"
battery_voltage:
name: "rgbg-living-living Battery-Voltage"
signal_strength:
name: "rgbg-living-kitchen Signal"
- platform: xiaomi_hhccjcy01
mac_address: 'A4:C1:38:67:44:95'
temperature:
name: "rgbg-living-outside-flora Temperature"
moisture:
name: "rgbg-living-outside-flora Moisture"
illuminance:
name: "rgbg-living-outside-flora Illuminance"
conductivity:
name: "rgbg-living-outside-flora Conductivity"
battery_level:
name: "rgbg-living-outside-flora Battery-Level"
- platform: xiaomi_hhccjcy01
mac_address: 'A4:C1:38:67:42:34'
temperature:
name: "rgbg-living-krasser-kaktus Temperature"
moisture:
name: "rgbg-living-krasser-kaktus Moisture"
illuminance:
name: "rgbg-living-krasser-kaktus Illuminance"
conductivity:
name: "rgbg-living-krasser-kaktus Conductivity"
battery_level:
name: "rgbg-living-krasser-kaktus Battery-Level"

Binary file not shown.