Fixed khtool set.
Added by-based spam prevention to sync (does not really matter due to non-replayability of prdb logs, but it looks nicer in logs).
Non-polling algorithm. It reacts to almost everything, except sunlight change (but usually some sensor triggers changes anyway). Should perhaps add suncalc as yet another event source.