10/06/2019 at 03:12 •
As it turns out it was just a loose wire that caused the loss of battery telemetry data. Swapped it out, tightened down and it's now working as expected!
09/08/2019 at 20:38 •
I've had my father wiggle wires and even move the VCC detection wire of the voltage divider and I'm still not getting a good reading on the battery voltage. This is perplexing since it was working when first installed, but it quickly went downhill. Not sure what the problem could be but I'll have to put a volt meter on it..
09/08/2019 at 20:33 •
As I've observed MQTT data there have been a few things I needed to tweak. Traditionally with ESPHome you would edit code through the console and click "upload". Since this device is deployed remotely I needed a way to update the code without going on-site. Using ESPHome's web_server component and a raspberry pi I was able to make this happen.
I have a raspberry pi on the remote network create a persistent tunnel back to my server, allowing me to get back into it without creating NAT rules on the modem. After logging into the rpi I simply create another reverse tunnel between my local workstation and the D1's web server:
/usr/bin/autossh -M 0 username@local_workstation -p 24 -o "StrictHostKeyChecking=no" -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -N -R 9993:192.168.1.129:80
The above makes the D1's web server dashboard available on my localhost:9993. From there I can use the "OTA Update" to upload a compiled binary with my changes.
09/08/2019 at 20:21 •
This build works just as I'd expect, I'm very pleased with how it turned out. I do have a couple of concerns:
1. The cat5 I've used is only plenum rated (if that). I didn't bury it in any conduit so there's a decent chance that it will degrade, ingest water, etc. We'll see if this has near-term affects on the function, in the long term it should almost certainly be laid in a conduit, time will tell.
2. The D1 Mini has a voltage divider on A0 already. It feels weird to stack the voltage dividers and my reading*15.43 was the result of some basic circuit simulation and real-world testing. In addition, the voltage sensor is not currently functioning as I'd expect. I suspect the cable on the battery terminal is loose. In hindsight I should have soldered the sensor wire onto a washer to be tight alongside the other wiring on the battery + terminal. I also didn't attach the GND to the voltage divider. I don't *think* it's necessary since the whole system is battery powered and *should* share the same ground but I'm not an electrical engineer. The D1 pulls power from the gate circuit board's +12v and GND terminals.
3. I'm not sure how well the IP66 Sonoff box will do underground in the rock driveway long term. The PVC pipe was a last minute addition and probably the saving grace. Even still I don't know if the plexiglass cover on the junction box will eventually get cracked from pressure or have water seep in by another means.