Smart Thermostat for Water and Electric Heating Systems