mcrapts / enphase-to-mqtt

Read solar production data from your Enphase Envoy gateway and publish on MQTT
6 stars 2 forks source link

MQTT athentication #1

Open davebuk opened 1 year ago

davebuk commented 1 year ago

Hi

I'm looking to try and get your code to possibly work with my openHAB setup. The MQTT broker I run has user/password authentication. Are you able to add that to you code before I try and run it on Windows? I can then think about trying to get enphase-to-mqtt to talk to openHAB?

Thanks.

mcrapts commented 1 year ago

I have now added the option to configure a username and password using the MQTT_USERNAME and MQTT_PASSWORD environment variables. Can you let me know if this works for you?

davebuk commented 1 year ago

Great, much appreciated. Leave it with me as I'll need to work out the easiest way for me to run the script on Windows 10.

mcrapts commented 1 year ago

You can use Docker or Poetry to run the script as described in the README. There should be not much of a difference between different operating systems. Let me know where you're stuck or where documentation can be improved.

davebuk commented 1 year ago

Thanks, I'll see what I can achieve when I have some spare time.

I have been using a binding in the openHAB software at the moment to get to various end points. https://community.openhab.org/t/enphase-envoy-v7-local-api-to-curl-json-on-windows/146074/39?u=davebuk` will show you what I've got. You might be interested to try some of the other URLs yourself and add them to your code?

mcrapts commented 1 year ago

I tried the report URLs early on in the development, they unfortunately don't work on the gateway that I own (FW v7.6.0).

davebuk commented 1 year ago

Mine has D7.0.88.

Have you tried /ivp/meters/readings? On mine I can read up to date readings from the CT transformers.

I'll try your code in the next week or so.

davebuk commented 1 year ago

I've managed to get windows docker desktop setup and running your code. The debug code show successful token retrieval and reading of production data but it doesn't get published. Error return code 4.

mcrapts commented 9 months ago

Error return code 4 indicates no connection possible to the broker.

https://github.com/eclipse/paho.mqtt.python/blob/master/src/paho/mqtt/client.py#L162