solmoller / eversolar-monitor

Script to capture data and create statistics from Eversolar/zeversolar Solar Inverters. Includes easy install image files for Raspberry Pi. Working edition since 2012 :-)
https://github.com/solmoller/eversolar-monitor/blob/wiki/Introduction.md
MIT License
30 stars 20 forks source link

Add Mqtt functionalities #55

Closed nagydavid closed 2 years ago

nagydavid commented 2 years ago

@solmoller Hejsa,

I added an Mqtt functionalities with home assistant auto discovery config. Therefor it became more smart home software agnostic.

I wrote in PERL the first time in my life, so there could be a way to write it more elegantly. I tried to implement without shell scripts but all PERL-MQTT libraries were a little bit confusing, and it just added extra complexity.

I hope it helps some people.

Output in Home Assistant as a device and its entities image

nagydavid commented 2 years ago

Apart from this I have an issue.:

solmoller commented 2 years ago

That is very interesting. I went via Pvoutput:

But you get more data out, and I already use MQTT intensely.

As for the potential bug, I don't have that problem, so it's probably your code. I'll try to find time to debug

BR

Henrik

nagydavid commented 2 years ago

Thanks for looking at it. I did it because I want to have as less cloud polling as possible :)

sorentorp commented 2 years ago

Great work! Lets get it merged :-)

solmoller commented 2 years ago

Great work! Lets get it merged :-)

Jeg har ikke haft tid til at teste, hvis I siger det virker skal jeg nok merge...

solmoller commented 2 years ago

Whoops, in english: I haven't had the time to test, and David has implied issues with the code - if all is well I'll gladly merge

sorentorp commented 2 years ago

@nagydavid and @solmoller I did some testing.

I dont use u/pw for my mqtt - and that seems to be mandatory with this implementation. And so does the model name.

pi@raspberrypi:~/eversolar-monitor $ perl eversolar.pl mqtt_inverter_model expects an argument at eversolar.ini line 51 mqtt_user expects an argument at eversolar.ini line 54 mqtt_password expects an argument at eversolar.ini line 55 2022-01-03 00:49:12: Severity 1, Configfile is: eversolar.ini

sorentorp commented 2 years ago

I just used default username + password and my modelnumber "TL3000".

I also had to run "sudo apt-get install mosquitto-clients"

sorentorp commented 2 years ago

Screenshot 2022-01-03 09 53 08

sorentorp commented 2 years ago

also the loglevel should be adjusted.

2022-01-03 09:58:15: Severity 1: Mqtt messages published 2022-01-03 09:58:30: Severity 1: Mqtt messages published 2022-01-03 09:58:45: Severity 1: Mqtt messages published 2022-01-03 09:59:00: Severity 1: Mqtt messages published 2022-01-03 09:59:17: Severity 1: Mqtt messages published 2022-01-03 09:59:32: Severity 1: Mqtt messages published 2022-01-03 09:59:48: Severity 1: Mqtt messages published 2022-01-03 10:00:03: Severity 1: Mqtt messages published

My settings are

debug = 1 # Debug level , 0 = none, 1 is high priority, 3 is everything, 4 also output

sorentorp commented 2 years ago

And AC Current should be "A" - not "V"

elsif ( $_[0] eq "iac" ){ $config_data{'icon'} = "mdi:current-ac"; $config_data{'name'} = "AC Current"; $config_data{'unit_of_measurement'} = "V"; <------- $config_data{'device_class'} = "current";

nagydavid commented 2 years ago

@solmoller @sorentorp tak for din anmeldelse af PR. Jeg bor i Danmark, så jeg kan forstå lidt dansk :P. About the PR, I will update the spelling errors, and make sure that u/p will be requested if it has any value.

solmoller commented 2 years ago

Thanks, I'll test shortly. Maybe we should add instructions on how to setup HASS?

sorentorp commented 2 years ago

A MQTT Broker and Hass - https://www.home-assistant.io/docs/mqtt/broker/

nagydavid commented 2 years ago

If the Mosquito broker is set up, then the eversolar.pl will send discovery messages so there will be no need for additional templates sensors in hass. Only the mqtt discovery needs to be enabled in the eversolar.ini .

solmoller commented 2 years ago

Thanks, I figured it out

Brilliant!

BR Henrik

lør. d. 8. jan. 2022 22.59 skrev sorentorp @.***>:

A MQTT Broker and Hass - https://www.home-assistant.io/docs/mqtt/broker/

— Reply to this email directly, view it on GitHub https://github.com/solmoller/eversolar-monitor/pull/55#issuecomment-1008161647, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQL6EGC5YLMD3NUFX7TGR3UVCXVRANCNFSM5KQIZK6Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you modified the open/close state.Message ID: @.***>