Your favourite automations

I’m looking for some inspiration on what to do next, and was wondering:

###What’s your favourite automations?

I have some simple ones that makes my life a tiny bit better:

  • The morning coffee switch - if I prepare my coffee machine in the evening, I can turn on this switch one and it has the coffee ready for me and sends me a notification at a specific time in the morning. Simple, I know, but I like it.
  • Alerts for when the washing machine finishes a program - via speech and push notifications.
  • Switch off the coffe machine after its been on for ~20 minutes, so I never have to worry about that one again.
6 Likes

Like you mine are pretty simple but make life a bit easier/nicer.

First one is having the lamps come on when someone arrives home after dark or its getting dark.

  - alias: "Lamps on when home"
    trigger:
      platform: state
      entity_id: sensor.garage_door_status
      to: 'open'
    condition:
      condition: or
      conditions:
        - condition: template
          value_template: "{{ states.sun.sun.attributes.elevation  | int < 10 }}"
        - condition: sun
          after: sunset
        - condition: sun
          before: sunrise
    action:
      service: homeassistant.turn_on
      entity_id: group.living_room_lamps

Second is a pretty simple one. My HTPC is normally off to save power. However, if it is on, the TV and amplifier need to be on other wise the computer is pretty useless. The WOL switch for the HTPC is tied into Alexa so with “Alexa turn on the computer” the computer boots and the TV and the amp automatically turn on.

  - alias: "TV on With Computer"
    trigger:
      platform: state
      entity_id: device_tracker.782bcb9f60cd
      to: 'home'
    action:
      - service: switch.turn_on
        entity_id: switch.edimax2
      - service: switch.turn_on
        entity_id: switch.edimax1
1 Like

I really like notifications for watering my plants and simply making sure all lights are off if no one is home. Also, motion activated lights are nice.

@silvrr

Super interested in your automation (pasted below). My fiancée has her desktop computer connected to our stereo audio receiver and TV. We generally play most shows/movies off of her computer unless we use the Chromecast.

Anyway, the TV is a LG LED HDTV that doesn’t support HDMI-CEC. Any idea how I could accomplish a similar automation?

Thanks!

 - alias: "TV on With Computer"
    trigger:
      platform: state
      entity_id: device_tracker.782bcb9f60cd
      to: 'home'
    action:
      - service: switch.turn_on
        entity_id: switch.edimax2
      - service: switch.turn_on
        entity_id: switch.edimax1
    condition:
      condition: or
      conditions:
        - condition: template
          value_template: "{{ states.sun.sun.attributes.elevation  | int < 10 }}"
        - condition: sun
          after: sunset

Can I ask why do this please? Why both? I cannot get my head around it, as my favourite automation is similar but using just after sunset.

My favorites:

  • Turn on the computer just before I get home (and lights, depending on the sun’s position)
  • Turn the thermostat up and down in steps based on proximity (with Owntracks on my phone)
  • Dim the lights when I’m watching a show on my TV through Netflix/Plex/Chromecast.
  • Turn off appliances when I leave my home.
  • Pause any media playing and mute sound whenever I get a phone call (includes the use of Tasker, MQTT and EventGhost)
1 Like

I have both in there as when I initially set it up I wasn’t sure how the value template would handle a negative number. I think I can get rid of the sunset condition and it will work fine, but I need to test it the dev tool after sunset sometime. If it does handle the negative number OK I could get rid of the sunrise condition also.

Is it a smart TV? There are two components for LG TVs.

If its a dumb TV the and doesn’t support CEC the only two ways I know of are to wire in a relay to the power switch and use something like a NodeMCU to trigger the relay. The other (and what I use) is just a Wifi outlet to cut the power turn it back on. A word of caution through, electroics don’t like their power cut like this, some will show no effect even over long periods, others it can cause issues quickly. Both my TV and my AMP are old and if they kick the bucket I won’t be sad when I get to pick up a new “smart” model that I can properly integrate.

1 Like

I have one, I find useful:

IF I am at work AND the traffic is heavier than normal THEN notify me just before 5pm

4 Likes

thanks Silvrr, interesting… I might change mine to use the same.

I love this one:

- alias: Lights out if not home
trigger:
- platform: state
  entity_id: group.family
  state: 'not_home'
action:
service: light.turn_off

And also this one :wink:

- alias: Light when i get home
  trigger:
  - platform: state
    entity_id: group.all_devices
    state: 'home'
  - platform: sun
    event: sunset
  condition:
   condition: and
   conditions:
     - condition: state
       entity_id: group.all_devices
       state: 'home'
     - condition: sun
       after: sunset
     - condition: time
       after: '07:00:00'
       before: '22:00:00'
  action:
    service: light.turn_on

The Condition “time” is to prevent to get my Eyes lasered in the middle of the night, when my girlfriends phone reconnects to the wifi :wink:

actually my favourite one is my motion detection in the bathroom, if the LUX is below xx turn on all 4 hue gu10s lights full with motion before midnight.
Between midnight and sunrise, only turn on the 1 hue GU10 which is over the toilet at 5% with motion, so not blinded when going for a old man night pee.

Cannot post code as i am at work :frowning:

My favorite automation is the one I use to dim the bathroom lights at bedtime (11:00 pm) until sunrise. This way, if I get up in the middle of the night to go use the bathroom, I’m not blinded by the brightness of the lights, which are (5) 60w-equivalent dimmable LED bulbs.

Because I am using the GE 12724 dimmer, the switch won’t accept a value change unless the light actually is actually on. So the automations turn the light on to the desired brightness, wait 1 second, then turn it off. The wall switch simply recalls the last-used brightness setting by default. In order to make this work, I have the lights adjust to 1% (3/255) at 11:00 pm. At sunrise, they are restored to 100% (255/255). Both automations utilize an input boolean switch such that if the bathroom light is on, the automations will be delayed until 10 seconds after the light is turned off.

Here are my YAML files to make this work:

automations_bathroom_2300_light_off.yaml

alias: "bathroom_2300_light_off"
trigger:
  platform: state
  entity_id: light.bathroom_light_level_2_0
  from: 'on'
  to: 'off'
condition:
  condition: and
  conditions:
    - condition: time
      after: "23:00:00"
    - condition: state
      entity_id: input_boolean.bathroom_light_in_use
      state: 'on'
action:
  - service: homeassistant.turn_off
    entity_id: input_boolean.bathroom_light_in_use
  - service: logbook.log
    data:
      name: "Automation Triggered: "
      message: "bathroom_2300_light_off"

automations_bathroom_2300_light_off.yaml

alias: "bathroom_2300_light_on"
trigger:
  platform: time
  after: "23:00:00"
condition:
  condition: state
  entity_id: light.bathroom_light_level_2_0
  state: 'on'
action:
  - service: homeassistant.turn_on
    entity_id: input_boolean.bathroom_light_in_use
  - service: logbook.log
    data:
      name: "Automation Triggered: "
      message: "bathroom_2300_light_on"

automations_bathroom_2300_scene.yaml

alias: "bathroom_2300_scene"
trigger:
  platform: time
  after: "23:00:00"
condition:
  condition: state
  entity_id: light.bathroom_light_level_2_0
  state: 'off'
action:
  - service: scene.turn_on
    entity_id: scene.scenes_bathroom_on_3
  - delay: '00:00:01'
  - service: scene.turn_on
    entity_id: scene.scenes_bathroom_off
  - service: logbook.log
    data:
      name: "Automation Triggered: "
      message: "bathroom_2300_scene"

automations_bathroom_2300_scene_delayed.yaml

alias: "bathroom_2300_scene_delayed"
trigger:
  platform: state
  entity_id: input_boolean.bathroom_light_in_use
  from: 'on'
  to: 'off'
condition:
  condition: time
  after: "23:00:00"
action:
  - delay: '00:00:10'
  - service: scene.turn_on
    entity_id: scene.scenes_bathroom_on_3
  - delay: '00:00:01'
  - service: scene.turn_on
    entity_id: scene.scenes_bathroom_off
  - service: logbook.log
    data:
      name: "Automation Triggered: "
      message: "bathroom_2300_scene_delayed"

scenes_bathroom_off.yaml

- name: scenes_bathroom_off
  entities:
    light.bathroom_light_level_2_0:
      state: 'off'

scenes_bathroom_on_3.yaml

- name: scenes_bathroom_on_3
  entities:
    light.bathroom_light_level_2_0:
      state: 'on'
      brightness: 3

scenes_bathroom_on_255.yaml

- name: scenes_bathroom_on_255
  entities:
    light.bathroom_light_level_2_0:
      state: 'on'
      brightness: 255
2 Likes

What do you use for the washing machine? Current or vibration?

One solution could be to emulate a remote control using an ir module and the lirc tools on a raspberry. Once it is set up you can send ir commands like this:

irsend send_once mytvconfig key_power

I am checking the power consumption (W).

- alias: Tvätten klar
  trigger:
    - platform: numeric_state
      entity_id: sensor.tvattmaskin_power_23_8
      below: 2.0
...
1 Like

Yeah, that was what I meant with “current” :slight_smile:
I was hoping vibration, since that’s what I want to do.
(Och hej förresten)

@silvrr – The LG TV is LG Electronics 43LH5000 43-Inch 1080p LED TV (2016 Model).

It doesn’t appear to have any sort of CEC/LG SimpLink or whatever they call it.

The NodeMCU trigger wouldn’t face the same issues of potential damage to the TV as the outlet switch, right?

Thanks!

The Node MCU option would be to wire the relay into the power switch of the TV, this isn’t cutting the power, just simulating a button press with a relay.

A much better option was mentioned above (it was early and I didn’t have coffee yet apparently) was to use a IR transmitter. There are a number of options and this allows you to control things without hacking them up or risking the power circuitry.

I believe the broadlink devices have a good following in HA.

[quote=“teachingbirds, post:16, topic:15389”]
Yeah, that was what I meant with “current” :slight_smile:I was hoping vibration, since that’s what I want to do.(Och hej förresten)
[/quote]Hej. I am pretty sure I have seen some projects using an arduino+accelerometer+wifi to do what you want, but I couldn’t find anything when I did a quick search. If you check for vibrations you also have to consider the parts of the cycle when the washing machine is relatively still (filling up water, heating up, etc).

Checking the current is easier, and it works the same way no matter what program the washing machine is using, so I went that route instead.

Here are a few of my favourite automations :slight_smile:

  1. Turn on/off lights and music depending on time of day and motion in bathrooms.
  2. Alarm clock which uses lights/music and pre-heats my espresso machine.
  3. Fade out lights and turn-off Sonos units when starting a movie/tv-show on Plex.
  4. Turn on/off lights in the garages when I open the front/side door.
  5. Handle outdoor lights depending on sun, doors and presence.