#!/bin/sh
# Ask myenergi which server we should be talking to.
# Picks up credentials from ~/.netrc so may not be suitable for batch.

# Usage:
#     $0 

# Basic version shown here https://github.com/twonk/MyEnergi-App-Api as:
#
# curl --digest -u **HUB**:**PASSWORD** -H 'accept: application/json' -H 'content-type: application/json' --compressed 'https://s<lastdigit>.myenergi.net/cgi-jstatus-E'
#
# Maybe director.myenergi.net rather than s<lastdigit> as of 2022?
# Eg see https://myenergi.info/viewtopic.php?p=41083#p41083

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


# DHD20250629: possibly needs a fix:
# https://myenergi.info/pause-mode-for-zappi-t15163.html#p145138


##########
# 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
##########
