Caian / solismqtt

Publishes data from Solis inverter's WiFi stick to an MQTT broker
GNU General Public License v2.0
0 stars 0 forks source link

Instructions #1

Open Kuchiru opened 2 months ago

Kuchiru commented 2 months ago

Hi!

Came across this and im wondering how this works and what hardware i would need for it. I already have a solis inverter with a wifi antenna sticking out of it.

Caian commented 2 months ago

Hi,

The first step is to see if you can access the solis inverter through your wifi network using a conventional browser and the IP of the inverter.

The inverter will ask for a username and password, I think the default is admin / admin. If you get a simple screen with some information about the inverter then you are good to go.

Solismqtt can run in a container or barebone. I provided a Dockerfile and docker-compose if you want to go the container route.

You also need an MQTT server running. You will also need a username and password for solismqtt on the MQTT broker so it can publish messages.

Fill configuration.yml with the ips, usernames and passwords you got above and run the daemon.

Feel free if you have questions along the way, I'll try to answer when I can.

Kuchiru commented 2 months ago

Thanks!

So i didn't actually know what to do with the wifi module as i just got this house with this installed, i managed to connect it to my network and i can log into the interface now! much simpler than i thought.

So i assume prior to building the docker image (never done this before) i need to make sure daemon.py works, unfortunately i get the following error:

Hello.
Reading...
11078220C120045 001E 002E 0078
  File "/home/htpc/solismqtt-main/daemon.py", line 193, in <module>
    traceback.print_stack()
Traceback (most recent call last):
  File "/home/htpc/solismqtt-main/daemon.py", line 186, in <module>
    mqtt_publish((
  File "/home/htpc/solismqtt-main/daemon.py", line 145, in mqtt_publish
    client = mqtt_get_client()
  File "/home/htpc/solismqtt-main/daemon.py", line 134, in mqtt_get_client
    client = mqtt_client.Client(client_id)
  File "/home/htpc/.local/lib/python3.9/site-packages/paho/mqtt/client.py", line 772, in __init__
    raise ValueError(
ValueError: Unsupported callback API version: version 2.0 added a callback_api_version, see docs/migrations.rst for details
^X^CTraceback (most recent call last):
  File "/home/htpc/solismqtt-main/daemon.py", line 186, in <module>
    mqtt_publish((
  File "/home/htpc/solismqtt-main/daemon.py", line 145, in mqtt_publish
    client = mqtt_get_client()
  File "/home/htpc/solismqtt-main/daemon.py", line 134, in mqtt_get_client
    client = mqtt_client.Client(client_id)
  File "/home/htpc/.local/lib/python3.9/site-packages/paho/mqtt/client.py", line 772, in __init__
    raise ValueError(
ValueError: Unsupported callback API version: version 2.0 added a callback_api_version, see docs/migrations.rst for details

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/htpc/solismqtt-main/daemon.py", line 195, in <module>
    time.sleep(60)
KeyboardInterrupt

My config is as such:

global:
    measure_interv_mins: 1

inverter:
    ip: "192.168.1.35"
    username: "admin"
    password: "admin"

mqtt:
    broker: "192.168.1.32"
    username: "inverter"
    password: "test123"

I created a local user in home assistant (mqtt addon), i assume as it's on the same network this should work.

docker-compose looks like this:

version: "3"

services:
  solismqtt:
    build: ./src/solismqtt
    volumes:
      - '/solismqtt-data/:/data'
      - '/solismqtt-config/:/config'
      - '/etc/localtime:/etc/localtime:ro'
    logging:
        driver: "json-file"
        options:
            max-size: "50m"

Though i'm not sure about the directories

Really appreciate your response by the way :)

Kuchiru commented 2 months ago

Was able to resolve the callback issue by changing: client = mqtt_client.Client(client_id) to client = mqtt_client.Client(mqtt_client.CallbackAPIVersion.VERSION1, client_id)

I'm gonna continue experimenting with the docker image and the composer.

Caian commented 2 months ago

Thank you for the update, looks like a new version o Paho broke old code, I'll patch it on the main branch.