Can't get it to work ? (Home Assistant MQTT & SMAhub) #38
Replies: 8 comments 13 replies
-
Update, if someone having similar issues and stumbles across this: Some additional hours of youtube videos, written guides/blogposts reading and sifting through official documentation to learn a bit more of the components... like a container running This led me to play around a bit more, and for testing purposes set up the following:
docker-compose.yaml for reference
With this setup, I can easily access the mosquitto broker container with MQTT Explorer,where I can see that smahub is pouring data onto it, with the TriPowerXXXXXXXX (where XXXXXX is the serial of my inverter) as Topic. And while this confirms that I got the SMA hub to work, it still puts me back to square 1 in terms of getting the data to the HA-MQTT broker... Sidenote: I keep running into the following error message when trying the mosquitto_pub or _sub commands... and it doesn't matter if I run them in side the "new" mosquitto broker, from my linux host or from the HAOS terminal. Think I've run out of google-replies to read on this, but no anwer seems to match my setup/situation.
|
Beta Was this translation helpful? Give feedback.
-
Hm... sounds tricky. One thing on your mosqitto_sub command: I think you're using a small p ('-p') to set the password - but small p is for passing the network port to connect to. For password, use a capital P ('-P') Fyi: the smahub container config uses the 'host' network to enable smahub to receive SHM2 broadcast data frames - when you're not using SHM2, it should be possible to use smahub without network: host. I don't really have a good idea how to pursue this; with the mosquitto_sub command 'fix' above, can you subscribe/publish to the HA MQTT instance from a shell on your linux system? |
Beta Was this translation helpful? Give feedback.
-
Same user and pwd from mqtt explorer as in the smahub config and from the
mosquitto_pub command, with the same ip as host (ie the HAOS vm's IP)
And yes, the stand alone used user & pwd as well.
Den lör 10 feb. 2024 22:03Daniel ***@***.***> skrev:
… Ok, and just to be sure: the exact same config does not work with smahub?
Another question: your standalone mqtt broker, did that use user/password
authentication?
—
Reply to this email directly, view it on GitHub
<#38 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BFYXGSPHJCXVEVRROZOBTUTYS7OAZAVCNFSM6AAAAABC6Q7EA2VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DIMRZGY4DE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Yes, works fine
Den lör 10 feb. 2024 22:27Daniel ***@***.***> skrev:
… Strange.
On the machine where the smahub container runs (while it is running), can
you do
docker exec -it smahub sh
(smahub is the container name)
and then, in the in-container shell, ping the ip of your mqtt broker?
—
Reply to this email directly, view it on GitHub
<#38 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BFYXGSIC2TAQKTXEVRUJ4ZTYS7Q3ZAVCNFSM6AAAAABC6Q7EA2VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DIMRZG44DK>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Yeah, me too... :D
Will see if I can find more detailed logs on the HA MQTT side that might
show if the smahub traffic reaches it at all... or simply switch to a pure
container setup with stand alone broker. Getting the info from the inverter
is sort of the main purpose of my HA "journey" :)
Thans for the help and effort! If I stumble across a solution I'll update
the thread again.
Cheers & Have a nice weekend!
Den lör 10 feb. 2024 22:56Daniel ***@***.***> skrev:
… Pretty much out of ideas, then. Phew...
—
Reply to this email directly, view it on GitHub
<#38 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BFYXGSO4GIADW55JFSIYHATYS7UJJAVCNFSM6AAAAABC6Q7EA2VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DIMRZHEYDQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
One of the not-very-pretty things you could do while looking for the actual root cause: set up mqtt bridging between the standalone mosquitto and the ha one. If that works, you'll have a extraneous mosquitto instance in your system, but you'll get the data flowing... |
Beta Was this translation helpful? Give feedback.
-
Hello again, @AnotherDaniel ! 😄 Had some more time to spare, and dug into trying to get the HA_MQTT to work, but alas... However, there seems like something happens with the HA_MQTT "thingy" once you put it in a docker. So what I've done: Using the same docker image and compose file, I first ran with regular MQTT while capturing traffic with tcpdump. Test with MQTT-sink works fine, as I've confirmed earlier The HA_MQTT however, after the first initial setup, it starts sending over UDP ? Next step was to remove everything from docker related to samhub, before following the guide on this page to download the source and run smahub as a python script only. And this works flawlessly. I can see both in HA and in MQTT Explorer that the python script successfully publishes with the HA_MQTT sink as enabled (and the the 'regular' MQTT sink disabled). Went on an build new image from the code just downloaded.... aaaaand we're back at square one again, with smahub as a docker-container, once initial MQTT ping request and response is done it swaps over to pushing UDP traffic. Not sure if this is something you can or even want to look at (or if it's even something that is related to the code you've done or if this is something more upstream in python vs docker compose level... ? ), but thought I'd report back my findings at least 😄 Will continue to run the normal MQTT sink for now, as I really like having smahub in a docker.... if you ever get around to finding and fixing this, would love a ping back 👍 Have a nice weekend! |
Beta Was this translation helpful? Give feedback.
-
This is really a bummer - also, I (only) run smahub in Docker, and this definitely can work... don't know yet what exactly I will be able to do here, but I'll keep this on the investigation list. |
Beta Was this translation helpful? Give feedback.
-
Hi - and help! :)
Got my Solar panels installed end of January, with a TriPower X 12 inverter. Long story short, found HomeAssistant and this project and it looked "easy enough"...
Used to consider myself somewhat capable when it comes to configuring stuff like this - but I am about to give up... :) I just can't get my HA-installed MQTT Broker to receive anything from the SMAhub.
Setup:
HA OS installed in KVM environment, bridged network (192.168.50.0/24 network). Ubuntu 22.04 LTS as host.
MQTT Broker & integration installed via Add-On, been following various youtube and written guides and it seems to be installed properly. Have created user and set password in HA and entered this in the config.
Enable Discovery is currently disabled the MQTT options in HA, but have tried with it enabled as well and could not see any difference,
I can connect via MQTT Explorer (running on my windows pc) and publish something, and it pops up in the "Listen to a Topic" from the HA Integration MQTT Settings.
For testing purpose, I have only added a few sensors to HA, in a mqtt.yaml file that is included into main configuration.yaml
sensor. Sensors do show up in HA under entities. (have also tried adding the mqtt lines directly in the configuration.yaml), but when I add them to a card on the dashboard I only get "unknown" as values.
So far, so good, I believe... ?
SMAhub is running in docker container hosted on same Ubuntu-host as mentioned above, Start up with simple
docker-compose up -d
Compose-file basically copy-pasted from the example in the ReadMe:
Starts without errors, and I can see via
docker logs smahub
that it seems to be able to fetch data from the inverter: (edited for space saving purpose). So the TRIPOWERX-part seems to be working.
(and yes, it is nighttime :D )
But after this... I've hit a wall. I am unable to find any reference as to where to being to look for errors... MQTT is also somewhat new to me, but I feel I grasp the idea of it, and the basics aren't really rocket science...
Any pointers would be highly appreciated! Like, how can I find if the SMAhub actually tries to send towards the HA installed MQTT broker?
Docker & docker networks are also new-ish topics for me - setting SMAhub as "host" doesn't give it it's own ip, but that is perhaps not necessary?
I'm quite certain it is something really simple I've overlooked, but after 3 days of struggling I need help 🗡️
Thanks in advance!
Problem Exists Between Keyboard and Chair?
Beta Was this translation helpful? Give feedback.
All reactions