Skip to content
Snippets Groups Projects
Select Git revision
  • 21929857e59c8fe48a495cdc1b6cd7dcbc873c3c
  • main default protected
  • growscreen
3 results

nous_a1t.yaml

Blame
  • nous_a1t.yaml 1.61 KiB
    substitutions:
      current_res: "0.00280" # Higher value gives lower watt readout
      voltage_div: "775" # Lower value gives lower voltage readout
    
    esp8266:
      board: esp8285
    
    light:
      - platform: status_led
        id: led_status
        pin:
          number: GPIO13
          inverted: true
    
    binary_sensor:
      # toggle relay on/off
      - platform: gpio
        id: button_state
        pin:
          number: GPIO00
          mode: INPUT_PULLUP
        on_press:
          - switch.toggle: power
    
    switch:
      - platform: template
        name: "Power"
        optimistic: true
        id: power
        lambda: |-
          if (id(relay).state) {
            return true;
          } else {
            return false;
          }
        turn_on_action:
          - switch.turn_on: relay
          - light.turn_on: led_status
        turn_off_action:
          - switch.turn_off: relay
          - light.turn_off: led_status
      - platform: gpio
        id: relay
        pin: GPIO14
    
    sensor:
      - platform: total_daily_energy
        name: "Daily Consumption"
        power_id: watt
        filters:
          # Multiplication factor from W to kW is 0.001
          - multiply: 0.001
        unit_of_measurement: kWh
    
      - platform: adc
        pin: VCC
        name: "VCC Volt"
    
      - platform: hlw8012
        sel_pin:
          number: GPIO12
          inverted: True
        cf_pin: GPIO04
        cf1_pin: GPIO05
        change_mode_every: 4
        current_resistor: ${current_res}
        voltage_divider: ${voltage_div}
        update_interval: 3s
    
        current: