"Entity not found" error after POWER goes OFF and ON

I am facing a challenge with Hassbian installed on my Raspberry pi 3 B+ . Everytime when a whole system (wifi router & raspberry pi) goes power down or switch turn OFF, and after sometime turn ON, its not able to detect my any MQTT devices which is almost all the devices.

Here i try editing /etc/systemd/system/[email protected] file

[Unit]
Description=Home Assistant for %i
After=network.target mosquitto.service

Even after this it didn’t help. I have my my Mosquitto enabled by default on startup.

If I manually restart my Home Assistant I can see all of my devices back again.

I am not sure where I am making any mistake. Here is how my configuration.yaml looks like:

homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: 
  longitude: 
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: 0
  # metric for Metric, imperial for Imperial
  unit_system: metric
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: 
  # Customization file
  customize: !include customize.yaml

# Show links to resources in log and frontend
#introduction:

# Enables the frontend
frontend:


system_health:

# Enables configuration UI
config:

recorder:
  purge_keep_days: 15
  exclude:
    entities:
      - sun.sun # Don't record sun data
      - sensor.dark_sky_summary
      - sensor.dark_sky_icon 
      - sensor.dark_sky_temperature
      - sensor.dark_sky_apparent_temperature
      - sensor.dark_sky_wind_speed


mqtt:
  broker: 192.168.1.140
  port: 8873

panel_iframe:
  configurator:
    title: Configurator
    icon: mdi:wrench
    url: https://home.duckdns.org:3218


google_assistant:
  project_id: "neroom"
  api_key: "LzuxhwQQnJZw"
  exposed_domains:
    - switch
    - light
    - cover 
    - group
    - scene


# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
http:
  api_password: "123123"
  # base_url: home.duckdns.org
  ssl_certificate: "/etc/letsencrypt/live/home.duckdns.org/fullchain.pem"
  ssl_key: "/etc/letsencrypt/live/home.duckdns.org/privkey.pem"

# Checks for available updates
# Note: This component will send some information about your system to
# the developers to assist with development of Home Assistant.
# For more information, please see:
# https://home-assistant.io/blog/2016/10/25/explaining-the-updater/
updater:
  # Optional, allows Home Assistant developers to focus on popular components.
  # include_used_components: true

# Discover some devices automatically
discovery:





binary_sensor:
  - platform: mqtt
    name: "Dressing Room PIR"
    state_topic: "home/room/dressingroom/pir"
    payload_on: "on"
    payload_off: "off"
  - platform: mqtt
    name: "Enterance PIR"
    state_topic: "home/nehulroom/enterance/pir"
    payload_on: "on"
    payload_off: "off"

  - platform: mqtt
    name: "Balcony Door"
    state_topic: "home/room/balcony_door"
    payload_on: "on"
    payload_off: "off"
    off_delay: 10
    device_class: "door"

  - platform: mqtt
    name: Water Tank Full
    state_topic: "home/parking/water_tank_full"
    payload_on: "on"
    payload_off: "off"
    off_delay: 10
    device_class: "moisture"


switch:
  - platform: mqtt
    name: Fan
    command_topic: "home/room/fan"
    state_topic: "home/room/fan"
    payload_on: "on"
    payload_off: "off"
    retain: true
  - platform: mqtt
    name: Projector
    command_topic: "home/room/projector"
    state_topic: "home/room/projector"
    payload_on: "on"
    payload_off: "off"
    retain: true

################################# Parking ##########################

  - platform: mqtt
    name: Water Motor
    command_topic: "home/parking/watermotor"
    state_topic: "home/parking/watermotor"
    payload_on: "on"
    payload_off: "off"
    retain: true
    
################################# Hall Elements  ###################
  - platform: mqtt
    name: Hall Fan
    command_topic: "home/hall/fan"
    state_topic: "home/hall/fan"
    payload_on: "on"
    payload_off: "off"
    retain: true
  - platform: mqtt
    name: Hall Main LED
    command_topic: "home/hall/led"
    state_topic: "home/hall/led"
    payload_on: "on"
    payload_off: "off"
    retain: true
  - platform: mqtt
    name: Parking CFL
    command_topic: "home/hall/parking_cfl"
    state_topic: "home/hall/parking_cfl"
    payload_on: "on"
    payload_off: "off"
    retain: true
  - platform: mqtt
    name: Back Panel
    command_topic: "home/hall/backend_panel"
    state_topic: "home/hall/backend_panel"
    payload_on: "on"
    payload_off: "off"
    retain: true
    
################################# Only Demo Values AAre here For testing #######
  - platform: mqtt
    name: Demo1
    command_topic: "home/nehulroom/demo1"
    state_topic: "home/nehulroom/demo1"
    payload_on: "on"
    payload_off: "off"
    retain: true
  - platform: mqtt
    name: Demo2
    command_topic: "home/nehulroom/demo2"
    state_topic: "home/nehulroom/demo2"
    payload_on: "on"
    payload_off: "off"
    retain: true
    
  - platform: mqtt
    name: Demo3
    command_topic: "home/nehulroom/demo3"
    state_topic: "home/nehulroom/demo3"
    payload_on: "on"
    payload_off: "off"
    retain: true
  - platform: mqtt
    name: Demo4
    command_topic: "home/nehulroom/demo4"
    state_topic: "home/nehulroom/demo4"
    payload_on: "on"
    payload_off: "off"
    retain: true
    
################################# Nehul Room Dressing Room ##################    
  - platform: mqtt
    name: Dressing Room Light
    state_topic: "home/room/dressingroomlight"
    command_topic: "home/room/dressingroomlight"
    payload_on: "on"
    payload_off: "off"
    state_on: "on"
    state_off: "off"
    retain: true
  - platform: mqtt
    name: Makeup Light
    state_topic: "home/room/makeuplight"
    command_topic: "home/room/makeuplight"
    payload_on: "on"
    payload_off: "off"
    state_on: "on"
    state_off: "off"
    retain: true
    
light:
  - platform: mqtt
    name: Spot Light
    state_topic: "home/nehulroom/spotlight"
    command_topic: "home/nehulroom/spotlight"
    payload_on: "on"
    payload_off: "off"
    retain: true
  - platform: mqtt
    name: Big Lights
    state_topic: "home/nehulroom/biglights"
    command_topic: "home/nehulroom/biglights"
    payload_on: "on"
    payload_off: "off"
    retain: true
  - platform: mqtt
    name: Small Lights
    state_topic: "home/nehulroom/smalllights"
    command_topic: "home/nehulroom/smalllights"
    payload_on: "on"
    payload_off: "off"
    retain: true
    
############################## Nehul Room Night Lamp ####################
  - platform: mqtt
    name: Night Lamp
    state_topic: "home/nehulroom/nightlamp"
    command_topic: "home/nehulroom/nightlamp"
    payload_on: "on"
    payload_off: "off"
    retain: true
############################### Nehul Room Bathroom ######################  
  
  - platform: mqtt
    name: Bathroom Light
    state_topic: "home/nehulroom/bathroomlight"
    command_topic: "home/nehulroom/bathroomlight"
    payload_on: "on"
    payload_off: "off"
    retain: true
  - platform: mqtt
    name: Bathroom Fan
    state_topic: "home/nehulroom/bathroomfan"
    command_topic: "home/nehulroom/bathroomfan"
    payload_on: "on"
    payload_off: "off"
    retain: true



# Allows you to issue voice commands from the frontend in enabled browsers
conversation:

# Enables support for tracking state changes over time
history:

# View all events in a logbook
logbook:

# Enables a map showing the location of tracked devices
map:

# Track the sun
sun:



#device_tracker:
#    - platform: life360
#      username: "[email protected]"
#      password: "2488"
#      show_as_state: driving, moving, places
#      max_update_wait:
#        minutes: 5
#      interval_seconds: 120
#      add_zones: true
      

# Sensors
sensor:
  # Weather prediction
  - platform: yr

  - platform: darksky
    api_key: "800bada01d9f"
    monitored_conditions: 
      - summary
      - icon
      - temperature
      - apparent_temperature
      - wind_speed
      - temperature_high
      - temperature_low
      - sunrise_time
      - sunset_time
    scan_interval:
        days: 0
        hours: 0
        minutes: 10
        seconds: 0
        milliseconds: 0
  - platform: mqtt
    name: "Balcony Door Battery"
    state_topic: "home/room/balcony_door_battery_percent"
    unit_of_measurement: '%'
    value_template: "{{ value }}"
    icon: mdi:battery-80
  - platform: mqtt
    name: "Balcony Door Voltage"
    state_topic: "home/room/balcony_door_voltage"
    unit_of_measurement: 'v'
    value_template: "{{ value }}"
    icon: mdi:flash


  


# Text to speech
tts:
  - platform: google

# Cloud
cloud:

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml

Any suggestions? Why this is keep happening? I have tried a lot of things but none of them are effective as it should be.

Thank you!

1 Like

Did you manage to resolve this? I have the same problem.

I have to unfortunately install Hassio. Instead of hassbian. Then I got this problem resolved. Also I used the Entity created from PayLoad directly instead of creating it manually. This is helping me to solve this problem easily.

Hi @nehulagr, I am struggling with this problem too, my MQTT sonoff switches do not come back after a server restart. Can you expand on what you meat by:

as all I have done was add the MQTT to the configuration as you showed in the original post.

I somehow missed your reply.

What do you mean with “Entity created from PayLoad directly instead of creating it manually”?