The sprinkler transformer was toast, after the sprinkler component update all the sprinklers turned ON at the same time (the UI shows them as OFF) when it restarts exceeding the transformer rating, I had to buy a new transformer and split the sprinklers via a separate N/O N/C relay to prevent them from drawing too much current. The problem of sprinkler relays turning ON when the component restarts persists though, I just found a way to minimise the current.
Is there a way to run an automation after the update of an esphome component, what can I add in the yaml, I want to run an automation to toggle the sprenklers ON and OFF after an update or a restart of the system, this ensures that they are all OFF. Not sure why suddenly my sprinkler relays turn ON (but show OFF on the UI) after restart of the component.
esphome:
name: sprinklerz_system
#platform: ESP8266
#board: nodemcuv2
includes:
- shift_register_switch.h
libraries:
- [email protected]
esp8266:
board: nodemcuv2
external_components:
- source:
type: git
url: https://github.com/robertklep/esphome-custom-component
components: [custom, custom_component]
switch:
- platform: custom
lambda: |-
const int data_pin = D5;
const int clock_pin = D6;
const int latch_pin = D7;
auto shift_register = new ShiftRegister74HC595(data_pin, clock_pin, latch_pin, 2);
for (int i = 0; i < 16; i++) {
shift_register->set(i, true);
}
std::vector<switch_::Switch *> switches;
for(int i = 0; i < 16; i++) {
auto zone_switch = new ShiftRegisterSwitch(i);
App.register_component(zone_switch);
switches.push_back(zone_switch);
}
return switches;
switches:
- name: "Sprinkler Zone 1"
inverted: yes
- name: "Sprinkler Zone 2"
inverted: yes
- name: "Sprinkler Zone 3"
inverted: yes
- name: "Sprinkler Zone 4"
inverted: yes
- name: "Sprinkler Zone 5"
inverted: yes
- name: "Sprinkler Zone 6"
inverted: yes
- name: "Sprinkler Zone 7"
inverted: yes
- name: "Sprinkler Zone 8"
inverted: yes
- name: "Sprinkler Zone 9"
inverted: yes
- name: "Sprinkler Zone 10"
inverted: yes
- name: "Sprinkler Zone 11"
inverted: yes
- name: "Sprinkler Zone 12"
inverted: yes
- name: "Sprinkler Zone 13"
inverted: yes
- name: "Sprinkler Zone 14"
inverted: yes
- name: "Sprinkler Zone 15"
inverted: yes
- name: "Sprinkler Zone 16"
inverted: yes
# Enable logging
logger:
# Enable Home Assistant API
api:
status_led:
pin: 16
text_sensor:
- platform: version
name: esphome_sprinkler_system_esphome_version
ota:
- platform: esphome
password: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Mmmm Fallback Hotspot"
password: "XXXXXXXXXXXXXXXXXXXXXXXXX"
captive_portal:
This looks like a case of less than optimal hardware design. You are using a shift register to control your relays. The relays turn on when the output is low (zero). The initial state of most shift registers on reset is zero (all outputs low). This means all relays will be ON and all sprinklers will also be on.
If you can’t or don’t want to change the HW, you can work around the problem using SW. They will still turn on on reset, but you can turn them off as soon as the software is ready. That might be good enough.
TL;DR esphome compile process gets killed to guarantee system stability because of limit
From the almighty esphome docs
early_pin_init (Optional, boolean): Specifies whether pins should be initialised as early as possible to known values. Recommended value is false where switches are involved, as these will toggle when updating the firmware or when restarting the device. Defaults to true.
So you don’t need to fry other things in the future
The problem of the esphome component not updating is back, only happens for my modbus connected component, here is the error log, and below is part of the yaml: