From: David Woodhouse Date: Wed, 7 Aug 2024 14:51:34 +0000 (+0100) Subject: Move common config to base.yaml package X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=d3e7378c244fcb62be2776ad3d7ded105cb14333;p=users%2Fdwmw2%2Fesp32-pool.git Move common config to base.yaml package Use oldsoftener as a test for now --- diff --git a/base.yaml b/base.yaml new file mode 100644 index 0000000..0fa57e3 --- /dev/null +++ b/base.yaml @@ -0,0 +1,89 @@ +# +# Base configuration package +# + +# Enable logging +logger: + level: DEBUG + +ota: + platform: esphome + password: !secret ota_upgrade_pw + +external_components: + - source: + type: local + path: ../git/esphome_syslog/components + components: [syslog] + +wifi: + power_save_mode: none + networks: + - ssid: !secret wifi_ssid + password: !secret wifi_pw + +script: + # Publish a value to Domoticz as an nvalue + - id: tell_domo_nvalue + mode: queued + parameters: + udevice: int + nvalue: int + then: + lambda: |- + id(mqtt_client).publish_json("domoticz/in", [=](JsonObject root) { + root["command"] = "udevice"; + root["idx"] = udevice; + root["nvalue"] = nvalue; + }); + + # Publish a value to Domoticz as an svalue + - id: tell_domo_svalue + mode: queued + parameters: + udevice: int + svalue: string + then: + lambda: |- + id(mqtt_client).publish_json("domoticz/in", [=](JsonObject root) { + root["command"] = "udevice"; + root["idx"] = udevice; + root["svalue"] = svalue; + }); + + # Publish to Domoticz as nvalue and svalues + - id: tell_domo_nsvalues + mode: queued + parameters: + udevice: int + nvalue: int + svalue: string + then: + lambda: |- + id(mqtt_client).publish_json("domoticz/in", [=](JsonObject root) { + root["command"] = "udevice"; + root["idx"] = udevice; + root["nvalue"] = nvalue; + root["svalue"] = svalue; + }); + +syslog: + ip_address: !secret syslog_ipv6 + +network: + enable_ipv6: true + +time: + - platform: sntp + id: sntp_time + servers: !secret ntp_servers + +mqtt: + broker: !secret mqtt_server + port: 1884 + discovery_prefix: ${mqtt_prefix}/homeassistant + log_topic: ${mqtt_prefix}/logs + username: "pool" + password: !secret pool_mqtt_pw + id: mqtt_client + diff --git a/oldsoftener.yaml b/oldsoftener.yaml new file mode 100644 index 0000000..a0cae9c --- /dev/null +++ b/oldsoftener.yaml @@ -0,0 +1,73 @@ +# +# https://www.aliexpress.com/item/1005004099215436.html +# +# GPIO23: Onboard blue LED (used to show MQTT connectivity) +# GPIO16: Onboard relay (bathroom fan) +# GPIO13: DHT22 + +esphome: + name: oldsoftener + +esp32: + board: esp32-gateway + framework: + type: esp-idf + +packages: + base: !include base.yaml + +wifi: + power_save_mode: none + networks: + - ssid: !secret wifi_ssid + password: !secret wifi_pw + bssid: !secret garden_bssid + priority: 1 + +mqtt: + on_connect: + then: + - light.turn_on: blue_led + + on_disconnect: + then: + - light.turn_off: blue_led + +light: + - platform: binary + name: "Blue LED" + id: blue_led + output: led_output + +output: + - id: led_output + platform: gpio + pin: GPIO23 + +switch: + - platform: gpio + name: "Fan" + id: fan_relay + pin: GPIO16 + +sensor: + - platform: hx711 + dout_pin: + number: GPIO13 # Orange + mode: + input: true + pullup: true + clk_pin: GPIO14 # Yellow + gain: 128 + update_interval: 30s + name: "HX711 value" + filters: + - calibrate_linear: + - 424400 -> 0 + - -1592100 -> 89.05 + unit_of_measurement: kg + on_value: + then: + lambda: |- +# if (!isnan(x)) +# id(tell_domo_svalue)->execute(524, std::to_string(x));