When developing new code, I think the feedback cycle is very important to keep your flow. I set up a simple script that monitors a couple of your files and automatically sends updates commands to homeassistant when they are updated. It’s a few steps to setup, but let me know if you have any questions or suggestions of improvements
This instruction is for haspbian, but this should work on most unix-based systems.
create a file named update.sh with this code in it. Make sure to update the path, url and add your homeassistant password. Save the file somewhere on your server.
sudo apt-get install inotify-tools
#!/bin/bash inotifywait -m /home/homeassistant/.homeassistant/ -e close_write | while read path action file; do if [[ "$file" == "automations.yaml" ]]; then echo "$file" curl -X POST -H "x-ha-access: yourpass" -H "Content-Type: application/json" http://hassbian.local:8123/api/services/automation/reload fi if [[ "$file" == "groups.yaml" ]]; then echo "$file" curl -X POST -H "x-ha-access: yourpass" -H "Content-Type: application/json" http://hassbian.local:8123/api/services/group/reload fi if [[ "$file" == "core.yaml" ]]; then echo "$file" curl -X POST -H "x-ha-access: yourpass" -H "Content-Type: application/json" http://hassbian.local:8123/api/services/homeassistant/reload_core_config fi done
setup the following parts of your config with external files, make sure that the files have theese exact names.
homeassistant: customize: !include core.yaml automation: !include automations.yaml group: !include groups.yaml
run the file file by going to the folder where you put update.sh and write cd ./update.sh
Now whenever you update the files core.yaml automation.yaml or groups.yaml, the homeassistant will update the webinterface instantly
core is a littlebit wonky, it won’t update the interface until the state is changed for the updated elements
I use a plugin called sftp for sublime text, it allows you to sync a folder to a server via ssh. This means all I have to do to update my server is to save a file on my local computer. The change happens within a second.
always want this script to run, therefore I added this to /etc/rc.local
cd /home/homeassistant/.homeassistant/external ./restart.sh > /tmp/log_restart & exit 0
This runs the script as a daemon on startup and sends the output to log_restar. exit 0 closes the script, so you probably only want that once in rc.local