dale3h / hassctl Goto Github PK
View Code? Open in Web Editor NEWSimple command line utility to help debug Home Assistant configuration
License: MIT License
Simple command line utility to help debug Home Assistant configuration
License: MIT License
Dale, wondering if it is possible to add another feature to hassctl
that allows users to backup their configurations to Github. Sounds like it should be possible. I have to run the following commands to update my repo:
cd /home/hass/.homeassistant
sudo su -s /bin/bash hass
git add .
git commit -m 'your commit message'
git push origin master
The script (borrowed from @CCOSTAN) works partly, but I can run it only run it as hass
user (i.e., I have to run sudo su -s /bin/bash hass
before I can run ./gitupdate.sh
).
#!/bin/bash
cd /home/hass/.homeassistant
git add .
git status
echo -n "Enter the Description for the Change: " [Minor Update]
read CHANGE_MSG
git commit -m "${CHANGE_MSG}"
git push origin master
exit
Wanted to open an issue on this for the discussion rather than jumping in with a PR.
Might be a good idea to hard code binary locations. Ie, /usr/bin/curl instead of curl. Since you are running some of these with sudo, there's some vulnerability there. I realize that might introduce a distro dependency problem, but I'm pretty sure all put curl at same place. Also, if someone tries to run hassctl from an environment without a path variable (maybe from crontab), full path will work while shortname will fail.
Line 66 VIRTUAL_ENV="${VIRTUAL_ENV-/srv/homeassistant}"
, I'm not 100% on my bash syntax, but shouldn't it be VIRTUAL_ENV="${VIRTUAL_ENV:-/srv/homeassistant}"
?
Last one - and big for me personally, what if script calling user does not have sudo privs? I run HA under the user "hass" which does not have sudo access (on purpose). Might want to either redesign to be called like 'sudo hassctl whatever' and check for root privs at startup (and then not use sudo inside) or include some sort of mechanism if the sudo fails.
Anyway. Cool tool. I know a lot of people on the gitter like it.
On Hassbian 1.23 I had to change "HASS_SERVICE=home-assistant.service" to the following:
HASS_SERVICE=[email protected].
Just a small update to the Configuration Examples :)
since HA 0.59 i get the following in the log once update is completed:
2018-01-07 01:20:33 ERROR (MainThread) [homeassistant.components.shell_command] Error running command: hassctl update-hass && hassctl config && hassctl restart
, return code: 1
NoneType: None
The process is completed successfully, but I get this error at the end.
First of all, I absolutely LOVE hassctl and it has made my life much easier. Thank you!
Now I have recently had a need to make use of debug.. And while hassctl supports log and error.. no debug! Any chance you could add DEBUG? I would assume that much like log encompasses everything below it like DEBUG and ERROR, debug would encompass DEBUG and ERROR.
Does that sound like a reasonable idea?
Oh.. and bakcup? I recently had a massive scare with HA going nuts.. Still don't know if it's kosher.. A decent and easy to automate backup would take a load of my shoulders.
Regards,
Michal (aka mihalski)
Here is an example of my latest upgrade:
pi@homepi:~ $ hassctl update-hassctl
hassctl: utility has been updated to the latest master version
pi@homepi:~ $ hassctl update-hass && hassctl config && hassctl restart
Collecting homeassistant
Downloading homeassistant-0.43.0-py2.py3-none-any.whl (7.0MB)
100% |████████████████████████████████| 7.0MB 36kB/s
Requirement already up-to-date: chardet==3.0.2 in /srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages (from homeassistant)
Requirement already up-to-date: pytz>=2017.02 in /srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages (from homeassistant)
Requirement already up-to-date: pip>=7.1.0 in /srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages (from homeassistant)
Requirement already up-to-date: aiohttp==2.0.7 in /srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages (from homeassistant)
Requirement already up-to-date: requests<3,>=2 in /srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages (from homeassistant)
Requirement already up-to-date: pyyaml<4,>=3.11 in /srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages (from homeassistant)
Requirement already up-to-date: jinja2>=2.9.5 in /srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages (from homeassistant)
Requirement already up-to-date: typing<4,>=3 in /srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages (from homeassistant)
Requirement already up-to-date: voluptuous==0.9.3 in /srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages (from homeassistant)
Requirement already up-to-date: async-timeout==1.2.0 in /srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages (from homeassistant)
Requirement already up-to-date: multidict>=2.1.4 in /srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages (from aiohttp==2.0.7->homeassistant)
Requirement already up-to-date: yarl<0.11,>=0.10.0 in /srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages (from aiohttp==2.0.7->homeassistant)
Requirement already up-to-date: MarkupSafe>=0.23 in /srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages (from jinja2>=2.9.5->homeassistant)
Collecting setuptools>=0.6b1 (from voluptuous==0.9.3->homeassistant)
Downloading setuptools-35.0.1-py2.py3-none-any.whl (390kB)
100% |████████████████████████████████| 399kB 419kB/s
Requirement already up-to-date: appdirs>=1.4.0 in /srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages (from setuptools>=0.6b1->voluptuous==0.9.3->homeassistant)
Requirement already up-to-date: packaging>=16.8 in /srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages (from setuptools>=0.6b1->voluptuous==0.9.3->homeassistant)
Requirement already up-to-date: six>=1.6.0 in /srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/six-1.10.0-py3.4.egg (from setuptools>=0.6b1->voluptuous==0.9.3->homeassistant)
Requirement already up-to-date: pyparsing in /srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages (from packaging>=16.8->setuptools>=0.6b1->voluptuous==0.9.3->homeassistant)
Installing collected packages: homeassistant, setuptools
Found existing installation: homeassistant 0.42.4
Uninstalling homeassistant-0.42.4:
Successfully uninstalled homeassistant-0.42.4
Found existing installation: setuptools 35.0.0
Uninstalling setuptools-35.0.0:
Successfully uninstalled setuptools-35.0.0
Successfully installed homeassistant-0.43.0 setuptools-35.0.1
Testing configuration at /home/homeassistant/.homeassistant
17-04-23 18:32:39 INFO (Thread-3) [homeassistant.config] Upgrading config directory from 0.42.4 to 0.43.0
17-04-23 18:32:41 INFO (MainThread) [homeassistant.setup] Setting up mqtt
17-04-23 18:32:44 INFO (MainThread) [homeassistant.setup] Setting up http
17-04-23 18:32:44 INFO (MainThread) [homeassistant.setup] Setting up recorder
17-04-23 18:32:44 INFO (MainThread) [homeassistant.setup] Setting up api
17-04-23 18:32:44 INFO (MainThread) [homeassistant.setup] Setting up websocket_api
17-04-23 18:32:44 INFO (MainThread) [homeassistant.setup] Setting up history
17-04-23 18:32:44 INFO (MainThread) [homeassistant.setup] Setting up frontend
17-04-23 18:32:44 INFO (MainThread) [homeassistant.setup] Setting up zwave
17-04-23 18:32:44 INFO (MainThread) [homeassistant.setup] Setting up remote
17-04-23 18:32:44 INFO (MainThread) [homeassistant.setup] Setting up influxdb
17-04-23 18:32:44 INFO (MainThread) [homeassistant.setup] Setting up sun
17-04-23 18:32:44 INFO (MainThread) [homeassistant.setup] Setting up automation
17-04-23 18:32:44 INFO (MainThread) [homeassistant.setup] Setting up binary_sensor
17-04-23 18:32:44 INFO (MainThread) [homeassistant.setup] Setting up conversation
17-04-23 18:32:44 INFO (MainThread) [homeassistant.setup] Setting up shell_command
17-04-23 18:32:45 INFO (MainThread) [homeassistant.setup] Setting up sensor
17-04-23 18:32:46 INFO (MainThread) [homeassistant.setup] Setting up light
17-04-23 18:32:46 INFO (MainThread) [homeassistant.setup] Setting up switch
17-04-23 18:32:46 INFO (MainThread) [homeassistant.setup] Setting up updater
17-04-23 18:32:46 INFO (MainThread) [homeassistant.setup] Setting up group
17-04-23 18:32:46 INFO (MainThread) [homeassistant.setup] Setting up zone
17-04-23 18:32:46 INFO (MainThread) [homeassistant.setup] Setting up tts
17-04-23 18:32:46 INFO (MainThread) [homeassistant.setup] Setting up media_player
17-04-23 18:32:46 INFO (MainThread) [homeassistant.setup] Setting up config
17-04-23 18:32:46 INFO (MainThread) [homeassistant.setup] Setting up logbook
17-04-23 18:32:46 INFO (MainThread) [homeassistant.setup] Setting up panel_iframe
17-04-23 18:32:46 INFO (MainThread) [homeassistant.setup] Setting up zeroconf
17-04-23 18:32:46 INFO (MainThread) [homeassistant.setup] Setting up device_tracker
17-04-23 18:32:46 INFO (MainThread) [homeassistant.setup] Setting up ios
pi@homepi:~ $ hassctl config
INFO:homeassistant.util.package:Attempting install of colorlog>2.1,<3
Testing configuration at /home/homeassistant/.homeassistant
17-04-23 18:35:00 INFO (MainThread) [homeassistant.setup] Setting up mqtt
17-04-23 18:35:07 INFO (MainThread) [homeassistant.setup] Setting up recorder
17-04-23 18:35:07 INFO (MainThread) [homeassistant.setup] Setting up http
17-04-23 18:35:07 INFO (MainThread) [homeassistant.setup] Setting up history
17-04-23 18:35:07 INFO (MainThread) [homeassistant.setup] Setting up api
17-04-23 18:35:07 INFO (MainThread) [homeassistant.setup] Setting up websocket_api
17-04-23 18:35:07 INFO (MainThread) [homeassistant.setup] Setting up frontend
17-04-23 18:35:07 INFO (MainThread) [homeassistant.setup] Setting up sensor
17-04-23 18:35:07 INFO (MainThread) [homeassistant.setup] Setting up zwave
17-04-23 18:35:07 INFO (MainThread) [homeassistant.setup] Setting up remote
17-04-23 18:35:08 INFO (MainThread) [homeassistant.setup] Setting up switch
17-04-23 18:35:08 INFO (MainThread) [homeassistant.setup] Setting up light
17-04-23 18:35:08 INFO (MainThread) [homeassistant.setup] Setting up sun
17-04-23 18:35:08 INFO (MainThread) [homeassistant.setup] Setting up updater
17-04-23 18:35:08 INFO (MainThread) [homeassistant.setup] Setting up group
17-04-23 18:35:08 INFO (MainThread) [homeassistant.setup] Setting up automation
17-04-23 18:35:08 INFO (MainThread) [homeassistant.setup] Setting up binary_sensor
17-04-23 18:35:08 INFO (MainThread) [homeassistant.setup] Setting up influxdb
17-04-23 18:35:08 INFO (MainThread) [homeassistant.setup] Setting up shell_command
17-04-23 18:35:08 INFO (MainThread) [homeassistant.setup] Setting up conversation
17-04-23 18:35:08 INFO (MainThread) [homeassistant.setup] Setting up zone
17-04-23 18:35:08 INFO (MainThread) [homeassistant.setup] Setting up config
17-04-23 18:35:08 INFO (MainThread) [homeassistant.setup] Setting up panel_iframe
17-04-23 18:35:08 INFO (MainThread) [homeassistant.setup] Setting up tts
17-04-23 18:35:08 INFO (MainThread) [homeassistant.setup] Setting up media_player
17-04-23 18:35:08 INFO (MainThread) [homeassistant.setup] Setting up logbook
17-04-23 18:35:08 INFO (MainThread) [homeassistant.setup] Setting up zeroconf
17-04-23 18:35:08 INFO (MainThread) [homeassistant.setup] Setting up device_tracker
17-04-23 18:35:08 INFO (MainThread) [homeassistant.setup] Setting up ios
pi@homepi:~ $
Notice that it was only on the 2nd run of hassctl config that colorlog was installed. And even after that hassctl log was not colourised. I assume this requires a restart of hass.
Clearly a solution might be to simply use:
hassctl update-hass && hassctl config && hassctl config && hassctl restart
But you mentioned on Gitter that this should not be required anymore so I thought I would report it in case there is some sort of bug.
Thanks for a great utility!
Regards.
Michal
Can I use hassctl with docker image
what do I have to fill in at hass_exec
so sudo su -s /bin/bash homeassistant
and source /srv/homeassistant/bin/activate
Hi there,
I love your product, and (normally), I use it "blindly" to install any Home Assistant updates.
However, I found out that when upgrading to Home Assistant version 2022.10 (the current version), it installs cryptography version 38.x.
Home Assistant cannot work with this dependency, as cryptography should be version < 38 (so same as for Home Assistant 2022.9).
Any chance you could fix this, also for future releases?
Thanks!
Dieter
Due to new release schedule I think a switch to update beta would be useful!
Thanks for all you do!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.