diff --git a/common/buttons/restart.yaml b/common/buttons/restart.yaml new file mode 100644 index 0000000..92a0d93 --- /dev/null +++ b/common/buttons/restart.yaml @@ -0,0 +1,4 @@ + - platform: restart + name: Restart + icon: "mdi:restart" + entity_category: diagnostic diff --git a/common/buttons/safe-mode.yaml b/common/buttons/safe-mode.yaml new file mode 100644 index 0000000..a3d53d7 --- /dev/null +++ b/common/buttons/safe-mode.yaml @@ -0,0 +1,4 @@ + - platform: safe_mode + name: Safe Mode Boot + icon: "mdi:restart" + entity_category: diagnostic diff --git a/common/common.yaml b/common/common.yaml new file mode 100644 index 0000000..57d971a --- /dev/null +++ b/common/common.yaml @@ -0,0 +1,7 @@ +<<: !include config/wifi.yaml +<<: !include config/time.yaml +<<: !include config/ota.yaml +<<: !include config/api.yaml +<<: !include config/mqtt.yaml + +logger: diff --git a/common/config/api.yaml b/common/config/api.yaml new file mode 100644 index 0000000..093c453 --- /dev/null +++ b/common/config/api.yaml @@ -0,0 +1,7 @@ +## Native API Component ## +## https://esphome.io/components/api.html +api: + # Set to 0s to disable switch reboot if nothing connects to the API + reboot_timeout: 15min + encryption: + key: ${encryption_key} diff --git a/common/config/mqtt.yaml b/common/config/mqtt.yaml new file mode 100644 index 0000000..d491280 --- /dev/null +++ b/common/config/mqtt.yaml @@ -0,0 +1,19 @@ +## MQTT Client Component ## +## https://esphome.io/components/mqtt.html +mqtt: + # Set to 0s to disable switch reboot if no MQTT connection exists + reboot_timeout: 15min + broker: ${mqtt_broker} + username: ${mqtt_username} + password: ${mqtt_password} + discovery: false + log_topic: + topic: esphome/logs/${devicename} + level: ERROR + topic_prefix: esphome + birth_message: + topic: esphome/state/${devicename} + payload: online + will_message: + topic: esphome/state/${devicename} + payload: offline diff --git a/common/config/ota.yaml b/common/config/ota.yaml new file mode 100644 index 0000000..1c9aad7 --- /dev/null +++ b/common/config/ota.yaml @@ -0,0 +1,6 @@ +## Over-the-Air Updates ## +## https://esphome.io/components/ota/ +## https://esphome.io/components/ota/esphome +ota: + - platform: esphome + password: ${ota_password} diff --git a/common/config/time.yaml b/common/config/time.yaml new file mode 100644 index 0000000..5e1c4d6 --- /dev/null +++ b/common/config/time.yaml @@ -0,0 +1,6 @@ +## Time Component ## +## https://esphome.io/components/time/ +time: + - platform: sntp + servers: ${ntp_server_ip} + timezone: ${timezone} diff --git a/common/config/wifi.yaml b/common/config/wifi.yaml new file mode 100644 index 0000000..4dd9850 --- /dev/null +++ b/common/config/wifi.yaml @@ -0,0 +1,12 @@ +## WiFi Component ## +## https://esphome.io/components/wifi.html +wifi: + ssid: ${wifi_ssid} + password: ${wifi_password} + domain: ${wifi_domain} + fast_connect: true + power_save_mode: none + + ap: + ssid: "${devicename} Fallback" + password: ${fallback_ap_password} diff --git a/common/sensors/uptime.yaml b/common/sensors/uptime.yaml new file mode 100644 index 0000000..e546b7e --- /dev/null +++ b/common/sensors/uptime.yaml @@ -0,0 +1,7 @@ + - platform: uptime + name: Uptime + type: seconds + update_interval: 60s + entity_category: "diagnostic" + state_class: measurement + device_class: duration diff --git a/common/sensors/wifi-signal.yaml b/common/sensors/wifi-signal.yaml new file mode 100644 index 0000000..9644891 --- /dev/null +++ b/common/sensors/wifi-signal.yaml @@ -0,0 +1,7 @@ + - platform: wifi_signal # Reports the WiFi signal strength/RSSI in dB + name: "WiFi Signali dB" + id: wifi_signal_db + update_interval: 60s + entity_category: "diagnostic" + state_class: measurement + device_class: signal_strength