Added relay support and switch wifi check logic to interval based instead of event based.
Added stats
Reformatted
Added mathjs dependency