-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdate_ha.sh
executable file
·36 lines (27 loc) · 1.13 KB
/
update_ha.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
set -euo pipefail
echo "Running code analysis..."
ruff .
mypy .
echo "Copying files to home assistant..."
# ToDo: skip __pycache__ folders
# See e.g. https://stackoverflow.com/questions/15121337/recursively-use-scp-but-excluding-some-folders
rm -rf custom_components/sungrow/__pycache__
rm -rf custom_components/sungrow/core/__pycache__
scp -r custom_components/sungrow/ [email protected]:/root/homeassistant/custom_components || {
echo "Error: Failed to copy files."
echo "* Do you have ssh addon running in home assistant?"
echo "* Did you configure it for remote access?"
echo "* Did you add your ssh key to the authorized_keys? (run: eval `ssh-agent` and ssh- ssh-add)"
echo "* Can you connect via ssh? (run: ssh [email protected])"
exit 1
}
echo "Restarting home assistant..."
ssh [email protected] "ha core restart"
echo "Retrieving home-assistant log... Press Ctrl+C to exit."
# ToDo: check if configuration.yaml has sungrow section:
# logger:
# default: warning
# logs:
# custom_components.sungrow: debug
ssh [email protected] "tail -n 1000 -f /root/homeassistant/home-assistant.log"