Adding muc_kitchen as esphome device
This commit is contained in:
parent
44ca11b1a3
commit
8c722111d5
|
|
@ -2,11 +2,100 @@
|
||||||
|
|
||||||
This is the sub project to establish monitoring for various things, that cannot be implemented in the Kubernetes cluster. This goes mostly into the direction of client side MQTT messages from sensors.
|
This is the sub project to establish monitoring for various things, that cannot be implemented in the Kubernetes cluster. This goes mostly into the direction of client side MQTT messages from sensors.
|
||||||
|
|
||||||
## MQTT testing
|
Various links:
|
||||||
|
|
||||||
|
* [https://esphome.io](https://esphome.io)
|
||||||
|
* [https://github.com/pvvx/ATC_MiThermometer](https://github.com/pvvx/ATC_MiThermometer)
|
||||||
|
|
||||||
|
## devices
|
||||||
|
|
||||||
|
| esp host | sensor name | mac |
|
||||||
|
|---------------|-------------|-------------------|
|
||||||
|
| muc_kitchen | outside | A4:C1:38:D5:9C:BD |
|
||||||
|
| muc_kitchen | kitchen | A4:C1:38:AA:5F:9E |
|
||||||
|
| muc_kitchen | bathroom | A4:C1:38:98:BA:CC |
|
||||||
|
|
||||||
|
|
||||||
|
## setup
|
||||||
|
|
||||||
|
### 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
|
||||||
|
# get nodeport of mosquitto
|
||||||
|
kubectl get svc mosquitto -n datalab
|
||||||
|
# for password see `cat ../k8s/datalab/mosquitto.secret.yml`
|
||||||
|
# subscribe to topic
|
||||||
|
❯ mqtt sub -h moritzgraf.de -p 30024 --user sender -pw <password> -t demo
|
||||||
|
# publish a msg in different shell
|
||||||
|
❯ mqtt pub -h moritzgraf.de -p 30024 --user sender -pw <password> -m "HEllo" -t demo
|
||||||
|
```
|
||||||
|
|
||||||
|
#### paho
|
||||||
|
|
||||||
|
```sh
|
||||||
|
pip install paho-mqtt
|
||||||
|
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'
|
||||||
```
|
```
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Gitignore settings for ESPHome
|
||||||
|
# This is an example and may include too much for your use-case.
|
||||||
|
# You can modify this file to suit your needs.
|
||||||
|
/.esphome/
|
||||||
|
/secrets.yaml
|
||||||
|
|
@ -0,0 +1,75 @@
|
||||||
|
esphome:
|
||||||
|
name: muc_kitchen
|
||||||
|
|
||||||
|
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_kitchen"
|
||||||
|
|
||||||
|
ota:
|
||||||
|
password: ""
|
||||||
|
|
||||||
|
wifi:
|
||||||
|
ssid: "Bababaambox"
|
||||||
|
password: "mopRulezmopRulez"
|
||||||
|
|
||||||
|
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
||||||
|
ap:
|
||||||
|
ssid: "Muc Kitchen Fallback Hotspot"
|
||||||
|
password: "iCMaF8TURlPg"
|
||||||
|
|
||||||
|
captive_portal:
|
||||||
|
|
||||||
|
esp32_ble_tracker:
|
||||||
|
|
||||||
|
sensor:
|
||||||
|
- platform: pvvx_mithermometer
|
||||||
|
mac_address: "A4:C1:38:D5:9C:BD"
|
||||||
|
temperature:
|
||||||
|
name: "muc_kitchen-outside Temperature"
|
||||||
|
humidity:
|
||||||
|
name: "muc_kitchen-outside Humidity"
|
||||||
|
battery_level:
|
||||||
|
name: "muc_kitchen-outside Battery-Level"
|
||||||
|
battery_voltage:
|
||||||
|
name: "muc_kitchen-outside Battery-Voltage"
|
||||||
|
signal_strength:
|
||||||
|
name: "muc_kitchen-outside Signal"
|
||||||
|
- platform: pvvx_mithermometer
|
||||||
|
mac_address: "A4:C1:38:AA:5F:9E"
|
||||||
|
temperature:
|
||||||
|
name: "muc_kitchen-kitchen Temperature"
|
||||||
|
humidity:
|
||||||
|
name: "muc_kitchen-kitchen Humidity"
|
||||||
|
battery_level:
|
||||||
|
name: "muc_kitchen-kitchen Battery-Level"
|
||||||
|
battery_voltage:
|
||||||
|
name: "muc_kitchen-kitchen Battery-Voltage"
|
||||||
|
signal_strength:
|
||||||
|
name: "muc_kitchen-kitchen Signal"
|
||||||
|
- platform: pvvx_mithermometer
|
||||||
|
mac_address: "A4:C1:38:98:BA:CC"
|
||||||
|
temperature:
|
||||||
|
name: "muc_kitchen-bathroom Temperature"
|
||||||
|
humidity:
|
||||||
|
name: "muc_kitchen-bathroom Humidity"
|
||||||
|
battery_level:
|
||||||
|
name: "muc_kitchen-bathroom Battery-Level"
|
||||||
|
battery_voltage:
|
||||||
|
name: "muc_kitchen-bathroom Battery-Voltage"
|
||||||
|
signal_strength:
|
||||||
|
name: "muc_kitchen-bathroom Signal"
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
import paho.mqtt.client as mqtt
|
||||||
|
|
||||||
|
import paho.mqtt.publish as publish
|
||||||
|
|
||||||
|
auth = {'username':"sender", 'password':"ahQueteiRietufeko8do"}
|
||||||
|
|
||||||
|
publish.single("demo", payload="Hello World.", retain=True, hostname="moritzgraf.de",
|
||||||
|
port=30024, client_id="knoedel", auth=auth,
|
||||||
|
protocol=mqtt.MQTTv5)
|
||||||
|
|
||||||
Loading…
Reference in New Issue