splitbrain.org

electronic brain surgery since 2001

Home Assistant again

Addons

Packages

“”

configuration.yaml
homeassistant:
  packages: !include_dir_named packages/

packages/tts.yaml
tts:
  - platform: picotts
    service_name: tts
    language: "en-US"

notify:
  - platform: tts
    name: tts_kitchen
    tts_service: tts.tts
    media_player: media_player.kitchen_speaker
  - platform: tts
    name: tts_bedroom
    tts_service: tts.tts
    media_player: media_player.bedroom_speaker

HACS

ESPHome

ESPHome

Nous SP111


# Dryer Socket

substitutions:
  devicename: socket-01
  # Higher value gives lower watt readout
  current_res: "0.00238"
  # Lower value gives lower voltage readout
  voltage_div: "755"

esphome:
  name: $devicename
  platform: ESP8266
  board: esp01_1m
 
# Enable logging
logger:

# Enable Home Assistant API
api:

web_server:
  port: 80

ota:
  password: "5da04df1c90b5bf6c2b29589fa2e8222"

wifi:
  ssid: "W00t"
  password: !secret wifi_password
 
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Socket-01 Fallback Hotspot"
    password: "nxMagQ4qAles"

captive_portal:

 
### Initial config based on https://www.esphome-devices.com/devices/Gosund-SP111
 
# see: https://esphome.io/components/time.html
time:
  - platform: homeassistant
    id: homeassistant_time

text_sensor:
  - platform: version
    name: "${devicename} - Version"
    icon: mdi:cube-outline

binary_sensor:
  - platform: status
    name: "${devicename} - Status"
    device_class: connectivity
 
  # toggle relay on/off
  - platform: gpio
    pin:
      number: GPIO13
      mode: INPUT_PULLUP
      inverted: True
    id: "button_state"
    on_press:
      - switch.toggle: button_switch
 
  # State Sensor
  - platform: template
    name: "${devicename} - Running"
    filters:
      - delayed_off: 15s # drop below for at least 15s to trigger off
      - delayed_on: 60s  # rise above for at least 60s to trigger on
    lambda: |-
      if (isnan(id(power_wattage).state)) {
        return {};
      } else if (id(power_wattage).state > 5) {
        // Running
        return true;
      } else {
        // Not running
        return false;
      }

sensor:
  - platform: wifi_signal
    name: "${devicename} - Wifi Signal"
    update_interval: 60s
    icon: mdi:wifi

  - platform: uptime
    name: "${devicename} - Uptime"
    update_interval: 60s
    icon: mdi:clock-outline

  - platform: total_daily_energy
    name: "${devicename} - Todays Usage"
    power_id: "power_wattage"
    filters:
      # Multiplication factor from W to kW is 0.001
      - multiply: 0.001
    unit_of_measurement: kWh
    icon: mdi:calendar-clock

  - platform: adc
    pin: VCC
    name: "${devicename} - VCC Volt"
    icon: mdi:flash-outline

  - platform: hlw8012
    sel_pin:
      number: GPIO12
      inverted: True
    cf_pin: GPIO05
    cf1_pin: GPIO04
    change_mode_every: 4
    current_resistor: ${current_res}
    voltage_divider: ${voltage_div}
    update_interval: 3s

    current:
      name: "${devicename} - Ampere"
      unit_of_measurement: A
      accuracy_decimals: 3
      icon: mdi:current-ac

    voltage:
      name: "${devicename} - Volt"
      unit_of_measurement: V
      accuracy_decimals: 1
      icon: mdi:flash-outline

    power:
      name: "${devicename} - Watt"
      unit_of_measurement: W
      accuracy_decimals: 0
      id: "power_wattage"
      icon: mdi:gauge

status_led:
  pin:
    number: GPIO02
    inverted: True
  id: led_blue

output:
  - platform: gpio
    pin: GPIO00
    inverted: true
    id: led_red

switch:
  - platform: template
    name: "${devicename} - Switch"
    icon: mdi:power
    optimistic: true
    id: button_switch
    turn_on_action:
      - switch.turn_on: relay
    turn_off_action:
      - switch.turn_off: relay
  - platform: gpio
    pin: GPIO15
    id: relay

Tuya ConvertMigrating from Tasmota

Node-RED

Lovelace

Comments