Monday, May 24, 2021

Monitoring Dryer using Home Assistant

We have a dryer in the garage which uses a sensor to determine if the clothes have been dried to the specified setting before deciding to continue drying or stop drying. Since the length of drying depends on the load size and type, it is difficult to predict how much time this takes. To prevent creasing, we prefer putting our clothes on hangers as soon as the drying is done. This means that we may have to make multiple trips to the garage to see if the dryer is done. This is a pain and we have had several occasions where we forgot to empty the dryer as soon as it was done. We needed a way to alert us in the house when the dryer is done and the load is ready.
 
I am already running a Home Assistant solution at home for automating various tasks. Along with various lights, cameras, trigger buttons and sensors, we also extensively use wifi plugs running Tasmota to switch on/off various electric devices at home. The wifi plugs include an energy monitor which let me know the amount of current or the power consumed by the device being served by the plug. I used this feature to implement my automation.
 
The dryer consumes approximately 2000 W of electricity when actively drying clothes. It consumes barely a Watt of energy when it is done with drying - this can be a short pause while it uses the sensor to determine the humidity level within the drum or a much longer wait after it is done drying and starts beeping to indicate that the drying is done.
 
We first translate this power consumption to a dryer 'mode'. To achieve this, I use a template sensor in home assistant.
 
For ease of maintenance, I have separated out my template sensors configuration. I do this my adding the following line to config/configuration.yaml 

sensor: !include sensor.yaml


 
ie. I ask home assistant to include the config/sensor.yaml file into the configuration.

My config/sensor.yaml file contains the following entries for the dryer sensor.

- platform: template
  sensors:
    dryer:
      friendly_name: "Dryer"
      value_template: >-
        {% if states('sensor.gosund8_energy_power')|int > 10 %}
          On
        {% elif states('sensor.gosund8_energy_power')|int > 0 %}
          StandBy
        {% else %}
          Off
        {% endif %}

In my case, I can read the power consumption of my wifi plug at "sensor.gosund8_energy_power". To determine this entity name, lookup the device under Configuration->Devices. Look for "DEVICE_NAME ENERGY Power". Click on it and read the entity id. My device name is Gosund8, so I lookup the device and click on "Gosund8 ENERGY Power" which has entity id: sensor.gosund8_energy_power.
 
The new template sensor above adds a template sensor dryer. Here I use an ifcondition here which checks the value of sensor.gosund8_energy_power. If the value is above 10, return On. If not above 10 but value above 0, it means that the dryer is not actively drying - return StandBy. Else report that the dryer is not running. This includes the condition where the device has been switched off at the plug and is no longer available.
 
I am now able to read the dryer mode at the entity "sensor.dryer". The value for this entity is set to On, StandBy, Off as mentioned above according to the criteria we set.
 
I can also read this sensor value on my dashboard where I have the following entry. 

  - type: button
    tap_action:
      action: none
    entity: sensor.dryer
    show_state: true
    hold_action:
      action: none

 


 


Finally I have an automation set up which is trigerred when the state of this entity transitions from On to StandBy and has been at StandBy for 5 minutes. To do this, I use the Trigger Type -> State when setting the trigger for the automation.
 
The yaml below captures the settings I use. 

- id: '1613076004832'
  alias: 'Dryer: Check if done'
  description: ''
  trigger:
  - platform: state
    entity_id: sensor.dryer
    from: 'On'
    to: StandBy
    for: 00:05:00
  condition: []
  action:
  - service: media_player.volume_set
    data:
      volume_level: 0.5
    target:
      entity_id:
      - media_player.living_room_speaker
  - service: tts.google_say
    data:
      entity_id:
      - media_player.living_room_speaker
      message: Dryer Done.  Move the Laundry
      cache: true
  mode: single

 
In my house, we have google home setup. I use this to give us an indication when the drying cycle is completed. I simply read out a message on my google home in my living room indicating that the dryer is done and the laundry can be picked. You can also your other actions such as switching a particular light on, sending your phone app a notification, etc.


Setting a frost alarm on Home assistant

One of the issues with winter is the possibility of ice covering your windscreen which needs to be cleared before you can drive. Clearing ou...