#!/bin/sh
# Stop (or normal) for Eddi.
# Picks up credentials from ~/.netrc so may not be suitable for batch.

# Usage:
#     $0 [0|1]
#     0 or nothing means stop, 1 means resume

state=0
if [ $# -gt 0 ]; then
    if [ "0" = "$1" ] || [ "1" = "$1" ]; then state=$1; fi
fi

# Get configuration.
. script/myenergi/.config

exec curl -u "$hubsn":"$APIkey" --silent --digest --netrc -H 'accept: application/json' -H 'content-type: application/json' --compressed "https://s18.myenergi.net/cgi-eddi-mode-E$eddisn-$state"


##########
# May be used / adapted / etc without any promise of fitness for purpose
# under the terms of the Apache License Version 2.0, January 2004
#     http://www.apache.org/licenses/LICENSE-2.0
##########
