So ive played about and have a working solution to my problem, bit clunky but it works and I have no more freaky habpanel. (single item example)
i have created a proxy item for each item in play here to act as a lock (string)
Switch Lightwave_BBarLeft_switch "BBar Left" <switch> (GroupGroundSockets)
String Lightwave_BBarLeft_switch_Lock
exec is collecting json every 10 seconds:
Thing exec:command:LwGet [ command="sh /share/QPKGs/OpenHab/conf/scripts/Lw_Get.sh %2$s", interval=6,timeout=10, autorun=true ]
when the output is changed a rule fires to go through all the items and post updates if its not locked:
`if(Lightwave_BBarLeft_switch_Lock.state.toString == ""){if(transform("JSONPATH","$.5c7d64783c570522afb151b5-76-3157331848+1", Readme) == "1"){Lightwave_BBarLeft_switch.postUpdate(ON)} else {Lightwave_BBarLeft_switch.postUpdate(OFF)}}
In the meantime, my rule to update on change is like so to add the lock:
//BBar Left switch Rules
rule "BBar Left switch Rule" when Item Lightwave_BBarLeft_switch received command then
val temp = now
Lightwave_BBarLeft_switch_Lock.postUpdate(temp.toString)
if(receivedCommand==ON){LwUpdate_Inp.sendCommand("5c7d64783c570522afb151b5-76- 3157331848+1 " + Access_Token.state.toString + " 1")}
else if (receivedCommand==OFF){LwUpdate_Inp.sendCommand("5c7d64783c570522afb151b5-76-3157331848+1 " + Access_Token.state.toString + " 0")}
createTimer(now.plusSeconds(10),[|
if(Lightwave_BBarLeft_switch_Lock.state.toString == temp.toString)
{Lightwave_BBarLeft_switch_Lock.postUpdate("")}])
end
so this puts the current date/time in a variable.
it posts this to the lock proxy item.
it then updates the api (right now if the refresh rule runs it cant update the item as its locked)
i then run a timer equal to the interval of the refresh rule to make sure it doesnt pass values.
when this timer finishes it takes the lock off, only if the date is still from this run, this way if the state is changed again then the next run would remove the lock
obviously the downside is that if i change the switch in the devices app or manually on the switch then it wont hit openhab for upto 10 seconds, however this is only if the state has been changed from within openhab at basically the same time, probably not going to happen tbh.
I also chose to do this on a ‘per item’ basis rather than the whole refresh rule as then things such as the current power usage will still update