I installed the evohome client and copied my custom config file (evoconfig.py) and py scripts to this folder with the custom startup script for the Docker Domoticz container with the following commands:
Code: Select all
sudo apt-get -y install git python3-simplejson python3-setuptools python3-pip python3-dateutil
sudo pip install requests
git clone https://github.com/watchforstock/evohome-client.git
cd /opt/domoticz/config
sudo pip install ./evohome-client
cp /opt/domoticz/userdata/scripts/python/evohome-client/* /opt/domoticz/evohome-client
Code: Select all
docker exec -it domoticz /opt/domoticz/evohome-client/radiator_temp.py Voorkamer "5"
Code: Select all
/opt/domoticz/evohome-client/radiator_temp.py: line 2: import: command not found
/opt/domoticz/evohome-client/radiator_temp.py: line 3: import: command not found
/opt/domoticz/evohome-client/radiator_temp.py: line 4: import: command not found
/opt/domoticz/evohome-client/radiator_temp.py: line 5: from: command not found
/opt/domoticz/evohome-client/radiator_temp.py: line 6: from: command not found
/opt/domoticz/evohome-client/radiator_temp.py: line 7: import: command not found
/opt/domoticz/evohome-client/radiator_temp.py: line 8: import: command not found
/opt/domoticz/evohome-client/radiator_temp.py: line 11: syntax error near unexpected token `('
/opt/domoticz/evohome-client/radiator_temp.py: line 11: `client = EvohomeClient(evoconfig.usr, evoconfig.pw)'
Code: Select all
#!/bin/bash
import evoconfig
import sys
import requests
from evohomeclient2 import EvohomeClient
from datetime import datetime
import datetime
import time
# Zet de systeem status op 'Normal' als hij op 'Away' is ingesteld
client = EvohomeClient(evoconfig.usr, evoconfig.pw)
status=client.locations[0].status()
tcs=status['gateways'][0]['temperatureControlSystems'][0]
zones=tcs['zones']
# Wait to avoid that previous script is still running
time.sleep( 10 )
# Set system in the normal mode if that is not the case
currentmode = tcs['systemModeStatus']['mode']
if currentmode == "Away":
client.set_status_normal()
# Wijzigingen doorvoeren tussen 08:00 en 21:00 uur
dt = datetime.datetime.now()
start_time = "08:00"
end_time = "21:00"
if start_time < dt.strftime("%H:%M") < end_time:
# Aanpassen radiator temperatuur
kamer=sys.argv[1]
if kamer != "aanwezig":
temp=sys.argv[2]
zone = client.locations[0]._gateways[0]._control_systems[0].zones[kamer]
zone.set_temperature(temp)
exit()