Sonoff via Ewelink

https://community.home-assistant.io/t/control-sonoff-devices-with-ewelink-original-firmware-over-lan-and-or-cloud/167567

Github scripts and installation instructions    https://github.com/AlexxIT/SonoffLAN

Create a directory in the Home Assistant config directory, and copy the Sonoff python scripts there.

custom_components     └── sonoff     see screenshot below

In configuration.yaml


sonoff:

  username: xxxxx

  password: xxxxx

  force_update: [temperature, power]

  scan_interval: '00:05:00'

  sensors: [temperature, humidity, power, current, voltage]

  grace_period: 600

  api_region: 'eu'

  entity_prefix: True

  debug: False


Add the switches to the lovelace interface by adding or editing an entity card

Create a thermostat for bathroom electric heater with the Sonoff  switch

climate:

  - platform: generic_thermostat

    name: temperatuur_badk

    heater: switch.sonoff_10004b23ed

    target_sensor: sensor.sonoff_10004b23ed_temperature

    min_temp: 0

    max_temp: 30

    ac_mode: false

    target_temp: 0

    cold_tolerance: 0.3

    hot_tolerance: 0

    min_cycle_duration:

      seconds: 10

    initial_hvac_mode: "off"