esp32:
board: esp32-gateway
framework:
- type: arduino
+ type: esp-idf
-# Enable logging
-logger:
- level: DEBUG
-
-ota:
- password: !secret ota_upgrade_pw
+packages:
+ base: !include base.yaml
external_components:
- source: github://nrandell/dallasng
- - source:
- type: local
- path: ../git/esphome_syslog/components
- components: [syslog]
-
-#wifi:
-# ssid: !secret wifi_ssid
-# password: !secret wifi_pw
-#
-# # Enable fallback hotspot (captive portal) in case wifi connection fails
-# ap:
-# ssid: "Pool Fallback Hotspot"
-# password: "JWWHJb38UzxY"
-#
-# manual_ip: !include poolup.yaml
-#
-#captive_portal:
syslog:
ip_address: !secret syslog_ip
+network:
+ enable_ipv6: false
+
+wifi: !remove
+
+ethernet:
+ type: LAN8720
+ mdc_pin: GPIO23
+ mdio_pin: GPIO18
+ clk_mode: GPIO17_OUT
+ phy_addr: 0
+ manual_ip: !include poolip.yaml
+
+#network:
+# enable_ipv6: true
+
+
script:
- id: bounce_1w_power
then:
// on at +0.3°C' logic we now have below.
time_t now = ::time(NULL);
- boolean cur_state = id(valve_output).state;
- boolean want_state = cur_state;
+ bool cur_state = id(valve_output).state;
+ bool want_state = cur_state;
if (cur_state) {
// Only turn off if the output has got all the way down below the input temp
want_state = outtemp >= intemp;
}
if (now < id(control_valve_last_change) + 300) {
- ESP_LOGD("control_valve", "Too soon to turn %s (%d seconds)", want_state ? "ON" : "OFF",
+ ESP_LOGD("control_valve", "Too soon to turn %s (%ld seconds)", want_state ? "ON" : "OFF",
now - id(control_valve_last_change));
return;
}
}
}
- # 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;
- });
-
globals:
- id: solar_in_fails # Number of minutes without a reading.
type: int
time:
- platform: sntp
- id: sntp_time
- servers: !secret ntp_servers
on_time:
# Turn on BLE client every 30 minutes for 2 minutes
# (or until it turns itself off after a successful reading)
id: pump_default
force: false
-ethernet:
- type: LAN8720
- mdc_pin: GPIO23
- mdio_pin: GPIO18
- clk_mode: GPIO17_OUT
- phy_addr: 0
- manual_ip: !include poolip.yaml
-
-#network:
-# enable_ipv6: true
-
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
on_connect:
then:
- delay: 2s # Too soon and the first messages don't get through!
then:
- lambda: |-
auto cumulative = x["electricitymeter"]["energy"]["import"]["cumulative"];
- int kwh, watts;
+ int kwh = 0, watts = 0;
if (cumulative) {
kwh = (cumulative.as<double>() * 1000.0f) + 0.1f;
id(tell_domo_svalue)->execute(29, std::to_string(kwh));