update
This commit is contained in:
@@ -359,10 +359,10 @@ CHECKTEMPSENSOR(){
|
||||
echo ${mqtt_message} | cut -d':' -f 7 | cut -d',' -f 1 | read temp_h
|
||||
|
||||
elif [ "${PW_SENSOR_TYPE[${1}]}" == "esphome" ]; then
|
||||
if ! temp_c=$(curl -m 8 -s GET -H "Authorization: Bearer ${PW_ESPHOME_API}" http://10.10.1.180:8123/api/states/sensor.${PW_SENSOR_DEVICEID[${1}]}_temperature | jq -r '.state') ; then TIMEOUT=1; fi
|
||||
if ! temp_c=$(curl -m 8 -s GET -H "Authorization: Bearer ${PW_ESPHOME_API}" ${PW_HOMEASSISTANT_URL}/api/states/sensor.${PW_SENSOR_DEVICEID[${1}]}_temperature | jq -r '.state') ; then TIMEOUT=1; fi
|
||||
if [ "${temp_c}" != "" ]; then
|
||||
temp_f=`IDS_NUMBER_FORMAT ${temp_c} 2 yes`
|
||||
temp_h=`IDS_NUMBER_FORMAT $(curl -m 8 -s GET -H "Authorization: Bearer ${PW_ESPHOME_API}" http://10.10.1.180:8123/api/states/sensor.${PW_SENSOR_DEVICEID[${1}]}_humidity | jq -r '.state') 2 yes`
|
||||
temp_h=`IDS_NUMBER_FORMAT $(curl -m 8 -s GET -H "Authorization: Bearer ${PW_ESPHOME_API}" ${PW_HOMEASSISTANT_URL}/api/states/sensor.${PW_SENSOR_DEVICEID[${1}]}_humidity | jq -r '.state') 2 yes`
|
||||
else
|
||||
temp_c=''
|
||||
fi
|
||||
@@ -620,10 +620,10 @@ CHECKTEMP_SERVICE_RUNSENSOR(){
|
||||
echo ${mqtt_message} | cut -d':' -f 6 | cut -d',' -f 1 | read temp_c
|
||||
|
||||
elif [ "${PW_SENSOR_TYPE[${SENSORa}]}" == "esphome" ]; then
|
||||
if ! temp_c=$(curl -m 5 -s GET -H "Authorization: Bearer ${PW_ESPHOME_API}" http://10.10.1.180:8123/api/states/sensor.${PW_SENSOR_DEVICEID[${SENSORa}]}_temperature | jq -r '.state') ; then TIMEOUT=1; fi
|
||||
if ! temp_c=$(curl -m 5 -s GET -H "Authorization: Bearer ${PW_ESPHOME_API}" ${PW_HOMEASSISTANT_URL}/api/states/sensor.${PW_SENSOR_DEVICEID[${SENSORa}]}_temperature | jq -r '.state') ; then TIMEOUT=1; fi
|
||||
if [ "${temp_c}" != "" ]; then
|
||||
temp_f=`IDS_NUMBER_FORMAT ${temp_c} 2 yes`
|
||||
temp_h=`IDS_NUMBER_FORMAT $(curl -m 5 -s GET -H "Authorization: Bearer ${PW_ESPHOME_API}" http://10.10.1.180:8123/api/states/sensor.${PW_SENSOR_DEVICEID[${SENSORa}]}_humidity | jq -r '.state') 2 yes`
|
||||
temp_h=`IDS_NUMBER_FORMAT $(curl -m 5 -s GET -H "Authorization: Bearer ${PW_ESPHOME_API}" ${PW_HOMEASSISTANT_URL}/api/states/sensor.${PW_SENSOR_DEVICEID[${SENSORa}]}_humidity | jq -r '.state') 2 yes`
|
||||
else
|
||||
temp_c=''
|
||||
fi
|
||||
@@ -986,9 +986,9 @@ Previous Temp: ${last_temp}${GAUGESH}"
|
||||
# if [ "${PW_REMOTE_SENSORS[${SENSOR}]}" != "" ] && [ "$(CHECK_HOST ${PW_REMOTE_SENSORS[${SENSOR}]})" != "false" ]; then
|
||||
touch ${PW_TMPFOLDER}/${SENSOR}.restart
|
||||
SENDNOTICE "Restarting TG-Outlet-2 to restart ServerRoomTemp" "ERROR reading ServerRoomTemp"
|
||||
RUN=$(curl -m 8 -s -H "Authorization: Bearer ${PW_ESPHOME_API}" -H "Content-Type: application/json" -d '{"entity_id": "switch.smart_15em_plug_in_2_socket"}' http://10.10.1.180:8123/api/services/switch/turn_off)
|
||||
RUN=$(curl -m 8 -s -H "Authorization: Bearer ${PW_ESPHOME_API}" -H "Content-Type: application/json" -d '{"entity_id": "switch.smart_15em_plug_in_2_socket"}' ${PW_HOMEASSISTANT_URL}/api/services/switch/turn_off)
|
||||
sleep 2s
|
||||
RUN=$(curl -m 8 -s -H "Authorization: Bearer ${PW_ESPHOME_API}" -H "Content-Type: application/json" -d '{"entity_id": "switch.smart_15em_plug_in_2_socket"}' http://10.10.1.180:8123/api/services/switch/turn_on)
|
||||
RUN=$(curl -m 8 -s -H "Authorization: Bearer ${PW_ESPHOME_API}" -H "Content-Type: application/json" -d '{"entity_id": "switch.smart_15em_plug_in_2_socket"}' ${PW_HOMEASSISTANT_URL}/api/services/switch/turn_on)
|
||||
# fi
|
||||
|
||||
elif [ ! -f ${PW_TMPFOLDER}/${SENSOR}-error.sent ] || ([ -f ${PW_TMPFOLDER}/${SENSOR}-error.sent ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/${SENSOR}-error.sent)) -ge $(echo "scale=0; ${PW_RENOTIFY_TIMEOUT}*60" | bc) ]); then
|
||||
|
||||
Reference in New Issue
Block a user