#How to integrate Ubuntu-RPi4-HA

1 messages Β· Page 1 of 1 (latest)

nocturne torrent
#

I am new to HA and I am here to seek suggestions/recommendations on what I'd like to achieve.

I currently have a Raspberry Pi 4B connected to an external hardware board with various I/O's. RPi4 runs on Ubuntu Server 22.04 LTS with specific device overlays for drivers to handle the I/O hardware board. Hardware related codes are written in C and user applications, in Python.

Now I would like to add HA to this project with some thoughts below:

1). Install HA onto the existing Ubuntu platform (via pip3 install homeassistant as suggested by CoPilot, have not tried yet) and use MQTT or http requests (which it already has) to send data to HA somehow. This approach is easier because all hardware related is already taken care. It is said that this installs the HA Core, which does not support Add-Ons. I assume this would make it harder to work with for a newbie.

2). Start fresh with HA OS on RPi4 and port over the existing Ubuntu-based software. I am not sure how HA OS handles hardware related software like drivers, device overlays, sudo, etc.. HA OS seems to be locked down.

3). Use Virtualization software somehow (Proxmox, VirtualBox, or KVM as suggested by CoPilot).

I'd appreciate very much for any suggestion/recommendation that you have on the best way to go about it. Thanks.

topaz trout
#

i have not done this, but the listed options for raspberry pi are local install as you say with pip or in a container.

#

for generic ilinux nstall there is also a howto for running supervised, but they say debian is the only supported os. not any variations built on debian.

#

both the pip install and the container will not support add-ons

ruby crag
#

Hi @nocturne torrent

1: ... Install HA onto the existing Ubuntu platform (via pip3 install homeassistant as suggested by CoPilot
HAOS doesn't load from pip, and loading Home Assistant which is a full OS will delete everything else. AI FAIL...
2: ... HA OS seems to be locked down
It is.
3: ... Use Virtualization software
This could work, but a Pi frankly will not have enough resources to handle HAOS, a VM, and other stuff.

#

A PI 4 is often not enough for HA alone, MANY start there, then get an N100, Beelink, or some old Computer to have enough horsepower to do it.

topaz trout
#

if you load up with a lot of add-ons i think your primary bottleneck will be io to sd-card. those cards have seriously limited iops even when you use a2 class cards. a usb3 to sata cable and a cheap ssd will unlock incredible potential.

ruby crag
#

Putting Pi4 and incredible potential in the same thought is pure fantasy.

topaz trout
#

compared to what you get if you run anything database-like on sd-card, yes.

ruby crag
#

It may be 10x the SD card, but probably 5% of what an actual computer does.

topaz trout
#

i think the new raspberry pi branded sd cards may be a lot better than most others, simply because they implement command queuing. but why not remove the bottleneck completely. buy a usb3 to sata cable for almost nothing from aliexpress.

#

use any old 120GB SSD you have in a drawer somewhere

#

it's a performance boost for almost no money

#

@tc2025 don't trust some ai to tell you how to do it. read the howto i linked to above. decide if the container or the pip install will be best for you. container sounds easier.

nocturne torrent
#

Thanks for all your inputs... it's my very first step digging into this integration, so I used CoPilot to get some ideas first

topaz trout
#

for the container you will have to set up passthrough for devices. with your hardware in mind the pip may be easier. but that will be up to you.

#

i have seen too many hallucinations from ai. and those install docs seem to be up to date since they list 2025.1.1 in the pip install command

nocturne torrent
#

so far, my current applications do not use much CPU or RAM resources from 4B-2G, and I use log2ram for all logs, so SD card does not really get used often. I do not know how HA works wrt SC card, like how often it writes to it. HA should run its software on RAM, I'd think.

#

CoPilot says HA Core is a simpler way and uses less resources as compared to virtualized HAOS, which you need to pre-allocate in setting up VM.

topaz trout
#

i would not try virtualized. but the container shouldn't require much more than the core install

nocturne torrent
#

Yes, you are right... CoPilot makes things look too easy

topaz trout
#

it will be a little better insulated from other stuff, but as i said you must pass through explicitly all resources at host level it is allowed to see

nocturne torrent
#

I spent a lot of time following some recommendations but did not work when I worked on WebRTC

topaz trout
#

ha changes all the time, and ai gets very locked onto info it finds most often in inputs. which means it often gets stuck in the past, or halluciates up combinations of past and present that have never been meant to work πŸ˜„

nocturne torrent
#

minutes ago, it suggests running additional services as Docker containers alongside Home Assistant Core

#

not sure how difficult it is to install add-ons to HA Core, but what it suggests seems reasonable

topaz trout
#

ha core does not support installing add-ons in the container. so you would have to install those yourself. i would say as containers. and then set up the corresponding integrations in core to point to your external add-ons.

nocturne torrent
#

In my HA, I think I will have basic applications and use data from my existing Ubuntu software. It pre-processes pretty much everything into csv records. HA simply presents the data to users.

topaz trout
#

that's pretty much what ha does anyway. add-ons run in containers and then the integrations point to them. but when the supervisor in ha is in control of it all it gets a little more user firendly

nocturne torrent
#

yes, it says I have to install add-on manually

#

an example of MQTT:
sudo docker run -d --name mosquitto -p 1883:1883 -p 9001:9001 eclipse-mosquitto

topaz trout
nocturne torrent
#

and then add to configuration file :
mqtt:
broker: localhost
port: 1883

topaz trout
#

container and core (pip install) seem pretty much alike

#

of course with container you can point to :latest and will get upgraded just by restarting the container πŸ˜„ if you dare

nocturne torrent
#

I am new to HA so I'd not dare doing anything adventurous but get the basic working/figured out first

topaz trout
#

there are some differences there compared to the official guide.

nocturne torrent
#

it gets the info from here:

light zealot
topaz trout
#

the official guide does not explicitly set python 3.12. just python 3. otoh the pip install uses a specific version of homeassistant, which copilot doesn't

#

compare the two and see if copilot has any good ideas, or if you should stick to the official docs

nocturne torrent
#

this is something I have to experiment with

light zealot
#

Unless you are familiar with python, using plain core is bound to result in headache. Use the docker variant instead.

nocturne torrent
#

I will start with a fresh SD card with Ubuntu 22.04 LTS and then follow its steps and see

light zealot
#

Just curious. Why 22? Or why ubuntu at all?

nocturne torrent
#

I will have headache regardless...

dusty mauveBOT
#

ChatGPT and other "AI" systems do a fantastic job of generating well structured, convincing looking answers... that are either totally garbage or, if you're lucky, have subtle flaws. Don't use them to "help" others, and don't use them yourself.

topaz trout
#

see the original post

nocturne torrent
#

I believe that...

topaz trout
#

what kind of data will you be pushing into ha? and what kind of automations are you interested in?

nocturne torrent
#

but it is a good starting point when you have no knowledge of whatsoever

light zealot
#

Hard to learn something if you can't trust the instructor. You need to have enough knowledge to know what is correct.

nocturne torrent
#

one of the data type deals with energy consumption... my existing app already reads Modbus meters and calculates all energy consumption data Hourly, weekly, monthly and also generates alarms on various power parameters. It also has visualization on a web page using Google Charts. Now I want to bring that to HA.

topaz trout
#

if all you want is visualization then maybe influxdb and grafana is what you need instead of ha?

nocturne torrent
#

yes, that is true that you need to start with a good instructor, but for me at this time it does speed up information search.

#

I plan to use HA for other automation tasks as well

topaz trout
#

ok. then it makes more sense

nocturne torrent
#

lots to do with IoT sensors/devices...

#

it would take forever to integrate those from scratch

#

it's the whole community work for HA

#

I will do some experiment later on and report back here

light zealot
#

My energy meter is read via tasmota SML and goes into VictoriaMetrics as power (watt) and energy total (KwH) so I can dynamically graph it via Grafana. I can select a period of 2 days for example and calculate based on just that. Grafana can also alert. I believe ESPHome can read your sensor as well. Might be of interest if you want to overhaul any of your setup.

nocturne torrent
#

yes, I will take a look at that. For me, this project handles many things in addition to energy meters. I am crossing the boundary and into IoT sensors for additional things that I want to achieve.

topaz trout
#

i have a smart meter, and i am waiting for the reader that interfaces to the port on that meter to arrive tomorrow. that reader sends mqtt messages over wifi, so should be very easy to integrate into ha

nocturne torrent
#

I think once you have mqtt data, it's easier for integration wrt data collection.

#

you can always get values such as kWh, kVAh, kVARh, and so on as there are many. I think you still need to do some calculations after depending what you want to get, like Hourly, Daily, and Monthly usage

topaz trout
#

i just set up ha integration with nordpool today so i can get the hourly spot prices for electricity. will use that to issue warnings on the dashboard running on my living room tv whenever it is idle. look at energy consumption vs price, recommend when to get laundry started etc.

nocturne torrent
#

that's one of the purposes for HA

light zealot
topaz trout
#

my electricity prices today and tomorrow

nocturne torrent
#

here, we just do laundry after hours at lower rate, automatically without HA...

topaz trout
#

it's not that simple when you are on spot price

nocturne torrent
#

we have ToU rates here, so we know exactly the time periods

topaz trout
#

the graph shows why i did my laundry today πŸ˜„

nocturne torrent
#

so HA helps

topaz trout
#

at 11 each day we can get the prices for the following day

nocturne torrent
#

we do it on the weekend, so it does not matter, all flat rate

#

How do you get the rates in advance, for the next day?. Is there some website to read from?

topaz trout
#

yes, it's from the european trading site for power.

nocturne torrent
#

must be utility specific website

topaz trout
#

it's called nordpool

#

utilities will also mirror the data, yes

nocturne torrent
#

Ok, I did not know that from your last message

#

for EU only?

#

or other regions as well?

topaz trout
#

not all of eu i think

nocturne torrent
#

any idea on how to get similar data for other regions?

topaz trout
#

all of these are covered by the nordpool integration in ha at least. you need to choose your area. i am in NO5

nocturne torrent
#

Ok, I will take a look

#

I am just outside of Toronto

topaz trout
#

i guess the closest i have been to toronto would be seattle

nocturne torrent
#

yes, that is very close πŸ™‚

#

like going across the whole Canada W to E

topaz trout
#

or maybe new orleans is actually closer?

#

the only 2 places i have been to on that continent

nocturne torrent
#

I've been to many places in Europe but not Norway, only see Norway through Vikings movies

topaz trout
#

the plane to seattle came in over the wilderness in northwestern canada. i could feel it calling for me. πŸ˜„

nocturne torrent
#

you've probably heard that calling from the moose...

nocturne torrent
#

I followed the instructions on HA official home page to install HA Core on Ubuntu Server 24.04 LTS/RPi4B-2GB. It installed and HA Core starts up Ok. The prerequisite for Python 3.13 as stated on the web page is true. I got a warning with Ubuntu default install of Python 3.12.3 when HA Core starts up, as it says this version will not be supported with HA 2025.2. I upgraded to Python 3.13.1. Overall, the installation process seems to go through Ok.