Daily kWh usage is calculated at midnight from the recorded previous day total daily seconds ON/3600 for hours X 0.325 kW.
In this case the cost savings are very small if the heater is only powered 7pm to 7am vs 24 hrs compared to other higher power devices like the electric hot water tank and hot tub.
AWAY mode (not implemented yet) will enable the bedside light to go on for a few hours in the evening for security. Random on and off times. It will use a second of four available 10A relays.
I could have AWAY mode also turn off the waterbed but it would have to be turned on again before returning because it could take 12 hrs to go from room temp to the setpoint again.
It could be programmed to turn on again based on the date of the day before returning or turned on remotely via MQTT. Temp could also be monitored remotely via MQTT.
You can also have it automatically put data into a cloud spreadsheet, viewable from anywhere, or send you an email or text via IFTT.
AUTO OFF means it is enabled all the time and only controls by temperature not time of day as well.
This is the sixth home automation project with NodeMCU. Total saving is $1,000+/year. Another example where a small change you won't notice can save you money.
Same components plus deicing cable used to preheat the long copper hot water line between the hot water tank and shower. This saves time, money, water and power.
NodeMCU, DS3231 clock and 30A 240VAC relay used to enable electric water heater only between 1 am and 7 am weekdays and weekends. Override from web page if needed.
Clock is also used to execute some code once only when t.Second() changes without using any delay(*)s.
I don't use Arduinos any more. Arduino IDE with add-ins is used to program NodeMCU.
Advantages of NodeMCU include:
1. Wireless programming. From the living room I can program any of the remote devices. You have to double and triple check you are connected to the right one before uploading.
2. Web page hosted on device for zero cost, zero I/O, high res, colourful display on phone, tablet or pc from anywhere on the same router using any browser. No app needed. To display the web page just put the local IP address of the NodeMCU device in any browser. Web page HTML code is among the control code. Only web page address of background JPEG is in the code not the JPEG file. No expensive, low res LCD display only available near device.
3. 32 bit chip. Far faster and more memory available for program, data and web page HTML instructions. Not limited to 16 bit 64K max integers. Seconds in a day is 86,400.
4. Smaller and cheaper than Arduino Uno.
5. Control and monitor from anywhere in the world with MQTT.
6. Data can be put into a Google cloud spreadsheet automatically with IFTT.
7. Data or alarms can be sent to your phone with a text or email automatically with IFTT.
8. Although I/O is less than Arduino Uno the I/O can be used as I2C and OneWire buses to talk to multiple smart devices like a real time clock, digital temperature sensor and expansion I/O chips like MCP23017 on same wires. With digital and analog expansion chips you can connect and control many more I/O.
9. Very reliable. Many power failures are not a problem at all. Reboots, reconnects to WiFi and restarts program no problem. No battery backup needed.
Website detailing all NodeMCU projects including component costs and an educational section for beginners is here: https://sites.google.com/site/nodemcu12e/