Control raspberry pi (sensors, actors) via Home Assistant running on different device

Tags: #<Tag:0x00007f326d3d27b8> #<Tag:0x00007f326d3d24e8> #<Tag:0x00007f326d3d23d0>

Hi everybody,

do any of you control a raspberry pi that is not running Home Assistant itself, but use Home Assistant to control it?

previous attempt

I read about a grandfather clock in share your projects! ages ago and decided to write my own. The sound files were on a raspberry pi, and Home Assistant would ssh into this pi via pubkey without password, then run mpv file1/file2 every half and full hour. This worked fine. However, it was one-way (Home Assistant to pi) and will not work for my new project.

what i am trying to do

I have dozens of ESP8266 devices (mostly nodeMCU v3 and Wemos D1 mini) running either ESPHome or tasmota. They all do one thing, or some of them a few things - and they do them wel. But they are kinda limited because I have to rely on what the developers provide (for example, ESPHome can only be used for what is already programmed in there, as I do not have the knowledge to modify the actual source code).

My irrigation system is currently an ESPHome controlling a relay which controls multiple 12V valves. Logic is handled by Home Assistant, the rest is done by the nodemcu. Easily done via ESPHome. However, I want to add more things to it, and as it is in a location where I already use an IP camera, I’d like to add a pi cam replacing the existing camera, so a raspberry pi seems like a better solution. I know esphome is capable of many things, but in this case, a pi seems easier for me with my limited programming skills (I know some bash and python, but always get lost when it comes to C++ etc.).

This hardware is supposed to interact with the pi

  • multi relay
  • ds18b12
  • multiple contactless water level sensors (analog, hopefully be able to use mcp3008 for this - have to wait for those to arrive)
  • lux sensor
  • speakers (likely via mpd on the pi)
  • camera (likely via motion unless there is a better solution)
  • will add more things in the future

I tested this using mqtt. The problem here is that each sensor/actor has it’s own little python script. So one script for transmitting the values ready be ds18b12, one for transmitting the lux sensor readings, etc. etc. As I said earlier, my programming skills aren’t that developed, so I didn’t manage to write a script for everything. Especially two things are difficult to me

  1. publishing and receiving data and/or commands via script at the same time and acting on received commands while still publishing data
  2. handling multiple actions (for example, publish one sensor’s data every 30 seconds, yet the other sensor’s data every 10 seconds, or only when value changes) in one script

So I’ll either be running multiple scripts all the time, or this project will not be done for ages until I learned enough to do all this.

I also thought of installing node-red onto that pi and have it interact with Home Assistant via mqtt or the Home Assistant node. While this should work, I doubt that node-red will run decently on a raspberry pi zero, which I was going to use for this project.


Is there some fool proof way to have a raspberry pi act as an “extension of Home Assistant” that will not need many ressources (run on pi zero), but be reliable at the same time? Or should I run Home Assistant on the pi with home-assistant-remote? I was hoping to only have one instance of Home Assistant for the entire network, but perhaps this is the way to go?

Thank you for your ideas.

Not sure it will do everything you want (speakers for example), but this is what I use for multiple hard-wired sensors and outputs (I have two Raspi’s running this as I ran out of i/o):

1 Like

Thanks, Tom! This project looks awesome. Technically it could do what I want (because I can still install mpd on that pi and control it via Home Assistant). The only thing is that most of the sensors I already own don’t seem to be supported, so I’ll have to find a different solution - but I’ll keep this project in mind and look for updates.