Remote RPi GPIO on an Intel NUC

I am running my Home Assistant instance on an Intel NUC and I am wanting to control the GPIO pins on my RPi Zero for a custom video doorbell solution I’m working on.

I’m trying to use the remote_rpi_gpio component but I don’t see to be having any luck. For the moment I’m just adding a switch but I don’t seem to be getting anything coming up in Home Assistant, I’m not even getting any errors in the logs.

I’ve enabled everything I need to enable on the RPi as well as installed all the relevant dependencies.

From all the research I’ve been doing, am I correct in understanding that this integration will not work on an Intel NUC as it requires RPi.GPIO to be installed but you cannot on a NUC??

You can do it from HA installed on a NUC using a Raspberry Pi on your lan.

Did you follow this instructions?

https://gpiozero.readthedocs.io/en/stable/remote_gpio.html

If you already have an mqtt server set up you should be able to get this up and running quickly. It’s configured with YAML:

I connect HA to two remote Pi3s that have all their GPIOs connected to wired sensors running this.

Yes, I’ve followed all instructions on that link and installed everything that is required with still no luck.

Even adding it to my config.yaml doesn’t show the entity on my front end and no errors in the log. Surely I would be able to at least see the switch if it all built correctly right?

I’m running HASS as an image on my NUC, not in docker. Could this be the issue?

Hi there,

I thought about going down this route but haven’t got any experience using MQTT.

If I understand this right, I can install the MQTT add-on in HASS and then use that to connect to my raspberry pi?

Which you be able to post a small example of what your yaml would look like for a switch setup please?

Yes install and configure the Mosquitto MQTT broker addon.

Here is an example of the config file for the remote pi running pi-mqtt-gpio:

mqtt:
  host: 10.1.1.100 # replace this with your HA IP address
  port: 1883
  user: "mqtt_user" # this is the user and passsword you set up in Mosquitto
  password: "<removed>"
  topic_prefix: gpio_bridge_2 # anything you want here
  status_topic: status
  status_payload_running: online
  status_payload_stopped: offline
  status_payload_dead: offline

gpio_modules:
  - name: raspberrypi
    module: raspberrypi
    cleanup: yes

digital_inputs:
  - name: linen_cbd
    module: raspberrypi
    pin: 14
    on_payload: "ON"
    off_payload: "OFF"
    pullup: yes
    pulldown: no
    retain: yes

digital_outputs:
  - name: led_green
    module: raspberrypi
    pin: 5
    on_payload: "ON"
    off_payload: "OFF"
    initial: low
    retain: yes

Here are the corresponding home assistant binary sensor and switch:

binary_sensor:

- platform: mqtt
  state_topic: "gpio_bridge_2/input/linen_cbd"
  name: "linen_cbd"
  payload_on: 'ON'
  payload_off: 'OFF'
  qos: 0
  device_class: door

switch:

- platform: mqtt
  name: "led_green"
  command_topic: "gpio_bridge_2/output/led_green/set"
  state_topic: "gpio_bridge_2/output/led_green"
  availability_topic: "gpio_bridge_2/status"
  qos: 1
  payload_on: "ON"
  payload_off: "OFF"
  payload_available: "online"
  payload_not_available: "offline"
  retain: false

Thanks for that.

I’ve just given it a go but for some reason every time I go to start the service On the raspberry pi it just completely crashes and I lose all network activity.

I’ve never heard of that happening. Did you follow flyte’s install instructions? Which method did you use?

Yeah I followed all the instructions but I did manage to get it working. I realised I hadn’t entered the user info on both ends so doing that fixed it.

However, I’m just running the binary sensor for the moment to test and get it all working. I’ve copied your examples exactly and made sure everything matches from both ends. I’ve got that pin connected to a button. When I start the service on the raspberry pi the door sensor icon in HASS changes to match the script which tells me it’s at least reading what’s on the rpi which is a great start but when I press the button to change states, nothing changes. Any idea why?

Edit: In MQTT terms my MQTT broker on HASS is listening and receiving the messages from my RPi but my RPi is not recognising my button presses to change the state/status.

I created a separate little script to just test that my button is functioning properly and it is. Basically the button is low and when pressed its high.

So just a heads up, I did manage to get this to work in the end. My issue was 2 things. Firstly I was entering the actual PIN number rather than the GPIO number and secondly my pull up and pull down parameters were reversed. Changing these fixed it all perfectly.

Thank you so much for all your help. This has done exactly what I’m after. I‘ve created my own video doorbell using a RPi Zero, a simple push button and the RPi Camera module. Pressing the button launches the video on my Google Nest Hub and I plan to add some audio and/or text to speech.

Thanks again!

1 Like

Damn. I was initially going to mention that it uses Broadcom pin numbering. Could have saved you some pain there.

Glad you got it working. Sounds like a cool project. There’s a category for showing that sort of thing off :wink:

Yeah it’s always something so simple isn’t it. Cheers for all your help :slight_smile:

Once i finish it all properly i will post up the complete project in that category.