With the below resident script I'm getting the correct actions with GA '0,56,5' ramping up over 17 minutes and down over 5 minutes but when level is at 255 and the script runs again it resets level to 255 over another 17minutes and the level sits in a looped state neither "on" or "off".and the level is unreadable. How do I get it to not loop but still reset the ramp up if level is anything other than true "less than 255" Code: SOC= GetCBusMeasurement( 0, 50, 48) discharge = GetCBusMeasurement( 0, 50, 50) level = GetCBusLevel(0, 56, 5) if ( SOC>92) and ( discharge<300) then -- Set '0/56/5' to "ON" over 17 minutes SetCBusLevel(0, 56, 5, 255, 1020) log (SOC,discharge,level, state) elseif ( SOC<90) or ( discharge>1000) then -- Set '0/56/5' to "OFF" over 5 minutes SetCBusLevel(0, 56, 5, 0, 300) log (SOC,discharge,level) end
I think I've sorted it out. Code: SOC= GetCBusMeasurement( 0, 50, 48) discharge = GetCBusMeasurement( 0, 50, 50) level = GetCBusLevel(0, 56, 5) -- Get state of application 56 group 1 on the local network state = GetCBusState(0, 56, 5) if ( SOC>92) and ( discharge<300) and (level<250) then -- Set '0/56/5' to "ON" over 17 minutes SetCBusLevel(0, 56, 5, 255, 1020) log (SOC,discharge,level, state) elseif ( SOC<90) or ( discharge>1000) then -- Set '0/56/5' to "OFF" over 5 minutes SetCBusLevel(0, 56, 5, 0, 300) log (SOC,discharge,level, state) end