Sorry about not splitting this up into multiple commits. I tinkered locally and once I got it all working I got it all moved back to upstream the fixes and changes. Included in this PR is:
Fix compile errors (global variable was not capitalized).
Add ability to disable WiFi/MQTT for calibration, useful if you want to calibrate before connecting to WiFi/MQTT.
Add auto-reboot on number of failures so sensor auto-reconnects after MQTT server downtime. I noticed when I applied updates and had to reboot my MQTT server I had to unplug/replug the kit. Auto-rebooting after a number of errors fixes this.
Update sensor.yaml example to play nicer with Home Assistant. Sorry about the block change, I think that was my git client updating line endings. If you diff with no whitespace you see that its updating to add device classes for all sensors which lets Home Assistant auto-pick the right icon and such, and rounded so that you don't get 10 digit decimals on your dashboards.
Adds a KWh intergation sensor to the sensor.yaml file. If you correctly categorized the total wattage input as "power" (which is done here) and then add an integration pointing to it (also done here), then it makes the "energy_spent" sensor available on the Energy dashboard. So I added that as an example to anyone else going the Home Assistant route so it works pretty much out of the box to get hourly/daily usage graphs.
Sorry about not splitting this up into multiple commits. I tinkered locally and once I got it all working I got it all moved back to upstream the fixes and changes. Included in this PR is: