How to combine Sonoff ZBMINI with Zigbee smart bulb

I dont know if i messed up something but here is what i have so far:

substitutions:
  device_name: kitchen_sonoff_mini
  device_friendly_name: Kitchen Sonoff Mini Switch
  device_ip: 192.168.5.13
  light_id: light.kitchen_lights
  button_gpio: GPIO00
  led_status_gpio: GPIO13
  relay_gpio: GPIO12
  
esphome:
  name: ${device_name}
  platform: ESP8266
  board: esp01_1m # esp8285

# Enable logging
logger:

# Enable Web server
web_server:
  port: 80

# Enable Home Assistant API
api:
#  password: "!secret api_password"
#  reboot_timeout: 15min / 0s

# Enable Over The Air update
ota:
#  password: !secret ota_password

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  #reboot_timeout: 0s # Disable reboots for when Home Assistant is offline for an extended time.
  manual_ip:
    static_ip: ${device_ip}
    gateway: 192.168.5.1
    subnet: 255.255.255.0
  #domain: .localdomain

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Kitchen-Sonoff-Mini"
    password: !secret ap_password

captive_portal:

# the web_server & sensor components can be removed without affecting core functionaility.

#time:
#  - platform: homeassistant
#    id: homeassistant_time

sensor:
# Extra sensor to keep track of uptime
  - platform: uptime
    name: ${device_name} Uptime Sensor
    filters:
      - lambda: return x / 3600;
    unit_of_measurement: "hours"
    accuracy_decimals: 2

# Extra sensor for WiFi signal
  - platform: wifi_signal
    name: ${device_name} Wifi Signal Strength
    update_interval: 900s

#######################################
# Device specific Config Begins Below #
######################################

binary_sensor:
  # the lines below define the reset button
  - platform: gpio
    pin: $button_gpio
    id: ${device_name}_button
    internal: true
    filters:
      - invert:
      - delayed_off: 10ms
    on_press:
      - switch.toggle: 
          id: relay_1
          
  # the lines below toggle the main relay on command
  - platform: gpio
    name: ${device_name}_status
    pin: GPIO04
    id: switch_1
    on_state:
      - script.execute: hass_light_toggle
    #on_press:
    #  then:
    #    - switch.toggle:
    #        id: relay_1
    #on_release:
    #  then:
    #    - switch.toggle:
    #        id: relay_1
switch:
  - platform: gpio
    name: ${device_friendly_name} 
    icon: "mdi: lightbulb_outline"
    pin: $relay_gpio
    id: relay_1
    restore_mode: restore_default_off #ALWAYS_ON

status_led:
  pin:
    number: $led_status_gpio
    inverted: true

output:
  - platform: esp8266_pwm
    id: blue_led
    pin: $led_status_gpio
    inverted: true

light:
  # the 4 lines below define the Blue LED light on Sonoff Mini, to expose in HomeAssistant remove line "internal: true"
  - platform: monochromatic
    name: ${device_name}_blueled
    output: blue_led
    internal: true # hides the Blue LED from HomeAssistant

script:
  - id: hass_light_toggle
    then:
      if:
        condition:
          api.connected:
        then:
          - if:
              condition:
                switch.is_off: relay_1
              then:
                # Turn the relay back on and turn on the light.
                - switch.turn_on: relay_1

                - homeassistant.service:
                    service: light.turn_on
                    data:
                      entity_id: $light_id
              else:
                # Have Home Assistant toggle the light.
                - homeassistant.service:
                    service: light.toggle
                    data:
                      entity_id: $light_id
        else:
          # When HA is unavailable, toggle the relay.
          - switch.toggle: relay_1
1 Like

Did anyone achieve this with a zigbee switch/relay?

Has anyone been able to flash the Sonoff ZBMINI?

Where do you find updated firmware ?

I dont think there is an alternative HW. I went with shellies in the end although I would have preferred a zigbee device but sadly I could find one that would allow for esphome etc. to flash to the device

I purchased the ZBMINI hoping to use a zigbee device with ESPHome for a smart bulb. Just like the OP, I wanted to configure a fallback in case HA couldn’t be reached. Oh well, probably going to grab a few of the newer Shelly Plus 1PMs now

ESPHome etc only works with ESP-based devices, that is WiFi only. You won’t find Zigbee devices that work with EspHome.

hey, would this work for the no-neutral version of this relay?

Variation on this topic - I’m adding the zbMinis to the HUE BRIDGE and then have Hue added to HA. My goal is similar - i want light control to work even if HA is down (clearly it won’t work if the Hue network is down, but I mess around much less with that one). I know this is a year old but i will update soon if this works well and if the zbmini button switch presses are exposed to HA via Hue Bridge Integration.

For those who don’t like the click: I contacted SONOFF support if they would be open to add the “detach relais” feature like Shelly it has… or if they even are open to create a new, smaller product without the relais. So… if you’re interested in that, please write to the SONOFF support as well to create some more requests about that and raise the awareness. Thanks!