Any guess why Home Assistant can’t see the ESPHome entities for this device?
I have a PIR on a Sonoff Basic that has been working for a couple of years.
And yesterday it stopped working. Coincident, possibly, with my router replacement, but
I don’t see how.
I have in the yaml code:
web_server:
port: 80
From the web page I can turn the relay on and off.
And I can see the PIR going on and off when someone walks into the PIR range.
I re-flashed the ESP OTA- no problem.
But, I can’t see the entities in Home Assistant and the automation to turn on
the relay for a few minutes won’t trigger.
Unless someone has a better idea, I can delete the device and start over with a new discovery, then fix the “_2” mess in the automation.
Here is my device yaml file:
## closet.pir ##
# Sonoff Basic in my office closet with a PIR sensor on GPIO14
substitutions:
device_name: closet-pir
friendly_name: closet_pir
packages:
wifi: !include common/wifi.yaml
device_base: !include common/esp8266.yaml
web_server:
port: 80
#=================================================================
switch:
- platform: gpio
name: ${friendly_name} Relay
pin:
number: GPIO12
mode: output
id: relay
- platform: restart
name: ${friendly_name} Restart
- platform: gpio
name: ${friendly_name} LED
pin:
number: GPIO13
mode: output
inverted: True
id: led
binary_sensor:
- platform: gpio
pin:
number: GPIO14 # PIR Sensor
inverted: False
#mode: INPUT_PULLUP
name: ${friendly_name} PIR
device_class: motion
# Turn on the LED when the PIR detects motion.
on_press:
- switch.turn_on: led
on_release:
- switch.turn_off: led
text_sensor:
# Get the uptime
- platform: template
name: ${friendly_name} Uptime
id: uptime_human
icon: mdi:clock-start
sensor:
# Uptime sensor.
- platform: uptime
name: ${friendly_name} Uptime Epoch
- platform: uptime
name: ${friendly_name} Human Uptime Sensor
id: uptime_sensor
update_interval: 60s
on_raw_value:
then:
- text_sensor.template.publish:
id: uptime_human
state: !lambda |-
int seconds = round(id(uptime_sensor).raw_state);
int days = seconds / (24 * 3600);
seconds = seconds % (24 * 3600);
int hours = seconds / 3600;
seconds = seconds % 3600;
int minutes = seconds / 60;
seconds = seconds % 60;
return (
(days ? String(days) + "d " : "") +
(hours ? String(hours) + "h " : "") +
(minutes ? String(minutes) + "m " : "")
).c_str();