apazga / smappee-domoticz-bash

Bash script to get values from Smappee hub (locally) and upload them to Domoticz
5 stars 1 forks source link

The password for the local webportal is not always the default 'admin' #3

Closed ericvb closed 7 years ago

ericvb commented 7 years ago

Hi,

The script should be adapted to support a new user variable, for example SMAPPEE_PASS, so that the user can adapt this in case he modified the default password (and he should do it! Never leave the default password!!)

Add this to the user configuration section

# Authenication for the SMAPPEE, default admin
SMAPPEE_PASS="admin"

Further on the following line should be adapted

if [ "$ERR" -eq 1 ]
  then
    curl -H "Content-Type: application/json" -X POST -d "admin" http://$SMAPPEE_IP/gateway/apipublic/logon
    SMAP=$(curl http://${SMAPPEE_IP}/gateway/apipublic/reportInstantaneousValues)
  fi

to

if [ "$ERR" -eq 1 ]
  then
    curl -H "Content-Type: application/json" -X POST -d $SMAPPEE_PASS http://$SMAPPEE_IP/gateway/apipublic/logon
    SMAP=$(curl http://${SMAPPEE_IP}/gateway/apipublic/reportInstantaneousValues)
  fi
apazga commented 7 years ago

Implemented in develop branch. I tested it for a few weeks and it's working fine, so I'll merge it soon into master branch too ;) https://github.com/apazga/smappee-domoticz-bash/tree/develop