From 290e0e815d3464debfd1b56984e638676d0cdc44 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Thu, 14 Dec 2023 15:25:11 -0600 Subject: [PATCH] update --- defaults.inc | 3 +++ inc/temp.inc.sh | 16 +++++++++++++++- powerwall.sh | 6 +++--- run.sh | 16 ++++++++-------- 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/defaults.inc b/defaults.inc index cd3e4c30..19057680 100755 --- a/defaults.inc +++ b/defaults.inc @@ -12,9 +12,11 @@ mqtt_conn='/usr/bin/mosquitto_sub -h 127.0.0.1 -u mqtt -P 12mqtt34password56' mysql_conn='/usr/bin/mysql' PW_FOLDER='/opt/idssys/powerwall' +PW_INCFOLDER=${PW_FOLDER}/inc PW_LOGFOLDER=${PW_FOLDER}/logs PW_LOGARCHIVE=${PW_FOLDER}/logs/archive PW_TMPFOLDER=${PW_FOLDER}/.tmp +[ ! -d ${PW_INCFOLDER} ] && mkdir ${PW_INCFOLDER} [ ! -d ${PW_LOGFOLDER} ] && mkdir ${PW_LOGFOLDER} [ ! -d ${PW_LOGARCHIVE} ] && mkdir ${PW_LOGARCHIVE} [ ! -d ${PW_TMPFOLDER} ] && mkdir ${PW_TMPFOLDER} @@ -53,6 +55,7 @@ if [ -f ${PW_FOLDER}/settings.local.conf ]; then declare -A PW_INVERTER_STATES declare -A PW_INVERTER_MODES declare -A PW_INVERTER_ERRORS + declare -A PW_TASMOTA_ID source ${PW_FOLDER}/settings.local.conf diff --git a/inc/temp.inc.sh b/inc/temp.inc.sh index e7e35f91..f4670cd3 100644 --- a/inc/temp.inc.sh +++ b/inc/temp.inc.sh @@ -512,4 +512,18 @@ DAILYTEMP(){ done [ "${temp_c}" != "null" ] && [ "${temp_c}" != "" ] && echo done -} \ No newline at end of file +} + +GET_TASMOTA_INFO(){ + + device_info=$(python ${PW_INCFOLDER}/getInfo.tasmota.py "${PW_TASMOTA_ID[${1}]}") + + echo ${device_info} + +} + + + + + + diff --git a/powerwall.sh b/powerwall.sh index dd179472..a199adf8 100755 --- a/powerwall.sh +++ b/powerwall.sh @@ -7,8 +7,8 @@ source /opt/idssys/defaults/colors.inc source /opt/idssys/defaults/default.inc source /opt/idssys/powerwall/defaults.inc -source ${PW_FOLDER}/inc/power.inc.sh -source ${PW_FOLDER}/inc/temp.inc.sh +source ${PW_INCFOLDER}/power.inc.sh +source ${PW_INCFOLDER}/temp.inc.sh # TEST=true @@ -890,7 +890,7 @@ fi ;; esac ;; - test) CHECKTEMP ${2} ${3};; + test) GET_TASMOTA_INFO ${2} ${3};; iscsi-vm-shutdown) [ "${2^^}" == "SYS" ] && ISCSISYSVMSHUTDOWN || ISCSIVMSHUTDOWN ;; diff --git a/run.sh b/run.sh index 23520747..4fa3ed8c 100755 --- a/run.sh +++ b/run.sh @@ -45,14 +45,14 @@ if [ "${1}" == "update" ]; then echo -en "\e[1A"; echo -e "\e[0K\r ${idsCL[Green]}Update to v${VERS} complete${idsCL[Default]}\n" fi - read -n 1 -p "Do you want to restart PowerWall Services? (y/N): " choice - case "$choice" in - [Yy]) - echo -e "\n\n${idsCL[Yellow]}Restarting Powerwall services to apply update ..." - ${PW_SCRIPT} service all restart - ;; - *) echo;; - esac + # read -n 1 -p "Do you want to restart PowerWall Services? (y/N): " choice + # case "$choice" in + # [Yy]) + # echo -e "\n\n${idsCL[Yellow]}Restarting Powerwall services to apply update ..." + # ${PW_SCRIPT} service all restart + # ;; + # *) echo;; + # esac elif [ "${2}" != "q" ]; then echo -en "\e[1A";