@@ -265,6 +265,7 @@ m_szSerialPort(devname)
265
265
m_allNodesQueried = false ;
266
266
m_awakeNodesQueried = false ;
267
267
m_bInUserCodeEnrollmentMode = false ;
268
+ m_bNightlyNetworkHeal = false ;
268
269
m_pManager = NULL ;
269
270
}
270
271
@@ -745,6 +746,11 @@ bool COpenZWave::OpenSerialConnector()
745
746
OpenZWave::Manager::Get ()->AddDriver (m_szSerialPort.c_str ());
746
747
#endif
747
748
m_LastControllerConfigWrite = mytime (NULL );
749
+
750
+ int nightly_heal = 0 ;
751
+ m_sql.GetPreferencesVar (" ZWaveEnableNightlyNetworkHeal" , nightly_heal);
752
+ m_bNightlyNetworkHeal = (nightly_heal != 0 );
753
+
748
754
// Manager::Get()->AddDriver( "HID Controller", Driver::ControllerInterface_Hid );
749
755
return true ;
750
756
}
@@ -2727,14 +2733,29 @@ void COpenZWave::GetNodeValuesJson(const unsigned int homeID, const int nodeID,
2727
2733
root[" result" ][index][" config" ][ivalue][" LastUpdate" ] = " -" ;
2728
2734
ivalue++;
2729
2735
2736
+ // Nightly Node Heal
2737
+ root[" result" ][index][" config" ][ivalue][" type" ] = " short" ;
2738
+
2739
+ int nightly_heal = 0 ;
2740
+ m_sql.GetPreferencesVar (" ZWaveEnableNightlyNetworkHeal" , nightly_heal);
2741
+ root[" result" ][index][" config" ][ivalue][" value" ] = nightly_heal;
2742
+
2743
+ root[" result" ][index][" config" ][ivalue][" index" ] = 3 ;
2744
+ root[" result" ][index][" config" ][ivalue][" label" ] = " Enable Nightly Heal Network (04:00 am)" ;
2745
+ root[" result" ][index][" config" ][ivalue][" units" ] = " " ;
2746
+ root[" result" ][index][" config" ][ivalue][" help" ] =
2747
+ " Enable/Disable nightly heal network. Disabled=0, Enabled=1 " ;
2748
+ root[" result" ][index][" config" ][ivalue][" LastUpdate" ] = " -" ;
2749
+ ivalue++;
2750
+
2730
2751
// Network Key
2731
2752
root[" result" ][index][" config" ][ivalue][" type" ] = " string" ;
2732
2753
2733
2754
std::string sValue = " 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10" ;
2734
2755
m_sql.GetPreferencesVar (" ZWaveNetworkKey" , sValue );
2735
2756
root[" result" ][index][" config" ][ivalue][" value" ] = sValue ;
2736
2757
2737
- root[" result" ][index][" config" ][ivalue][" index" ] = 3 ;
2758
+ root[" result" ][index][" config" ][ivalue][" index" ] = 4 ;
2738
2759
root[" result" ][index][" config" ][ivalue][" label" ] = " Security Network Key" ;
2739
2760
root[" result" ][index][" config" ][ivalue][" units" ] = " " ;
2740
2761
root[" result" ][index][" config" ][ivalue][" help" ] =
@@ -2896,6 +2917,18 @@ bool COpenZWave::ApplyNodeConfig(const unsigned int homeID, const int nodeID, co
2896
2917
}
2897
2918
}
2898
2919
else if (rvIndex == 3 )
2920
+ {
2921
+ // Nightly Node Heal
2922
+ int nightly_heal = atoi (ValueVal.c_str ());
2923
+ int old_nightly_heal = 0 ;
2924
+ m_sql.GetPreferencesVar (" ZWaveEnableNightlyNetworkHeal" , old_nightly_heal);
2925
+ if (old_nightly_heal != nightly_heal)
2926
+ {
2927
+ m_sql.UpdatePreferencesVar (" ZWaveEnableNightlyNetworkHeal" , nightly_heal);
2928
+ m_bNightlyNetworkHeal = (nightly_heal != 0 );
2929
+ }
2930
+ }
2931
+ else if (rvIndex == 4 )
2899
2932
{
2900
2933
// Security Key
2901
2934
std::string networkkey = ValueVal;
@@ -3031,5 +3064,12 @@ bool COpenZWave::RemoveUserCode(const unsigned int homeID, const int nodeID, con
3031
3064
return true ;
3032
3065
}
3033
3066
3067
+ void COpenZWave::NightlyNodeHeal ()
3068
+ {
3069
+ if (!m_bNightlyNetworkHeal)
3070
+ return ; // not enabled
3071
+ HealNetwork ();
3072
+ }
3073
+
3034
3074
#endif // WITH_OPENZWAVE
3035
3075
0 commit comments