Controlling a gate

[I haven’t tried using Meshtastic yet, I’ve just been reading docs and source so far]

I have a gate at the end of my driveway, currently with an nrf52840 (pca10059), a couple of relays connected to GPIOs, and 4 limit switches also connected to GPIOs. There’s also an rfm9x LoRa radio (SX1276?). Currently I’m using Micropython at the gate and at the house I have a Pi with another rfm9x module and a Python script that interprets what’s happening at the gate and communicates that to HomeAssistant via MQTT. I’ve got the HomeAssistant ↔ MQTT infrastructure already working just fine.

It looks like Meshtastic might be a good fit but I’m not sure if I fully understand how my use cases can fit in. Thoughts welcome.

  1. I need HomeAssistant to be able to generate an MQTT message to briefly toggle one of the GPIO’s to open the gate.

  2. I need HomeAssistant to be able to generate an MQTT message to briefly toggle one of the GPIO’s to open the gate and when the limit switches are in a certain state, toggle another GPIO (which will cause the gate to stay open).

  3. I need HomeAssistant to periodically report the state of the limit switches (which tell me whether the gate is open, closed, or indeterminate state).

  4. I also need the nrf52840 to toggle one of the GPIO’s (to open the gate) when a specific BLE advertising message is received (which my phone will generate when I drive up in my truck or tractor). Ideally this would not require any communication with HomeAssistant or some other host at the house.

Monitoring the GPIOs (#3) seems doable with the Python CLI so getting the gate status into HomeAssistant is probably pretty straight forward.

Getting HomeAssistant to generate a single pulse (#1) to open the gate also seems doable.

However, #2 above may be more difficult. It requires pulsing one of the GPIO’s and then periodically monitoring the limit switches for 20-30 seconds, then pulsing the other GPIO once the limit switches report that the gate is fully Open.

#4 seems undoable but maybe the Android app can communicate with the nrf52840 in some way and maybe I can automate that on my phone. However, I’m guessing I can’t get the Android app to toggle a GPIO?

Here’s a photo for context.

1 Like