Relay server for Kronoterm cloud. It gets data from cloud and exposes it through REST API to local network.
NOTE: Change
python
topython3
if necessary. Change PORT if needed, assuming 8555 here.Debian (Ubuntu, mint, ...)
- Clone or download the repo,
git clone https://github.com/LeskoIam/kronoterm_cloud_relay.git
or download and extract,cd kronoterm_cloud_relay
to change directory to cloned/extracted,- Create
.env
file inkronoterm_cloud_relay
directory with cloud user and password,touch .env
Open file in your favorite text editor and add the following content
KRONOTERM_CLOUD_USER="your-user" KRONOTERM_CLOUD_PASSWORD="your-password"
- [optional] Create and activate python venv,
python -m venv .venv source .venv/bin/activate
- Install dependencies (install
requirements.txt
if you want development packages also),python -m pip install -r prod_requirements.txt
- Run REST API server in the background.
cd src nohup python -m flask --app kronoterm_cloud_relay run --host=0.0.0.0 --port=8555 &
Command breakdown
nohup
- no hang-up - don't exit process if shell session ends--host=0.0.0.0
- run app on all addresses (to be available on local network)--port=8555
- port on which to run, like in http://192.168.1.111:8555&
- run process in the background
Running in the foreground (with output to console) can be enabled by running flask server without nohup
and &
python -m flask --app kronoterm_cloud_relay run --host=0.0.0.0 --port=8555
With your favorite browser navigate to
ip-or-host-address:8555/version
return should be the current version of kronoterm-cloud-relay
{"version": "0.0.6"}
or
ip-or-host-address:8555/relay/echo/is_it_working
return should be whatever the last argument is, in this case is_it_working
{"message": "relay - echo 'is_it_working' - OK"}
http://ip-or-host-address:8555/hp_info/info_summary
Method: GET
http://ip-or-host-address:8555/hp_info/initial_data
http://ip-or-host-address:8555/hp_info/basic_data
http://ip-or-host-address:8555/hp_info/system_review
http://ip-or-host-address:8555/hp_info/heating_loop/<heating_loop_number>
<heating_loop_number>
1
2
5
http://ip-or-host-address:8555/hp_info/alarms
Method: POST
{"temperature": "24.5", "heating_loop": 1}
{"temperature": "24.5", "heating_loop": 2}
{"temperature": "24.5", "heating_loop": 5}
{"mode": "AUTO", "heating_loop" : 1}
{"mode": "ON", "heating_loop" : 1}
{"mode": "OFF", "heating_loop" : 1}
Home Assistant has REST integration which can request and post data from relay
.
Refer to Home Assistant Readme for details.
Because we started the relay
app in the background there is no output to stdout
. It has been redirected into
nohup.out
,
tail nohup.out
# or
tail -f nohup.out # CTRL-C to exit
to kill the process (app), first find the PID (process ID) of relay
server,
ps aux | grep python
it should output a few lines, we are looking for the one similar to this,
user <<8764>> 96.3 4.9 29384 21800 pts/0 R 17:39 0:04 /home/***/***/kronoterm_cloud_relay/.venv/bin/python /home/***/***/kronoterm_cloud_relay/.venv/bin/flask --app kronoterm_cloud_relay --debug run --host=0.0.0.0 --port=8555
number in \<\<<number>> is PID, kill the process
kill 8764