'Home Assistant' Notifications?

I’ve just started getting to know ‘Home Assistant’ and was wondering if anyone had tried making a Syncthing notification or similar config entry for it?

It’s quite the wonder and ideal for an under-used Pi, Odroid etc.

Has presence detection and other sensors (might be useful for people who want to turn Syncthing on/off under certain conditions).

It’s definitely the least steep learning curve of any of the open-source Home Automation setups I’ve tried.

https://home-assistant.io/demo/

I had been wondering the same thing. I’m hopeful to hear if there is anything out there.

1 Like

Update: [Solved] with some bells & whistles

edit: Small change to account for multiple non-zero values.

Here are code snippets I made for a simple Syncthing On / Off status indicator:

In a binary_sensor.yaml file add the following:

  - platform: command_line
    command: ssh [user@IP of Syncthing]  "if ps ax | grep -v grep | grep syncthing > /tmp/test.txt; then echo 1; else echo 0; fi"
    name: Syncthing
    payload_on: 1
    payload_off: 0

If you don’t need to ssh into your Syncthing then it’s just:

    command: if ps ax | grep -v grep | grep syncthing > /tmp/test.txt; then echo 1; else echo 0; fi

You can then make the sensor displayable via a groups.yaml, e.g

Server:
  view: no
  entities:
  - binary_sensor.deluge
  - binary_sensor.syncthing
  - binary_sensor.firewall
  - binary_sensor.pgl
  - sensor.server_temp

And of course have the includes in your configuration.yaml as needed:

group: !include groups.yaml
binary_sensor: !include binary_sensor.yaml

The section on my Hass page:

http://imgur.com/ymXAeNy

Hope it’s useful for someone. Of course the fun, by no means, ends there!

One feature of Home Assistant allows you to make a sensor out of the value of a text file, say ‘hallway-lights.txt’ and the text file contains the word ‘off’ or ‘on’. Make the sensor trigger on a change in that value, and change the lights accordingly.

So simply make a folder in the Home Assistant server with such a text file, have Syncthing installed and link it to your phone Syncthing.

Now all you have to do is change the value of the text file on your phone, and no matter where in the world you are, Home Assistant will change the light at home. I’ve had turn-around times of 5 seconds to 90 seconds.

That’s of course a simple example, everything you can connect to Home Assistant can be controlled via such simple text files and more sophisticated customisable config files. Which yet again can be amended via Syncthing.

The upshot of all this? One major privacy / security headache caused by the Intenet of Things can be neutered by Syncthing. By being the secure transport / encryption layer for all the functions of Home Assistant - a total personal oversight of the whole loop can be accomplished.

I combine this with a DNS server at home (e.g. Pi-hole.net) to silence the frighteningly chatty IoT devices I have and leave them only capable of talking locally. Home Assistant also lets you dispense with many of the mini-hubs the devices ‘need’ so that’s handy too.

Manually editing text files is of course clumsy, but it’s my proof-of-concept stage.

I’m off to give Android Studio a go and make a simple app that will do the ‘On / Off’ etc in a more elegant manner. If anyone knows of a pre-made template like that, please let me know!

So many thanks Syncthing, and Home Assistant (and Pi-Hole) - I think you’ve won the Internet of Things Software Stack Award 2016!!!

3 Likes

Love your concept. Throwing it out there as I done this for unix services, would instead writing an integration into IFTTT and using the power of IFTTT be a better path?

1 Like

I’d love to have HA notify me when Syncthing encounters an error, or even when certain folders are synced. Is there a middle service anyone’s aware of that can make it happen?