Your favourite automations

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.

My favourite automation is the one that shuts the TRV (heating) valve on the radiator when the window is open.:slight_smile:

1 Like

my favorite automations are

  1. turning on the exhaust fan in the bathroom if the bathroom light has been on for more than 5 minutes and leaving it running for 5 minutes after the light is turned off. There isn't any reason to be in there for more than 5 minutes unless you are making a stink.
  2. I'm getting ready to do something similar with a humidity sensor and the exhaust fan near the shower.
  3. Turning off the lights and ceiling fans in the kids rooms when they leave for school (I use owntracks for presence detection).
  4. like someone else said, dimming the lights when the TV is turned on
  5. turning on the foyer light when the doorbell rings.

    I would post the code, but it’s all in AppDaemon and controlled by one application using a dictionary of rules.

1 Like

Why vibration? (hej)

Put a motion sensor and arm it :slight_smile:

Simply because my machine is wired directly in the wall, nothing to put a power consumption meter on without opening the whole thing. Could be done, surely, but I’d rather leave it as is.

hejhej!

What hardware are you using to monitor the power consumption?

Not sure of the exact model, but it is a z-wave switch with power metering similar to Produkter för hemautomation & smarta hem | M.nu

1 Like

Install a https://www.bauhaus.se/multidosa-rotdosa-70mm-for-installation.html?gclid=CjwKEAjwoLfHBRD_jLW93remyAQSJABIygGpMpzyEEIvr4SO5shSa9f156ZKY3IRrS4Ayku5GApz2BoCxNrw_wcB and a power consumption meter insted :slight_smile:

My Kids take turns doing daily chores and it’s always been an aurgument of ‘It’s not my day.I did it yesterday’ type stuff. Mom and Dad are no longer the referees, Alexa (via HASS) is now the definitive source for chore duties.

Alexa, Turn on Responsibilities now settles all arguments and I hear them ask her on a daily basis. :slight_smile:

https://github.com/CCOSTAN/Home-AssistantConfig/blob/master/automation/Speech/responsibilities.yaml

It’s simple but SO EFFECTIVE.

CARLO

8 Likes