Platform and Custom Fix in HA

Afternoon,

I have the following yaml for my sprinklers which works but won’t update anymore due to “platform” and “custom”, how do I fix it?

esphome:
  name: sprinklerz_system
  platform: ESP8266
  board: nodemcuv2
  includes:
    - shift_register_switch.h
  libraries:
    - [email protected]
 
switch:
  - platform: custom
    lambda: |-
      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        

To fix the platform issue:

esphome:
  name: sprinklerz_system
  includes:
    - shift_register_switch.h
  libraries:
    - [email protected]

esp8266:
  board: nodemcuv2

To fix the custom issue, you need to rewrite everything to an external component, as explained here: Contributing — ESPHome

Look here for a possible fix for the custom component not working anymore: GitHub - robertklep/esphome-custom-component: Brings back support for custom ESPHome components

<rantmode>
To be honest, by removing support for custom components, the ESPHome developers have, IMO, underestimated how many people use “quick and dirty” custom components for personal projects; these people are expected to write external components now, which are still not very well documented, require much more programming knowledge (of both Python and C++), and are often overkill for personal projects.
</rantmode>

2 Likes

Thank you @robertklep , I added the external_components and it works, I was terrified during the process but I held my nerve until I got it to work.

1 Like