My Home Assistant configuration... because sharing is caring!

Never thought when I started to look into Home Assistant that I would be actually sharing my configuration one day, but here we go…

https://github.com/farstreet/my-home-assistant-configuration

Sharing my HASS configuration for two main reasons:

  • Studying, copying and modifying other users configurations was a great help when I started using HASS
  • Looking forward to improvement suggestions from other users (current config + new things to try)

Current automations:

  • automatic broadcast of TTS alerts in the morning when travel time to work exceeds a certain duration
  • automatically turn off all devices when the last person leaves the house
  • automatically turn on favorite music of each user when arriving home
  • automatically turn on/off specific light scenes based on the time of the day
  • automatically turn on/off nightlamps at night, when going to bed
  • wake up with an all-in-one morning routine (light scenes, music, radio news broadcast, weather forecast, …)
  • control different audio media-players through one user interface (on/off - devices - presets - volum control, …)
  • automatically modify light scenes when playing/stopping different video media-players
  • automatically receive TTS reminders, per user (when present) or for all users in the household
  • motion triggered lights in bedroom

Hardware devices installed:

  • Lights: Philips Hue (color, white, go, led, etc…) & Flux WiFi Smart LED Light Bulbs
  • Thermostat: Nest
  • Motion sensor: Zwave multisensor (not used currently because f*cking complicated)
  • iBeacons: estimote (not used currently because no reliable results)
  • Media-players: Bose SoundTouch, Google Home, Chromecast & Chromecast audio

On the to-do list:

  • Microlocation (reliably knowing who is in which room):
    • Understanding why the iBEACON setup fails
    • Waiting for my HappyBubbles devices to arrive to explore alternatives for microlocation
  • Reboot through shell command (root issue)
  • Append text containing template values to text file (root issue I think)
  • Relevant automations (beyond the fun to implement them, also actually useful)
  • Sleep more again…

!!! Help/suggestions welcome !!!

5 Likes

Hi @farstreet,
Thanks for sharing!
Regarding the reboot through shell command, I guess I can suggest a solution.
If you run home-assistant under different user, let’s say hass, then you need to grant this user sudo for reboot.
To do this, edit /etc/sudoers file with command sudo visudo and paste
hass ALL = NOPASSWD: /sbin/reboot

Thanks… I experimented with sudoers already and I ended up rebuilding my hassbian config as I locked myself out of the sudo functionality… But I guess I’ll have to give it another go :slight_smile:

This is my complete sudoers profile for hass user:
hass ALL = NOPASSWD: /bin/dd, /usr/bin/apt-get*, /sbin/reboot, /sbin/shutdown

2 Likes

Suggestion when modifying sudoers. Make sure you use visudo to edit the files since that has protections on making mistakes in the config files. Secondly, I assume you are using SSH to connect to your box to make the sudoers changes? I suggest you have two separate SSH sessions connected. Example if you are using Putty open up two separate instances/connections. That way you can leave one connected and logged in as root while you make the changes in the other connection. You can then disconnect one to test, etc. If you make a mistake you still have the other connection logged in to undo any changes that locked you out. Learned this one while administrating Cisco switches.

3 Likes

that’s an excellent suggestion :smiley:

Thank you for sharing @farstreet! Noob question…on your travel time to work, wouldn’t it keep playing the same message if the time is more than 20 min? Does it only alert you once if yes, how?

Thanks again.

The input_boolean.alarm_xxxxxx_onoff takes care of that. It’s a condition that the status is ‘on’ to play the message.

The sensor is put on when the alarm goes off. That way, when there was no alarm set, the message will not be played.

The sensor is put to off either when the message is played or when the last person leaves the house (when there was no message to play).

Clear ?

1 Like

Much appreciated. I tried tts few weeks ago when the wifey got home and it keeps repeating whenever she walks by the kitchen sensor lol. Now I know why. Will get it a try.

Thanks again!

@farstreet hello friend thanks for sharing your config…
i saw your sensor.yaml and i have a idea… can u help me to build this template…
i want to do a template, … when proximity.sensor is less 100 give me “perto” else “longe”.
the example below is right?

value_template: >
        {% if is_state('proximity.home') <= 100 %}
            perto
        {% else %}
            longe
        {% endif %}
      entity_id: proximity.home

Can you send TTS to the Soundtouch system?

I don’t think so… didn’t try yet as I have my Google Home in the same room as my SoundTouch and I broadcast all TTS to that device.

But wouldn’t know how to do it to SoundTouch anyway

1 Like

I wouldn’t use proximity.home for something that requires such an accuracy. Would rather look into nmap (once connected to wifi) or even beacons.

But as such your template looks ok, although I am using this sensor in km and not in m. In my setup, this would look at whether I am less than 100 km from home and not less than 100 m.

I got it to work for one command line only. Once I try to include another command (either by a new line or using “, /new/command”), visudo complains. How can I include many command lines for user homeassistant without giving full privileges?

I was trying to include OPTIONS in the command line. That’s what visudo was complaining.
Once included as: /bin/dd, /usr/bin/apt-get*, /sbin/reboot, /sbin/shutdown
Then it works (it was already stated by SmaginPV).

If someone else need to know more about sudoers, I found good information below:

https://www.sudo.ws/man/sudoers.man.html