Installation from scratch
This way is reserved to aknowledged people. There is 2 main reasons to choose this way: - It is for people who want to developp OpenHEMS because it allow you to update source fiels and tests. - Or people who want to install it on a custom devic likee Banana Pi in a lighter way than full HomeAssitant-OS using docker.
Prerequisites
We need:
A server we named “homeassistant” installed with debian based Linux OS (Or HomeAssistantOS) connected to local lan. The script scripts/home-assistant.sh let you to install Home-Assistant. But if you have already a Home-Assistant installed use it.
Python3, tested on 3.9, but need 3.10 if you use EMHASS fonctionalities
Systemd older than v240
By default we install Home-Assistant (HA) as docker but for full-featured HA, use HAOS or insttal it from https://www.home-assistant.io/installation/linux & https://wiki.debian.org/KVM.
In your internet box, for outside access, you need to:
Create a domain name that we named $DOMAINNAME.
Redirect ports 80 and 443 to your homeassistant server.
See configuration of your DHCP and choose a free IP outside it range (and free from other static local IP). Default is 192.168.1.202. Maybe is it free too for you.
Installation
Run git clone https://github.com/abriotde/openhems-sample.git
Configure it. See dedicated page Configuration. After configured, restart at least OpenHEMS add-on.
Copy cat ../scripts/config.sh|grep -v “^source”|tee config/config.inc.sh and edit config/config.inc.sh to adapt to your needs.
RSYNC_CMD : command shell de copy
DOMAINNAME : The domain name you have from internet to access your server. It is not important
HOMEASSISTANT_IP : IP of your Home-Assistant server.
HOMEASSISTANT_DIR : An empty directory where you will install HomeAssistant if you choose to install it as docker.
HOMEASSISTANT_CONFIG_PATH : The Home-Assistant path for configuration (You probably do not need to change it)
HOMEASSISTANT_DOCKER_IMAGE : The docker image of Home-Assistant.
DOCKER_HA_NAME : The name of the docker HomeAssistant.
DOCKER_NAME : OpenHEMS docker name. I do not think you need to change it.
OPENHEMS_USER : The user who will run OpenHEMS.
OPENHEMS_PATH : The place you did the “git clone”
OPENHEMS_LOGPATH : The place where OpenHEMS will write logs. It should be a directory with write access for the user who run OpenHEMS.
OPENHEMS_BRANCH : The branch of OpenHEMS to use. It should be “main” for production, “dev” for development.
OPENHEMS_DOCKER_VERSION : The version of the OpenHEMS docker image to use.
TMP_DIR : A temporary directory for installation. It should be a directory with write access for the user who run OpenHEMS.
VPN_IP : The IP of the VPN server if you use one. It is a unstable function.
MY_TIME_ZONE : Your timezone.
DOCKER_OPENHEMS : 1 if you will run OpenHEMS as a docker (for test/production), 0 if you will run it from source code (for development).
Go in scripts folder cd openhems-sample/scripts/
Run ./installFromScratch.sh or just ./openhems.sh install if you have ever HomeAssistant installed with HACS
Check in a web browser “http://$HOMEASSISTANT_IP:8123/” after replacing $HOMEASSISTANT_IP with your IP. If ok, home-assistant is correctly installed.
Check in a web browser “https://$HOMEASSISTANT_IP/” after replacing $HOMEASSISTANT_IP with your IP. If ok, HTTPS is correctly installed
Check in a web browser “https://your.domain.com/” If ok, all the base is ok.
Check in a browser “https://$HOMEASSISTANT_IP:8000/” to check if OpenHEMS server run well
If something went wrong, you will need to search where in the script and to correct it. Then run the script from the place it went wrong. You can send us a mail to contribute or send a merge-request. Else, you can continue and configure your home in a web browser.
In HACS menu
Parametres/Add a integration/HACS… Must add a hacs menu
Tempo
Menu HACS/Menu parametre (top right)/Dépot personalisé (Dépot:https://github.com/hekmon/rtetempo, Catégorie:Intégration)
Menu HACS/search “Rte Tempo”/Rte Tempo/Télécharger
Parametre/Ajouter une intégration/Rte Tempo…
Get long_lived_token: Home-Assistant => User profile / Security / long lived token / Create token. Copy it and save it, we will need it.
# Configure
Now you installed HomeAssistant and OpenHEMS but they do not comunicate each over. You have to configure OpenHEMS to give it access to HomeAssistant.
Edit the $OPENHEMS_PATH/configi/openhems.yaml file. You will change api block for the moment:
url : The url for OpenHEMS to access to HomeAssistant. You probably have to change the IP, but as it’s from localhost, 127.0.0.1 should be ok.
long_lived_token : The long_lived_token you get the step before. It’s like a password to give access to HomeAssistant for OpenHEMS
ssl_certificate : It seam not working for the moment.
Run sudo systemctl restart openhems.service to restart OpenHEMS. You should see a notification in HomeAssistant that tell you OpenHEMS started.
Now you can follow doc/configure.md to really configure your network.
# Plugin installation documentations
EMHASS
HACS (Tempo) : Need Github account + RTE API account
Tempo API
reverse-proxy HTTPS: https://www.scaleway.com/en/docs/tutorials/nginx-reverse-proxy/
Post-installation
In your internet box stop redirect 80 port to your homeassistant server.
MQTT
https://www.home-assistant.io/integrations/python_script/
$ sudo apt install python3-paho-mqtt
Banana Pi M2 Berry
EMHASS