diff --git a/usermods/PIR_sensor_switch/usermod_PIR_sensor_switch.h b/usermods/PIR_sensor_switch/usermod_PIR_sensor_switch.h
index 6e20957e..73216684 100644
--- a/usermods/PIR_sensor_switch/usermod_PIR_sensor_switch.h
+++ b/usermods/PIR_sensor_switch/usermod_PIR_sensor_switch.h
@@ -250,50 +250,53 @@ public:
else
{
uiDomString += "true";
- sensorStateInfo = "Disabled !";
+ sensorStateInfo = "Disabled!";
}
uiDomString += "});return false;\">";
uiDomString += sensorStateInfo;
uiDomString += "";
infoArr.add(uiDomString); //value
- //this code adds "u":{"⏲ switch off timer":uiDomString} to the info object
- uiDomString = " switch off timer\
+ if (m_PIRenabled)
+ {
+ //this code adds "u":{"⏲ switch off timer":uiDomString} to the info object
+ uiDomString = " switch off timer\
after min";
- infoArr = user.createNestedArray(uiDomString); //name
+ uiDomString += (m_switchOffDelay / 60000);
+ uiDomString += "\" onchange=\"requestJson({PIRoffSec:parseInt(this.value)*60});\">min";
+ infoArr = user.createNestedArray(uiDomString); //name
- // off timer
- if (m_offTimerStart > 0)
- {
- uiDomString = "";
- unsigned int offSeconds = (m_switchOffDelay - (millis() - m_offTimerStart)) / 1000;
- if (offSeconds >= 3600)
+ // off timer
+ if (m_offTimerStart > 0)
{
- uiDomString += (offSeconds / 3600);
- uiDomString += " hours ";
- offSeconds %= 3600;
+ uiDomString = "";
+ unsigned int offSeconds = (m_switchOffDelay - (millis() - m_offTimerStart)) / 1000;
+ if (offSeconds >= 3600)
+ {
+ uiDomString += (offSeconds / 3600);
+ uiDomString += " hours ";
+ offSeconds %= 3600;
+ }
+ if (offSeconds >= 60)
+ {
+ uiDomString += (offSeconds / 60);
+ offSeconds %= 60;
+ }
+ else if (uiDomString.length() > 0)
+ {
+ uiDomString += 0;
+ }
+ if (uiDomString.length() > 0)
+ {
+ uiDomString += " min ";
+ }
+ uiDomString += (offSeconds);
+ infoArr.add(uiDomString + " sec");
}
- if (offSeconds >= 60)
+ else
{
- uiDomString += (offSeconds / 60);
- offSeconds %= 60;
+ infoArr.add("inactive");
}
- else if (uiDomString.length() > 0)
- {
- uiDomString += 0;
- }
- if (uiDomString.length() > 0)
- {
- uiDomString += " min ";
- }
- uiDomString += (offSeconds);
- infoArr.add(uiDomString + " sec");
- }
- else
- {
- infoArr.add("inactive");
}
}
@@ -323,9 +326,9 @@ after =0 && pinManager.allocatePin(pin,false)) {
// deallocate old pin
@@ -379,8 +382,8 @@ after