Etekcity Voltson read outs

I have spent hours browsing the web for information on how to code my Voltsons into my UI. With finding help from Phil Hawthorn that worked for me. The Entities that have the ** ** around them is what you will want to change to change to your Volson’s name. And to change your cost calculations you’ll want to change 0.2300 to what you’re paying.

Config:

input_select:
  dishwasher_status:
    name: Dishwasher Status
    options:
      - Dirty
      - Running
      - Drying
      - Clean
    initial: Dirty
  washing_machine_status:
    name: Washing Machine Status
    options:
      - Idle
      - Running
      - Finishing
      - Clean
    initial: Idle 

automation:


# When we detect power being drawn from the dishwasher,
# mark the dishwasher as using power

- alias: Set dishwasher active when power detected
  trigger:
    - platform: numeric_state
      entity_id: **sensor.dish_washer_switch_watts**  
      above: 5.0
  condition:
    condition: or
    conditions:
      - condition: state
        entity_id: input_select.dishwasher_status
        state: Dirty
      - condition: state
        entity_id: input_select.dishwasher_status
        state: Clean
      - condition: state
        entity_id: input_select.dishwasher_status
        state: Drying
  action:
    - service: input_select.select_option
      data:
        entity_id: input_select.dishwasher_status
        option: Running

# When the power level drops below 10, and the Dishwasher is set to
# the 'Running' state, mark the Dishwasher as Finished

- alias: Set dishwasher drying when power drops
  trigger:
    - platform: numeric_state
      entity_id: **sensor.dish_washer_switch_watts**
      below: 10.0
  condition:
    condition: and
    conditions:
      - condition: state
        entity_id: input_select.dishwasher_status
        state: Running
  action:
    - service: input_select.select_option
      data:
        entity_id: input_select.dishwasher_status
        option: Drying

# Once the dishwasher status has been 'Drying' for 30 minutes, mark the
# dishwasher as clean

- alias: Set dishwasher clean
  trigger:
    - platform: state
      entity_id: input_select.dishwasher_status
      to: Drying
      for:
        minutes: 15
  condition:
    condition: and
    conditions:
      - condition: state
        entity_id: input_select.dishwasher_status
        state: Drying
  action:
    - service: input_select.select_option
      data:
        entity_id: input_select.dishwasher_status
        option: Clean

# When the power drops and the dishwasher is Clean or Drying, someone has
# turned the Dishwasher off and emptied it. We should do this when the state
# of the Dishwasher is clean or Finishing, just incase someone opens the
# Dishwasher before the 30 minute timeout has been reached.

- alias: Set Dishwasher dirty when power off
  trigger:
    - platform: numeric_state
      entity_id: **sensor.dish_washer_switch_watts**
      below: 3.0
  condition:
    condition: and
    conditions:
      - condition: numeric_state
        entity_id: sensor.dish_washer_switch_watts
        below: 1.5
      - condition: or
        conditions:
        - condition: state
          entity_id: input_select.dishwasher_status
          state: Clean
        - condition: state
          entity_id: input_select.dishwasher_status
          state: Drying
  action:
    - service: input_select.select_option
      data:
        entity_id: input_select.dishwasher_status
        option: Dirty



# When power is detected, and the washing machine is not in 
# the Running state, change the status of the washing machine
# to Running. 
# The status check will ensure we don't try to put the state 
# to Running each time the power level changes, and we're already
# in the Running state.

- alias: Set washing machine active when power detected
  trigger:
    - platform: numeric_state
      entity_id: **sensor.washing_machine_switch_watts**
      above: 5.0
  condition:
    condition: or
    conditions:
      - condition: state
        entity_id: sensor.washing_machine_status
        state: Idle
      - condition: state
        entity_id: sensor.washing_machine_status
        state: Clean
      - condition: state
        entity_id: sensor.washing_machine_status
        state: Finishing
  action:
    - service: input_select.select_option
      data:
        entity_id: input_select.washing_machine_status
        option: Running

# When the power drops, move the state of the washing machine to 
# Finishing.

- alias: Set washing machine finished when power drops
  trigger:
    - platform: numeric_state
      entity_id: **sensor.washing_machine_switch_watts**
      below: 3.0
  condition:
    condition: and
    conditions:
      - condition: state
        entity_id: input_select.washing_machine_status
        state: Running
  action:
    - service: input_select.select_option
      data:
        entity_id: input_select.washing_machine_status
        option: Finishing

# Wait 8 minutes for us to be in the Finishing state before we
# decide the washing machine has finished. This way, if the 
# washing machine is in between cycles and the power drops, we 
# won't mark the washing machine cycle as finished too early.

- alias: Set washing machine clean after timeout
  trigger:
    - platform: state
      entity_id: input_select.washing_machine_status
      to: Finishing
      for:
        minutes: 8
  condition:
    condition: and
    conditions:
      - condition: state
        entity_id: input_select.washing_machine_status
        state: Finishing
  action:
    - service: input_select.select_option
      data:
        entity_id: input_select.washing_machine_status
        option: Clean



Sensor

# Voltson Switches
- platform: template
  sensors:

      washing_machine_switch_watts:
        friendly_name_template: "{{ states.switch.**washing_machine**.name}} Current Use"
        value_template: '{{ states.switch.**washing_machine**.attributes["current_power_w"] | float }}'
        unit_of_measurement: 'W'
      washing_machine_switch_total_kwh_mth:
        friendly_name_template: "{{ states.switch.**washing_machine**.name}} Monthly Use"
        value_template: '{{ states.switch.**washing_machine**.attributes["monthly_energy_total"] | float }}'
        unit_of_measurement: 'kWh/mth'
      washing_machine_switch_volts:
        friendly_name_template: "{{ states.switch.**washing_machine**.name}} Voltage"
        value_template: '{{ states.switch.**washing_machine**.attributes["voltage"] | float }}'
        unit_of_measurement: 'V'
      washing_machine_switch_today_kwh:
        friendly_name_template: "{{ states.switch.**washing_machine**.name}} Today's Use"
        value_template: '{{ states.switch.**washing_machine**.attributes["today_energy_kwh"] | float }}'
        unit_of_measurement: 'kWh'  

      dish_washer_switch_watts:
        friendly_name_template: "{{ states.switch.**dish_washer**.name}} Current Use"
        value_template: '{{ states.switch.**dish_washer**.attributes["current_power_w"] | float }}'
        unit_of_measurement: 'W'
      dish_washer_switch_total_kwh_mth:
        friendly_name_template: "{{ states.switch.**dish_washer**.name}} Monthly Use"
        value_template: '{{ states.switch.**dish_washer**.attributes["monthly_energy_total"] | float }}'
        unit_of_measurement: 'kWh/mth'
      dish_washer_switch_volts:
        friendly_name_template: "{{ states.switch.**dish_washer**.name}} Voltage"
        value_template: '{{ states.switch.**dish_washer**.attributes["voltage"] | float }}'
        unit_of_measurement: 'V'
      dish_washer_switch_today_kwh:
        friendly_name_template: "{{ states.switch.**dish_washer**.name}} Today's Use"
        value_template: '{{ states.switch.**dish_washer**.attributes["today_energy_kwh"] | float }}'
        unit_of_measurement: 'kWh'
        
      total_consumption:
        friendly_name: 'Total Usage'
        value_template: '{{ (states.switch.**dish_washer**.attributes["monthly_energy_total"] | float + states.switch.**washing_machine**.attributes["monthly_energy_total"] | float) |round(2)}}'
        unit_of_measurement: 'kWh/mth'
      total_cost:
        friendly_name: 'Total Cost'
        value_template: '${{ (((states.switch.**dish_washer**.attributes["monthly_energy_total"] | float |round(2) + states.switch.**washing_machine**.attributes["monthly_energy_total"] | float |round(2) ) * 0.2300)|round(2) )}}'
        #unit_of_measurement: '$'        
        
      dishwasher_cost:
        entity_id: switch.dish_washer
        friendly_name: 'Dishwasher Cost'
        value_template: >-
          {% if (states.switch.**dish_washer**.attributes["monthly_energy_total"]|float > 0) %}
            ${{ (states.switch.**dish_washer**.attributes["monthly_energy_total"]|float * 0.2300)|round(2) }}
          {% elif (states.switch.**dish_washer**.attributes["monthly_energy_total"]|float == 0) %}
            ${{ (states.switch.**dish_washer**.attributes["monthly_energy_total"]|float * 0.2300)|round(2) }}
          {% endif %}
          
      washing_machine_cost:
        entity_id: switch.washing_machine
        friendly_name: 'Washing Machine Cost'
        value_template: >-
          {% if (states.switch.**washing_machine**.attributes["monthly_energy_total"]|float > 0) %}
            ${{ (states.switch.**washing_machine**.attributes["monthly_energy_total"]|float * 0.2300)|round(2) }}
          {% elif (states.switch.**washing_machine**.attributes["monthly_energy_total"]|float == 0) %}
            ${{ (states.switch.**washing_machine**.attributes["monthly_energy_total"]|float * 0.2300)|round(2) }}
          {% endif %}