Please set SONOFF basic

I am sorry

I discovered Homeassistant and Sonoff about 2 months ago. You learn slowly with the language barrier. Well, maybe by winter I will be able to learn everything so that I can control the heating.
I apologize once again and promise not to waste the forrum again.

With God

The sonoff basic has no power metering capabilities ? How are you going to measure the voltage ?

I believe what he wants is a boolean return when the device connected is running or not.
That is also why I believe the Sonoff basic is not the correct tool.

Oh, I have a bunch of sonoff basics for that purpose. Sonoff 4 CH Pro that switch on a contacter / teleruptor in the distribution box, sonoff basic to know if the light is on or off.

I am preparing 4x TH-10 for measuring temperature and humidity in 4 rooms and 5x POW for switching and measuring heating and water heating. The electricity distribution company provides me with a lower price of electricity for some time a day and controls it with an electrical impulse that I just need to monitor.

I have Sonoff basic in ESP and I know for sure that sonoff basic with originall firmware can do what I need - after the voltage returns it turns on to the desired state and that’s enough for me. I just don’t know how to set it up in ESP firmware

That’s the way to do it! Be honest and you will see how it kickstarts some help!
Do have a read here;

I have always found this forum the most helpful if you are trying!

Sorry to anyone I may have offended with my last post.

do you have a bad day today ???

Maybe but no more so than most. Always like to help but never like working for nothing!

so don’t work here if thank you, the smile and the joy of those you help are not enough

You could use a binary_sensor to confirm that the device is connected to Home Assistant:

binary_sensor:

  - platform: status
    name: "${friendly_name} Server Status"

You could then start an automation that if the Sonoff is connected it does something:

automation:
  trigger:
    platform: state
    entity_id: binary_sensor.sonoffname_server_status
    from: "off"
    to: "on"

Or if you want the Sonoff to always turn the relay on when power is applied to the Sonoff (restore_mode)

switch:
  - platform: gpio
    pin: GPIO12
    name: "Device Name"
    restore_mode: "ALWAYS_ON"

my default first attempt

binary_sensor:
- platform: gpio
  pin:
    number: GPIO0
    mode: INPUT_PULLUP
    inverted: True
  name: "HDO tlačítko"
  on_press:
    - switch.toggle: relay
- platform: status
  name: "HDO status"


switch:
- platform: gpio
  name: "HDO spínač"
  pin: GPIO12
  id: relay
  restore_mode: "ALWAYS_ON"

You need to watch your formatting otherwise it will not work.
If you want the LED to act as a status you will want something like the following:

esphome:
  name: "device_name"
  platform: ESP8266
  board: esp8285

wifi:
  ssid: wifi_ssid
  password: wifi_password

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: True
    name: "HDO tlačítko"
    on_press:
      - switch.toggle: relay
  - platform: status
    name: "HDO status"

light:

  - platform: binary
    output: status_led
    id: led

switch:
  - platform: gpio
    name: "HDO spínač"
    pin: GPIO12
    id: relay
    restore_mode: "ALWAYS_ON"
    on_turn_on:
      - light.turn_on:
          id: led
    on_turn_off:
      - light.turn_off:
          id: led

output:
  - platform: gpio
    pin:
      number: GPIO13
      inverted: yes
    id: status_led

You could then have an automation that tells you when the device is connected / has power.

automation:
  trigger:
    - platform: state
      entity_id: binary_sensor.hdo_server_status
      to: "on"
  action:
    - service: notify.notify
      data:
        message: Your device has power

yes - thank you - I have no problem with that

Let me probably have a stupid question. Why can’t I see any entity from the switch?

Have you added it in the Integrations page?

Did you add:

api:
  password: password_you_have_set

Full info

Or you could use MQTT

I personally use the native API.

Thank you it is enough but not for those who do not try!

I see…
so here I end …
I’m going back to the forest …
Thank you for your precious time …
I will try to get back the original firmware for the basic R3 or buy a new one

Can’t you just make the changes in ESPHome and re-upload the Firmware?

You can also manually upload your firmware to the Sonoff with a USB cable. For example a FT232 they are about £/€ 4 - 8 off ebay

I can, but I can’t do it alone

I’m preparing myself :slight_smile: