I have a Sonoff Mini (ESP8266) plugged into a GFI outlet in my basement. (The purpose is to monitor when the GFI trips).
The yaml file has
web_server:
port 80:
I can edit and upload to the Sonoff wirelessly.
I can control the Sonoff (on/off).
But it presents in /developer tools/states as “Unavailable”
Here is the device yaml file, and following that are my two packages. (I use packages for the code that appears in all of my yaml files. It greatly reduces clutter).
substitutions:
device_name: gfi
friendly_name: gfi
packages:
wifi: !include common/wifi.yaml
device_base: !include common/esp8266.yaml
status_led:
pin:
number: 13
web_server:
port: 80
##############################
# Sonoff Basic peripherals
# Virtual switch GPI12
switch:
- platform: gpio
name: ${device_name}
pin:
number: 12
mode: output
id: relay12
restore_mode: always on
binary_sensor:
- platform: status
name: ${device_name} Status
# Physical Button on GPIO0
- platform: gpio
pin:
number: 0
inverted: False
mode: INPUT_PULLUP
name: ${device_name} button
internal: true
on_press:
- switch.toggle: relay12
# Physical Button on GPIO14
- platform: gpio
pin:
number: 14
inverted: False
mode: INPUT_PULLUP
name: ${device_name} GPIO14 Button
on_press:
then:
- switch.toggle: relay12
on_release:
then:
- switch.toggle: relay12
This is the esp8266.yaml package:
################################################
#esp8266
#
#Useage:
#packages:
# wifi: !include common/wifi.yaml
# device_base: !include common/esp8266.yaml
#
#In the project file, you can override the default board type.
#For example:
#esp8266:
# board: esp01_1m #Sonoff Basic and Mini (DEFAULT)
# board: d1_mini #Wemos D1 Mini
# board: nodemcuv2 #NodeMCU
#
################################################
esphome:
name: ${device_name}
esp8266:
board: esp01_1m
framework:
version: recommended
# Logger level "debug" is needed to get 1-Wire addresses, like the ds18b20.
logger:
level: DEBUG
api:
ota:
safe_mode: True
This is the wifi.yaml package:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
sensor:
- platform: wifi_signal
name: ${friendly_name} WiFi Level
id: ${friendly_name}_WiFi_level
update_interval: 300s
# Get the WiFi details
text_sensor:
- platform: wifi_info
ip_address:
name: ${friendly_name} IP
ssid:
name: ${friendly_name} SSID
mac_address:
name: ${friendly_name} Mac Address
This particular Sonoff Basic has been working for many months. The only change is that I changed to a new router. I don’t think that is my problem since I can upload to it and control it through the web interface.
Any ideas would be appreciated.