Removed ESPHome entity and now unable to recreate it

I made the LED blink test as my first ESPHome project. After it worked I wanted to modify it to control a stepper motor and used the same entity and edited the existing file. At that point the ESP board stopped working. To overcome this I figured I would delete it’s entity and recreate it. Now I can’t get the entity back.

HA shows ESPHome in Intigrations and shows the ESPHome device as “stepper-test-1” but the entity disappeared and I can’t get it back.

My attempts to overcome this I renamed the ESPHome config file from stepper-motor-test.yaml to a couple variations of stepper-test.yaml, and reassigned different IP addresses to it. In an attempt to start over I deleted the entity I tried to go back further by deinstalling/reinstalling the add-on and the integration but everything restores including my problem. Wireless downloads work fine.

My setup:
Home Assistant is installed in a Proxmox VM.
Home Assistant OS 6.6
core-2021.11.5
supervisor-2021.10.8
ESP board is a 8266.

My ESP board config:

esphome:
  name: stepper-test
  platform: ESP8266
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "8b5f34d202bbfa10612757fe2afe2ce0"

wifi:
  ssid: "CenturyLink0914-24G-2"
  password: !secret wifi_password
  
  manual_ip:
    # Set this to the IP of the ESP
    static_ip: 192.168.0.153
    # Set this to the IP address of the router. Often ends with .1
    gateway: 194.168.0.1
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Stepper-Test-1 Fallback Hotspot"
    password: "LdrDsCVd6Xnm"

captive_portal:

status_led:
  pin: GPIO2
  
stepper:
  - platform: a4988
    id: my_stepper
    step_pin: GPIO16
    dir_pin: GPIO05
    max_speed: 250 steps/s

    # Optional:
    #sleep_pin: D2
    #acceleration: inf
    #deceleration: inf

Delete the esphome device “every device is an integration as such”. Then add it back.

For devices there is no delete but there is a disable. Or are you saying there is a file I should delete? I did disable the device and then recreated a new device. The new device compiles and loads into the ESP board without errors and afterwards I can access it via wifi to reload the loadware but still no entity is ever created.

Configuration → integration → select device.

then:

Delete…

to add: add integration → esphome → fill in.

remember:

I tried this but it did not fix my problem. And I an sorry but I think I may be missing your point in your statement “every device is an integration as such”. Since I think I am duplicationg your requested actions but not getting the expected results I will provide my steps in detail. Hope it helps:

  1. Just to cover my bases, before I deleted the integration I went to the ESPHome web GUI and deleted the devise from there.

  2. I attempt to do what you said “Configuration → integration → select device”. I can do “Configuration → integration →” and I select Delete as in your picture, but there is no ability to select my device, possibly because I only have one device. So I select Delete and I get the following pop-up, and after confirming the pop up not only is the device removed but the entire integration is removed.

  3. I reboot Home Assistant and return to “Configuration → integration”. There is no longer a ESPHome integration so I add it back and when I do HA always finds the old device and automatically puts it back but never will it include an entity with the device.

When I look at the ESPHome web GUI I see zero devices listed but if I look at Configuration → integration I see the StepperMotor device that was automatically restored when I reinstalled the ESPHome integration. Could this be a discrepancy?



I then add and configure the device within the ESPHome web GUI, save, reboot, but still no entity, only a device. Could there be some remnant in a file that needs to be cleaned up?

Both things work together but totally independent. The esphome addon is only to CREATE the binary firmware and flash it to an esp. Once flashed you can add it to homeassistant (integration). And if you have only 1 esp then it’s only 1 integration. And if you remove 1, your left with none.

So if you have deleted the yaml file from the addon, but the esp is still flashed you can keep using the esp as an integration. If you want to reflash the esp, you need to recreate a yaml file and flash it via serial or wireless by using the ip adress of the device.

The reason for not seeing an entity can be that in your esp yaml in the original post there is no entity (sensor, switch, etc.) configured…

Try adding a sensor like this in your esphome config yaml file:

It must show as an entity in homeassistant

Solved. Thanks, you clarified this for me. You have been a great help. My Stepper motor implementation was incomplete. I now have an entity for it! It doesn’t work properly but that is another issue I will tackle later. (I suspect my stepper driver board is damaged)

According to the ESPHome Stepper motor documentation it says “This component will not show up in the Home Assistant front-end (Overview) automatically because Home Assistant does not support steppers natively.” Consequently, implementing ESPHome stepper motor was more involved than than typical implementations. Thank you for your patience and time. The edit that got the entity to appear is the section in my ESPHome file below that starts “cover:…” and includes the open, close, and stop actions.

For others struggling with the stepper motor here is my config:

esphome:
  name: steppermotortest12
  platform: ESP8266
  board: esp01_1m

# Enable logging
logger:

ota:
  password: "88849d9b2185cb46e00f4967xxxxxx19bfc"

wifi:
  ssid: "CenturyLink0914-5g"
  password: !secret wifi_password

  manual_ip:
    # Set this to the IP of the ESP
    static_ip: 192.168.0.151
    # Set this to the IP address of the router. Often ends with .1
    gateway: 194.168.0.1
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Steppermotortest12"
    password: "vfCvg0xxxxgb"

captive_portal:

stepper:
  - platform: a4988
    id: my_stepper
    step_pin: GPIO16
    dir_pin: GPIO05
    max_speed: 250 steps/s

    # Optional:
    sleep_pin: GPIO04
    acceleration: inf
    deceleration: inf

status_led:
  pin: GPIO2
  
api:
  services:
    - service: control_stepper
      variables:
        target: int
      then:
        - stepper.set_target:
            id: my_stepper
            target: !lambda 'return target;'

cover:
  - platform: template
    name: "My Blind"
    id: my_blind
    open_action:

      - stepper.set_target:
          id: my_stepper
          target: 0 
    close_action:

      - stepper.set_target:
          id: my_stepper
          target: 25000
    stop_action:

      - stepper.set_target:
          id: my_stepper
          target: !lambda return id(my_stepper).current_position;      
    optimistic: true  
    assumed_state: true

Additionally I added this to my configuration.yaml, but this did not put a entity in my system and doesn’t seem to work so I think there may be a issue in here but many online examples include the config lines below. I will come back and fix this later.

  # Add a slider control to Home Assistant to set an integer value
input_number:
  stepper_control:
    name: Stepper Control
    initial: 0
    min: -1000
    max: 1000
    step: 1
    mode: slider

And below was needed to be added this to the automation.yaml file to support the configuration.yaml entries:

  # Manually added for stepper control
  
- alias: Write Stepper Value to ESP
  trigger:
  platform: state
  entity_id: input_number.stepper_control
  action:
      # Replace steppermotortest12 with the name you gave the ESP
      - service: esphome.steppermotortest12_control_stepper
        data_template:
          target: '{{ trigger.to_state.state | int }}'