Git Product home page Git Product logo

sofar2mqtt-python's People

Contributors

dependabot[bot] avatar rjpearce avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

sofar2mqtt-python's Issues

sofar2mqtt-python doiesnt start anymore

Hello,

I am getting an error since today.
I got a state "Emergency Error" on the Sofar state and I was not able to write anything anymore. Seems there was temporary a low frequency statement but the inverter is working fine. But since then I was not able to change the state anymore on the Sofar and data froze.

Restarted the container on my Synology and the container doesnt want to restart anymore with an error.
In case, I restarter my inverter but didnt solved the issue.

Attached the logs I have. I was maybe expecting a communication issue but seems to be ok, all cabling and usb stick is properly plugged and detected by my synology with drivers and co.

When it boots, I have those mqtt poping in the channel :
Topic: sofar/desired_powerQoS: 0
0
Topic: sofar/pv_total_powerQoS: 0
0
Topic: sofar/gridQoS: 0
0

Then the error occur as below:
rpearce-sofar2mqtt-python-1.csv

2024/04/25 00:34:58 stdout KeyError: 'serial_number'
2024/04/25 00:34:58 stdout ~~~~~~~~~^^^^^^^^^^^^^^^^^
2024/04/25 00:34:58 stdout sn = self.data['serial_number']
2024/04/25 00:34:58 stdout File "/opt/sofar2mqtt/sofar2mqtt-v2.py", line 286, in publish_mqtt_discovery
2024/04/25 00:34:58 stdout self.publish_mqtt_discovery()
2024/04/25 00:34:58 stdout File "/opt/sofar2mqtt/sofar2mqtt-v2.py", line 366, in main
2024/04/25 00:34:58 stdout sofar.main()
2024/04/25 00:34:58 stdout File "/opt/sofar2mqtt/sofar2mqtt-v2.py", line 576, in main
2024/04/25 00:34:58 stdout ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024/04/25 00:34:58 stdout return __callback(*args, **kwargs)
2024/04/25 00:34:58 stdout File "/usr/local/lib/python3.12/site-packages/click/core.py", line 760, in invoke
2024/04/25 00:34:58 stdout ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024/04/25 00:34:58 stdout return ctx.invoke(self.callback, **ctx.params)
2024/04/25 00:34:58 stdout File "/usr/local/lib/python3.12/site-packages/click/core.py", line 1404, in invoke
2024/04/25 00:34:58 stdout ^^^^^^^^^^^^^^^^
2024/04/25 00:34:58 stdout rv = self.invoke(ctx)
2024/04/25 00:34:58 stdout File "/usr/local/lib/python3.12/site-packages/click/core.py", line 1055, in main
2024/04/25 00:34:58 stdout ^^^^^^^^^^^^^^^^^^^^^^^^^^
2024/04/25 00:34:58 stdout return self.main(*args, **kwargs)
2024/04/25 00:34:58 stdout File "/usr/local/lib/python3.12/site-packages/click/core.py", line 1130, in call
2024/04/25 00:34:58 stdout main()
2024/04/25 00:34:58 stdout File "/opt/sofar2mqtt/sofar2mqtt-v2.py", line 580, in 
2024/04/25 00:34:58 stdout Traceback (most recent call last):
2024/04/25 00:34:58 stdout 2024-04-24 22:34:58,894 - INFO - Modbus Requests: 128 Retries: 128 (100.0%) Failures: 64 (25.0%)
2024/04/25 00:34:20 stdout 2024-04-24 22:34:20,198 - INFO - Subscribing to sofar/rw/desired_power
2024/04/25 00:34:20 stdout 2024-04-24 22:34:20,198 - INFO - Subscribing to sofar/rw/time_of_use_charge_soc
2024/04/25 00:34:20 stdout 2024-04-24 22:34:20,197 - INFO - Subscribing to sofar/rw/energy_storage_mode
2024/04/25 00:34:20 stdout 2024-04-24 22:34:20,197 - INFO - Subscribing to homeassistant/status
2024/04/25 00:34:20 stdout 2024-04-24 22:34:20,197 - INFO - MQTT Connection Accepted.
2024/04/25 00:34:19 stdout 2024-04-24 22:34:19,999 - INFO  MQTT connecting to broker 192.168.1.XX port 1883 with auth user XX
(XX on purpose)

Thank you for your support.

Question about calling write function in the program

Im using your library in a docker environment for testing, mqtt broker serial connection everything is up and running, status messages come back for the me3000sp but my question is this, i would like to use the following in compliment with your code and are trying to find the most minimalistic approach of using it without modifying the original code too much:
{
"registers":[
{
"name":"standby_mode",
"function": "setmode",
"register":"0x100",
"write": true
},
{
"name":"discharge_mode",
"function": "setmode",
"register":"0x101",
"write": true
},
{
"name":"charge_mode",
"function": "setmode",
"register":"0x102",
"write": true
},
{
"name":"auto_mode",
"function": "setmode",
"register":"0x103",
"write": true
}
]
}

Can you tell me where in the code to best put it and how i should call the methods topic string wise as to not conflict with other methods in your original code?

Ive pondered in putting it in the original sofar-me-3000.json but im unsure how to do this in a safe manner (dont want the code to be called along with the status messages by accident continuously for example)

To be more exact once my message has safely arrived in your code for example in onmessage and it doesnt conflict with other code i can safely stitch on from that if you could get me to that point. (I could do it myself as well but i consider that generally more unsafe than asking you directly as the conflicts could put unnecessary stress on the inverter and possibly wear it out faster)

Issue running the docker command

Using the example from the setup guide and running
sudo docker run --name sofar2mqtt -e MQTT_HOST=x.x.x.x -e MQTT_PORT=1883 -e USERNAME=mqtt_user -e PASSWORD=xxxxxx -e CONFIG_FILE=sofar-hyd-ep.json -e TTY_DEVICE=/dev/ttyUSB0 --device=/dev/ttyUSB0 rpearce/sofar2mqtt-python:latest

I get the exec error
exec /usr/local/bin/python: exec format error

This is a fresh install of ubuntu on a RPI4 with official docker setup. Nothing else.

Thanks

Errors when lauching program

hi,

using this command line : python3 sofar2mqtt-v2.py --broker 192.168.10.231 --config-file sofar-hyd-ep.json --device /dev/ttyUSB0 --retry 5 --daemon

i get the following result :

2024-03-12 15:31:51,718 - INFO - MQTT connecting to broker 192.168.10.231 port 1883 without auth
2024-03-12 15:31:51,728 - INFO - MQTT Connection Accepted.
2024-03-12 15:31:51,731 - INFO - Subscribing to homeassistant/status
2024-03-12 15:31:51,736 - INFO - Subscribing to sofar/rw/energy_storage_mode
2024-03-12 15:31:51,737 - INFO - Subscribing to sofar/rw/time_of_use_charge_soc
2024-03-12 15:31:51,738 - INFO - Subscribing to sofar/rw/desired_power
Traceback (most recent call last):
File "/home/pi/sofar2mqtt-python/sofar2mqtt-v2.py", line 580, in
main()
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/home/pi/sofar2mqtt-python/sofar2mqtt-v2.py", line 576, in main
sofar.main()
File "/home/pi/sofar2mqtt-python/sofar2mqtt-v2.py", line 364, in main
self.read()
File "/home/pi/sofar2mqtt-python/sofar2mqtt-v2.py", line 268, in read
self.read_and_publish()
File "/home/pi/sofar2mqtt-python/sofar2mqtt-v2.py", line 216, in read_and_publish
value = self.read_value(
File "/home/pi/sofar2mqtt-python/sofar2mqtt-v2.py", line 441, in read_value
value = self.instrument.read_long(
TypeError: read_long() got an unexpected keyword argument 'number_of_registers'

as a matter of fact, there is nothing created in mqtt.

could you guide me on a solution ?

Claude

Grid value is not accurate when low active power on sofar HYD-XXX-EP

As grid power is a substarct of load_power - active_power it gives unwated results when active_power is very low or 0 .
active_power is reported sometimes less than zero which give a higher grid power .
when is is 0 it report a negative value instead of positive for grid power .

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.