Your favourite automations

What a bloody cool idea Go on show

Can you please share your config for the chores/script for the firewall rules. A few samples is enough.
Thank you.

I have some:

  • notification when the washing mashine is finished.
  • get a notification, when the bath or toilet window is open for more then 10 minutes.
  • If a window is opend, the valves of the room will set to 12 degress, and if it is cloesed, the valves will set to the shedule mode back again.
  • By the way, I smoke shisha. At the electric coal stove is a zigbee switch. My coals need 13 minutes to heat up, so it will switch of afterwards
  • I also have chickens in my garden. Every evening, half an hour before sunset, the lights in the barn will switched on so that they go inside. An half an hour after sunset, the lights will go out. Also the the flap is going down automaticly. When it’s closed a screenshot of the barn camera is sent via notification so that I know all are inside.
  • at sunset, my shutters in the living room are going down
  • last but not least, I get a notification when everybody is not at home and lights or plugs are still on

I’m working on an automation for the manual airing of the basement. It will distinguish between winter (cold outside) and summer (warm). Also I will get a notification if the windows are open more then 10 minutes in winter or the temperature outside will rise over the basement temperatur in summer.

3 Likes

Hey,

can you share the automation code for this? I work at this time exactly for that

To be able to turn firewall rules on and off that easily are you using something more advanced like pfSence or OPNsense?

I use pfSense

Wish I had gone down pfSence / OPNsense instead of DD-WRT. Probably look at redoing my network in the next few months.

I used this as an example

This works on Asus WRT (Tomato based), however should work on *WRT too. You still need to be able to run the code on the router with a ssh key (simple user and password connection is not advisable).

Save/add the following script in the /jffs/post-mount (so that it would be run at each reboot). If you use static IP for the culprit’s machine then (if saved in post-mount, the ban is loaded at each reboot; to run it on-demand, save it as “blocked-ip.sh” or similar, and make it executable):

#!/bin/sh

iptables -I INPUT -s 192.168.x.y -j DROP

or (in order to use MAC):

iptables -I INPUT -m mac --mac-source AA:BB:CC:DD:EE:FF -j DROP

Save the following script as “remove rule” or something similar in order to be able to call it from HA. Regardless of rule used to add to iptables, “-D” removes it.

#!/bin/sh

iptables -D INPUT -s 192.168.x.y -j DROP

service restart_firewall

Using FORWARD chain instead of INPUT allows the machine to connect to network however cannot access internet. If using other rules affecting the respective IP/MAC on the same chain with append (-A) option, then this rule might get skipped. -I (without any rulenum) adds the rule at the top so that ensures it gets executed.

I use pfSense as my firewall and have made 2 custom php-scripts that runs om the pfSense box to control the firewall rules. I also had to do some modifications to one of the core libraries in pfSense to get it to work.

Which sensor do you use and could you share your washing machine automation yaml?

My favourite automations are simple but involve the Holiday lights I have in our yard.

  1. We have house cats and are always paranoid that someone will let them out. Everyone enters our house through the kitchen outside door, the cats are not allowed in the kitchen but sometimes they run in when you open the kitchen internal door. So if the internal door is open, the Holiday lights go red and anyone at the back door knows not to open the door until the lights go out. It’s a bit like the old red lights for recording in radio stations or dark rooms.

  2. The Yard camera has field detection setup near the back door, if it detects motion it turns on the holiday lights to full white and lights up the whole yard. Once no motion had been detected for a minute they turn back off. This is better than a PI because the area of detection and sensitivity is more tightly controlled. The old PIR controlled light was always coming on with false detections.

  3. A simple doorbell automation is another that is very useful and cost us nothing, we already had the yard camera covering the door and we had a 433Mhz doorbell. A sonoff RF detects the doorbell press, then the automation announces “There is someone at the door” over all the house echo dots, displays a notification on the TVs Firestick with an image of the door from the camera and sends a Telegram message with photo to my phone. This is much cheaper than a smart doorbell, the only downside is there is no audio but not worth the cost of a Ring doorbell to me.

I have other more complex automations but often the simplest add the most benefit.

2 Likes

I use a similar automation as he does

Hey @stiansoevik, would you mind sharing how you accomplished this in your config?

I implemented it using Appdaemon. The manual override detection was based on the previous set value from the app, but it’s kinda flaky - devices might report another value back, there is some time delay going on etc. I would like to try to make a pure Home Assistant component some day, and use contexts for detecting manual override. Then it is more share-able :slight_smile:

Sounds promising, looking forward to see what you come up with.

Hey,
i use a small automation which is really helpful for me.
HA turns a light on when i open my front door after sunset.

- id: '1543336251007'
  alias: Doorlight
  trigger:
  - entity_id: binary_sensor.oeq1560664_state
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - condition: state
    entity_id: sun.sun
    state: below_horizon
  action:
  - data:
      entity_id: light.vu1
      service: light.turn_on
1 Like

I used sun.sun too. But the below horizon and above isn’t perfect to me. Most the times when the sun is just above the horizon, it’s still shady/dark outside. I fine tuned it a bit and use the deconz daylight sensor and got it set if its sunrise or golden_hour_2 then do not turn on. Otherwise turn on.

It has more states to fine tune it to your needs.

This is one that I just created and am pretty happy with. It combines a HA automation and an automation in the shortcut app on iOS.

In short, if I am home and connected to my Wifi, when I open a music app the automation turns on my receiver (in airplay mode) and connects my phone to the receiver (over airplay)

iPhone side of things.

If any of my music apps are opened, it starts the iPhone automation.

This automation turns on an input_boolean in Home Assistant (more on this later)
It then checks if I am connected to my home wifi network and if I am it switches audio output to airplay.

On the HA side of things. The input_boolean triggers automation to turn on the receiver but only if I am home and connected to my home wifi.

  - alias: "Turn on Amp With Music App"
    initial_state: true
    trigger:
      - platform: state
        entity_id: input_boolean.adamphonemusic
        to: 'on'
    action:
      - service: homeassistant.turn_off
        entity_id: input_boolean.adamphonemusic
      - condition: and
        conditions:
          - condition: state
            entity_id: person.adam
            state: 'home'
          - condition: state
            entity_id: sensor.adams_iphone_ssid
            state: 'Ubiquiti'
      - service: media_player.turn_on
        entity_id: media_player.rx_v481_dccace_main
      - delay: 00:00:05
      - service: media_player.select_source
        data:
          entity_id: media_player.rx_v481_dccace_main
          source: airplay

1 Like

I’ve just created a new automation with node-red to get a music control for each room.
Recently i switched all my zigbee devices to the conbee II Stick.
I bought some ikea tradfri devices to play around with it.
Now I use the Ikea Tradfri remote control for my music control.
Node-Red listen to the events from the remote and controls my echo devices.

[{"id":"fbd9babc.68de18","type":"server-events","z":"acb2a3ee.cd01c","name":"Deconz Trötfri ","server":"dc4a800c.88fbb","event_type":"deconz_event","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"x":110,"y":2560,"wires":[["a5211ca9.c46fd","5359b3ce.b6091c","9b350392.c5db7","8d342af4.dec9f8","217df9c8.714e96"]]},{"id":"a5211ca9.c46fd","type":"function","z":"acb2a3ee.cd01c","name":" volume up Event 2002","func":"event = msg.payload.event.event;\nid = msg.payload.event.id\n\nif (event == 2002 && id == 'tradfri_fernbedienung') {\n     return [msg, null];\n     \n} else {\n   return null;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":360,"y":2440,"wires":[["7870e5d8.ad513c"]]},{"id":"7870e5d8.ad513c","type":"alexa-remote-routine","z":"acb2a3ee.cd01c","name":" volume up","account":"456d39e7.429548","routineNode":{"type":"volume","payload":{"value":{"type":"num","value":"10"},"mode":{"type":"str","value":"add"},"devices":["G090U50783961GMV"]}},"x":570,"y":2440,"wires":[[]]},{"id":"5359b3ce.b6091c","type":"function","z":"acb2a3ee.cd01c","name":" volume down Event 3002","func":"event = msg.payload.event.event;\nid = msg.payload.event.id\n\nif (event == 3002 && id == 'tradfri_fernbedienung') {\n     return [msg, null];\n     \n} else {\n   return null;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":370,"y":2520,"wires":[["13fcebc6.31c674"]]},{"id":"13fcebc6.31c674","type":"alexa-remote-routine","z":"acb2a3ee.cd01c","name":" volume down","account":"456d39e7.429548","routineNode":{"type":"volume","payload":{"value":{"type":"num","value":"-10"},"mode":{"type":"str","value":"add"},"devices":["G090U50783961GMV"]}},"x":570,"y":2520,"wires":[[]]},{"id":"9b350392.c5db7","type":"function","z":"acb2a3ee.cd01c","name":"next Event 5002","func":"event = msg.payload.event.event;\nid = msg.payload.event.id\n\nif (event == 5002 && id == 'tradfri_fernbedienung') {\n     return [msg, null];\n     \n} else {\n   return null;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":340,"y":2600,"wires":[["51bdb307.eecf8c"]]},{"id":"51bdb307.eecf8c","type":"alexa-remote-echo","z":"acb2a3ee.cd01c","name":"","account":"456d39e7.429548","config":{"option":"command","value":{"device":{"type":"str","value":"G090U50783961GMV"},"what":"next"}},"x":550,"y":2600,"wires":[[]]},{"id":"8d342af4.dec9f8","type":"function","z":"acb2a3ee.cd01c","name":"previous Event 4002","func":"event = msg.payload.event.event;\nid = msg.payload.event.id\n\nif (event == 4002 && id == 'tradfri_fernbedienung') {\n     return [msg, null];\n     \n} else {\n   return null;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":360,"y":2660,"wires":[["10ccdc59.1c2274"]]},{"id":"10ccdc59.1c2274","type":"alexa-remote-echo","z":"acb2a3ee.cd01c","name":"","account":"456d39e7.429548","config":{"option":"command","value":{"device":{"type":"str","value":"G090U50783961GMV"},"what":"previous"}},"x":560,"y":2660,"wires":[[]]},{"id":"8a62907e.15ede","type":"alexa-remote-routine","z":"acb2a3ee.cd01c","name":"my mix","account":"456d39e7.429548","routineNode":{"type":"music","payload":{"device":{"type":"str","value":"G090U50783961GMV"},"provider":{"type":"str","value":"AMAZON_MUSIC"},"search":{"type":"str","value":"Mein Mix"},"duration":{"type":"num","value":""}}},"x":540,"y":2760,"wires":[[]]},{"id":"217df9c8.714e96","type":"function","z":"acb2a3ee.cd01c","name":"on Event 1002","func":"event = msg.payload.event.event;\nid = msg.payload.event.id\n\nif (event == 1002 && id == 'tradfri_fernbedienung') {\n     return [msg, null];\n     \n} else {\n   return null;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":340,"y":2760,"wires":[["8a62907e.15ede"]]},{"id":"dc4a800c.88fbb","type":"server","name":"Home Assistant"},{"id":"456d39e7.429548","type":"alexa-remote-account","name":"[email protected]","authMethod":"proxy","proxyOwnIp":"192.168.1.33","proxyPort":"3456","cookieFile":"\\config\\node-red","refreshInterval":"3","alexaServiceHost":"layla.amazon.de","amazonPage":"amazon.de","acceptLanguage":"de-DE","userAgent":"","useWsMqtt":"on","autoInit":"on"}]