PellMon icon indicating copy to clipboard operation
PellMon copied to clipboard

Home assistant integration

Open KimCarlsen opened this issue 4 years ago • 35 comments

Whould it be possible to add this a an integration to home assistant (https://www.home-assistant.io)? Both are python. Unfortunately my skills are not good enough for the coding part, but i can do the testing:-)

KimCarlsen avatar Nov 02 '20 07:11 KimCarlsen

That depends very much on what you mean by "this". Anything specific you want to be able to do with HA?

motoz avatar Nov 02 '20 09:11 motoz

First is to extract data. Right now I use stokercloud API through node-red and MQTT, but seems a bit cumbersome to read my local device status from a cloud, + not everything is available. It would be nice if possible to control it.

KimCarlsen avatar Nov 02 '20 10:11 KimCarlsen

I see, 'stokercloud' means it's the data from either the Scottecom or the NBEcom plugin you want to make available.

If you don't want to use the web interface in pellmon to control your burner there is a simple solution to connect pellmon to anything that understands MQTT. Just install pellmon and then use the pellmonMQTT script from here: https://github.com/motoz/pellmonMQTT (use the -d option to connect to the SYSTEM bus), then everything from the pellmon database is published, and anything writable is also subscribed. Another option is to use the command line interface pellmoncli that is installed with pellmon, there seems to be some kind of command line integration in HA.

Making a HA integration from the pellmon plugin you want to use is probably very involved, but everything is of course doable. Probably best to ask someone who has been developing for HA about that.

motoz avatar Nov 02 '20 11:11 motoz

First is to extract data. Right now I use stokercloud API through node-red and MQTT, but seems a bit cumbersome to read my local device status from a cloud, + not everything is available. It would be nice if possible to control it.

I've maaaged to extract data from Stokercloud thourgh node red as you mentioned Kim.

If you're interested I can send you a export of the Flow I've created. I've so far not messed with Controle but seems if you have the key you can get the commands and use them to change set temperature, pellet amount in magasin etc.

respodk avatar Jan 01 '21 20:01 respodk

@respodk hi i will like to have the flow sent to me if you want??

Hejsa, jeg vil da gerne har flowet til node red hvis du vil sende det??

Kind Regards/Venlig hilsen Mads [email protected]

MadsALarsen avatar Jan 10 '21 08:01 MadsALarsen

@MadsALarsen

I've send you a email with the flow.

Kind Regards Rasmus

respodk avatar Jan 10 '21 12:01 respodk

@respodk kan jeg også få en kopi af dit node red flow [email protected]

Venlig hilsen Jesper

vonhavn avatar Jan 12 '21 11:01 vonhavn

I know this thread is old but actually we managed to create a docker for this to be integrated with HACS through MQTT https://hub.docker.com/r/lakelake/pellmon We managed to put it into a container with all the scripts and web.py, it works out of the box with just setting a few environment variables.

thel1988 avatar Feb 13 '21 11:02 thel1988

@thel1988, that's great!

motoz avatar Feb 13 '21 13:02 motoz

Sorry for being late at the party. Didn't get the first notifications. @thel1988 looks great. Is it possible to add mqtt username and password (added issue to repo)? Is it communicating directly with the burner at LAN or read from stokercloud?

KimCarlsen avatar Feb 14 '21 06:02 KimCarlsen

Hi @KimCarlsen Yes it connects directly to the NBE controller on lan(Make sure to be on the same VLAN), without stokercloud. Unfortunately im just borrowing @motoz 's code and putting it into an container, so I think you should try to ask @motoz to extended the functionality of pellmonMQTT.py to take the username and password args, as im only able to parse the those with the environment variables through docker. But as he is using pahoo.mqtt, they already have the functionality included into the lib, so it should be fairly "easy" :) If that functionality finds it's way into the python script I will make sure to update the image, which then will allow you to include those variables as well.

thel1988 avatar Feb 14 '21 13:02 thel1988

@KimCarlsen The Docker is now updated with the capabilites for mqtt username and password. @motoz Do you have any plans on migrating the python scripts for python 3.x? As you may know that python 2.x is out of support, just curious, we will be just fine without the migration :)

thel1988 avatar Dec 14 '21 22:12 thel1988

Yeah I know about the out of support. To be honest this project is not very high priority for me now. I do have it running 24/7 and wouldn't want to be without it but I don't have much motivation to hack on it at the moment as long as it still works. I don't rule out porting to python3 at some point, and pull requests are of course happily accepted.

motoz avatar Dec 15 '21 16:12 motoz

@respodk hi i will like to have the node red flow sent to me if you want?? jakobm999 @ gmail.com

Regards Jakob

JakobM999 avatar Feb 04 '22 10:02 JakobM999

@respodk Hi, could you send me the node red flow, please?

Thx

weide-git avatar Jul 23 '22 15:07 weide-git

Hi @KimCarlsen Yes it connects directly to the NBE controller on lan(Make sure to be on the same VLAN), without stokercloud. Unfortunately im just borrowing @motoz 's code and putting it into an container, so I think you should try to ask @motoz to extended the functionality of pellmonMQTT.py to take the username and password args, as im only able to parse the those with the environment variables through docker. But as he is using pahoo.mqtt, they already have the functionality included into the lib, so it should be fairly "easy" :) If that functionality finds it's way into the python script I will make sure to update the image, which then will allow you to include those variables as well.

hey, can you help me, i have it installed and mqtt is working but it does not conenct to the burner?? it cant se it 🤷‍♂️ its on the samenetwork so i dont know why i filed out the serial and pass from the burner.

kind regards Mads

MadsALarsen avatar Aug 08 '22 09:08 MadsALarsen

Having '"it" installed is a bit vague, but PellMon does not work with all NBE burners. What do you have?

motoz avatar Aug 08 '22 10:08 motoz

Having '"it" installed is a bit vague, but PellMon does not work with all NBE burners. What do you have?

i have a NBE v7

pellmon is installed in docker on a synology, mqtt is on my home assistent and it is getting the data from pellmon (emty data but stil)

i filed out the serial, pass, and mqtt stuff out ind the envirement tab in docker

LOG: https://pastebin.com/VcE3J9rP

MadsALarsen avatar Aug 08 '22 10:08 MadsALarsen

Ok, I'm not aware of any version or V7 that wouldn't work, so that should be fine. Docker I don't know anything about, can you access the web interface of pellmon?

motoz avatar Aug 08 '22 11:08 motoz

Ok, I'm not aware of any version or V7 that wouldn't work, so that should be fine. Docker I don't know anything about, can you access the web interface of pellmon?

Yes

i moved the web port to 8095 does that do aniting?

https://pasteboard.co/g6u4FycpM2uS.png

log https://pasteboard.co/BVStk1aAFzWp.png

MadsALarsen avatar Aug 08 '22 12:08 MadsALarsen

Ok, I'm not aware of any version or V7 that wouldn't work, so that should be fine. Docker I don't know anything about, can you access the web interface of pellmon?

Yes

i moved the web port to 8095 does that do aniting?

https://pasteboard.co/g6u4FycpM2uS.png

log https://pasteboard.co/BVStk1aAFzWp.png

I can help with the docker version. (Author of the docker file)

You need make sure to have the network settings of the container as macvlan og ipvlan and NOT docker NAT.

Can you post a screenshot of your docker settings?

thel1988 avatar Aug 08 '22 12:08 thel1988

Ok, I'm not aware of any version or V7 that wouldn't work, so that should be fine. Docker I don't know anything about, can you access the web interface of pellmon?

Yes i moved the web port to 8095 does that do aniting? https://pasteboard.co/g6u4FycpM2uS.png log https://pasteboard.co/BVStk1aAFzWp.png

I can help with the docker version. (Author of the docker file)

You need make sure to have the network settings of the container as macvlan og ipvlan and NOT docker NAT.

Can you post a screenshot of your docker settings?

cool thanks

https://pasteboard.co/6pJwkMvkeke7.png

https://pasteboard.co/bQuQQivDVGXw.png

MadsALarsen avatar Aug 08 '22 12:08 MadsALarsen

Ok, I'm not aware of any version or V7 that wouldn't work, so that should be fine. Docker I don't know anything about, can you access the web interface of pellmon?

Yes i moved the web port to 8095 does that do aniting? https://pasteboard.co/g6u4FycpM2uS.png log https://pasteboard.co/BVStk1aAFzWp.png

I can help with the docker version. (Author of the docker file) You need make sure to have the network settings of the container as macvlan og ipvlan and NOT docker NAT. Can you post a screenshot of your docker settings?

cool thanks

https://pasteboard.co/6pJwkMvkeke7.png

https://pasteboard.co/bQuQQivDVGXw.png

Try to move the container to the host network, that will cause the container to use the ip of the Synology instead of the NAT'ed IP. which does not allow the container to auto discover.

thel1988 avatar Aug 08 '22 12:08 thel1988

Also what is the IP of the NBE burner?

thel1988 avatar Aug 08 '22 12:08 thel1988

192.168.20.170

MadsALarsen avatar Aug 08 '22 12:08 MadsALarsen

ahh i set the network to Host an now it works !!!!

MadsALarsen avatar Aug 08 '22 12:08 MadsALarsen

Also what is the IP of the NBE burner?

how do i get the sensordata tol HA

and how do i send comands to it?? fro HA??

MadsALarsen avatar Aug 08 '22 12:08 MadsALarsen

how do i get the sensordata tol HA

and how do i send comands to it?? fro HA??

Now you need to have HA grab it from MQTT, and then send it back through MQTT

thel1988 avatar Aug 08 '22 12:08 thel1988

how do i get the sensordata tol HA and how do i send comands to it?? fro HA??

Now you need to have HA grab it from MQTT, and then send it back through MQTT

do you have any pointer, i havet payed alot with mqtt??

MadsALarsen avatar Aug 08 '22 12:08 MadsALarsen

First you need to setup HA to connect to MQTT grabbed from: https://github.com/home-assistant/addons/blob/master/mosquitto/DOCS.md

To use the Mosquitto as a broker, go to the integration page and install the configuration with one click:

Navigate in your Home Assistant frontend to Configuration -> Integrations.
MQTT should appear as a discovered integration at the top of the page
Select it and check the box to enable MQTT discovery if desired, and hit submit.

After that you should be able to grab information from MQTT broker with the following settings:

sensor:
  - platform: mqtt
    name: "Retur Temp"
    state_topic: "pellmon/operating_data-return_temp"
    unit_of_measurement: "°C"
  - platform: mqtt
    name: "Keddel Temp"
    state_topic: "pellmon/operating_data-boiler_temp"
    unit_of_measurement: "°C"
  - platform: mqtt
    name: "Varmtvand Temp"
    state_topic: "pellmon/operating_data-dhw_temp"
    unit_of_measurement: "°C"
  - platform: mqtt
    name: "Status Fyr"
    state_topic: "pellmon/operating_data-state"
  - platform: mqtt
    name: "Røg Temp Fyr"
    state_topic: "pellmon/operating_data-smoke_temp"
    unit_of_measurement: "°C"
  - platform: mqtt
    name: "KW Fyr"
    state_topic: "pellmon/operating_data-power_kw"
    unit_of_measurement: "KW"
  - platform: mqtt
    name: "Procent Fyr"
    state_topic: "pellmon/operating_data-power_pct"
    unit_of_measurement: "%"
  - platform: mqtt
    name: "afstand Fyr"
    state_topic: "pellmon/operating_data-distance"
    unit_of_measurement: "CM"
  - platform: mqtt
    name: "Lyssensor"
    state_topic: "pellmon/operating_data-photo_level"
    unit_of_measurement: "lux"
  - platform: mqtt
    name: "Fan Procent"
    state_topic: "pellmon/operating_data-fan_speed"
    unit_of_measurement: "%"
  - platform: mqtt
    name: "Outside Temp"
    state_topic: "pellmon/operating_data-external_temp"
    unit_of_measurement: "°C"
  - platform: mqtt
    name: "Forbrug 24 Timer Fyr"
    state_topic: "pellmon/consumptionData24h"
    unit_of_measurement: "KG"
    value_template: "{{value_json.total | round(3)}}"
  - name: Furnace Boiler Consumption Last 24h
    platform: mqtt
    state_topic: "pellmon/advanced_data-total_consumption_24hours"
    json_attributes_topic: "pellmon/consumptionData24h"

Also I havn't tested the MQTT in the other direction, from HA to Furnace, so try it out and maybe write up your findings. :)

thel1988 avatar Aug 08 '22 12:08 thel1988