celsworth / lxp-bridge

A bridge to MQTT/InfluxDB/Postgres for communications with LuxPower inverters
MIT License
13 stars 15 forks source link

Home Assistant Add-On #167

Closed apbarratt closed 1 year ago

apbarratt commented 1 year ago

This work adds a Home Assistant Add-On to lxp-bridge, allowing it to be quickly added and run directly on folk's Home Assistant instances.

Tested and working on: Home Assistant 2023.5.3 Supervisor 2023.04.1 Operating System 10.1 Frontend 20230503.3 - latest running on a RaspberryPi 4.

I've added a gitlab workflow which should ensure the version number of the add on is kept up to date with the tag published on Docker Hub, but I haven't tested this and to be honest it's not really my area of expertise.

Hope this proves useful, Andy

P.S. Apologies for the large number of commits, first time creating an add-on.

apbarratt commented 1 year ago

Quick note of thanks to @yp87 of Leaf2MQTT at https://github.com/yp87/leaf2mqtt whose work to include a very similar add-on in their project was referred to heavily for this :)

celsworth commented 1 year ago

Very nice, thanks!

I'm not sure how to test this, not being a Home Assistant user (or a Luxpower inverter user anymore, actually - recently moved to Victron) - but I'm happy to merge and hopefully it benefits others!

celsworth commented 1 year ago

I'll add some notes to the Wiki about it as well later.

apbarratt commented 1 year ago

Excellent, thank you. Please do check that the GitHub workflow stuff makes sense as I see you had it already set up for the docker hub deployment and I've basically just copied and adjusted the code from the Leaf2MQTT project for that part :)

apbarratt commented 1 year ago

I've put a post in the owners group on Facebook asking folk to test and log issues here. https://www.facebook.com/groups/438696100079367/posts/1313717432577225/

I'll make sure I've got all notifications turned on so I can triage any relevant to the add-on as they come in :)

johnl commented 1 year ago

thanks so much for this @apbarratt. Working a treat for me so far on a raspberry pi.

Given that it's for HA, should it have the mqtt/homeassistant section in the config by default maybe? I added it manually but aren't actually sure if it's necessary.

Also, isn't there some way to have it automatically use the mqtt server and credentials if that is already an addon? I vaguely recall some special variables you can use in the config for that but I can't find any docs about it.

apbarratt commented 1 year ago

I struggled to get it to accept anything with a nested object for some reason, but as the home assistant discovery part is turned on by default and we know for a fact the user is using home assistant I figured I'd just leave it out. But it does mean the prefix can't be tweaked in this part. It would certainly be good if we were able to have the credentials auto fill from something like mosquito or similar but I hadn't considered that this would be available anywhere. Certainly worth a look though :)

johnl commented 1 year ago

I struggled to get it to accept anything with a nested object for some reason

weird - it works for me pasting in, the HA UI config editor. So that's fine at least.

but as the home assistant discovery part is turned on by default

ah, well that's fine the too. I saw some examples which suggested it was off by default but if it's on then we're good.

It would certainly be good if we were able to have the credentials auto fill from something like mosquito or similar but I hadn't considered that this would be available anywhere

ok, if I can find that again I'll open a ticket. That I cannot find reference to it now makes me wonder if maybe I dreamt it :s