MFxMF / SDM630-Modbus

SDM630-Modbus 3P4W Multifunction Power Analyser WithRS485 Port modbus RTU for the domoticz plugin
GNU General Public License v3.0
19 stars 17 forks source link

connection problem on domoticz 2023.1 15378 #8

Open anno006 opened 1 year ago

anno006 commented 1 year ago

I have 2 sdm630. It did work fine last month. But now i can't get it working anymore, i stil get this error: 2023-07-07 23:28:48.093 Error: SDM630.2: Call to function 'onHeartbeat' failed, exception details: 2023-07-07 23:28:48.093 Error: SDM630.2: Traceback (most recent call last): 2023-07-07 23:28:48.093 Error: SDM630.2: File "/home/pi/domoticz/plugins/SDM630-Modbus/plugin.py", line 554, in onHeartbeat 2023-07-07 23:28:48.093 Error: SDM630.2: _plugin.onHeartbeat() 2023-07-07 23:28:48.093 Error: SDM630.2: File "/home/pi/domoticz/plugins/SDM630-Modbus/plugin.py", line 448, in onHeartbeat 2023-07-07 23:28:48.093 Error: SDM630.2: Domoticz.Log('Voltage L1: {0:.3f} V'.format(Volts_L1)) 2023-07-07 23:28:48.093 Error: SDM630.2: UnboundLocalError: local variable 'Volts_L1' referenced before assignment

When the one is working the other won't and around, when the second is working the first is not.

Roel6 commented 1 year ago

I have more or less the same problem. What am I doing wrong?

2023-08-31 19:45:39.093 Error: MODBUS: Call to function 'onHeartbeat' failed, exception details: 2023-08-31 19:45:39.095 Error: MODBUS: Traceback (most recent call last): 2023-08-31 19:45:39.095 Error: MODBUS: File "/home/pi/domoticz/plugins/SDM630-Modbus/plugin.py", line 552, in onHeartbeat 2023-08-31 19:45:39.095 Error: MODBUS: _plugin.onHeartbeat() 2023-08-31 19:45:39.095 Error: MODBUS: File "/home/pi/domoticz/plugins/SDM630-Modbus/plugin.py", line 265, in onHeartbeat 2023-08-31 19:45:39.095 Error: MODBUS: Volts_L1 = self.rs485.read_float(0, functioncode=4, numberOfRegisters=2) 2023-08-31 19:45:39.095 Error: MODBUS: File "/home/pi/domoticz/plugins/SDM630-Modbus/minimalmodbus.py", line 392, in read_float 2023-08-31 19:45:39.095 Error: MODBUS: return self._genericCommand(functioncode, registeraddress, numberOfRegisters=numberOfRegisters, payloadformat='float') 2023-08-31 19:45:39.095 Error: MODBUS: File "/home/pi/domoticz/plugins/SDM630-Modbus/minimalmodbus.py", line 697, in _genericCommand 2023-08-31 19:45:39.096 Error: MODBUS: payloadFromSlave = self._performCommand(functioncode, payloadToSlave) 2023-08-31 19:45:39.096 Error: MODBUS: File "/home/pi/domoticz/plugins/SDM630-Modbus/minimalmodbus.py", line 798, in _performCommand 2023-08-31 19:45:39.096 Error: MODBUS: payloadFromSlave = _extractPayload(response, self.address, self.mode, functioncode) 2023-08-31 19:45:39.096 Error: MODBUS: File "/home/pi/domoticz/plugins/SDM630-Modbus/minimalmodbus.py", line 1075, in _extractPayload 2023-08-31 19:45:39.096 Error: MODBUS: raise ValueError(text) 2023-08-31 19:45:39.096 Error: MODBUS: ValueError: Checksum error in rtu mode: '\x1di' instead of ':]' . The response is: '\x7fßÿÿû\x1di' (plain response: '\x7fßÿÿû\x1di')

DOMOTICZ 2023.2 Python 3.9.2 minimalmodbus.py installed running on raspberry pi 3b+ Distributor ID: Raspbian Description: Raspbian GNU/Linux 11 (bullseye) Release: 11 Codename: bullseye

Thanks in advance

porczek commented 10 months ago

Hi, info from Domoticz wiki page: WARNING nov 2021: Raspberry Pi OS based on Bullseye is giving issues with Python plugins!! Please do not upgrade or use this version for fresh install (instead use Raspberry Pi OS Legacy, based on Buster)

gizmocuz commented 10 months ago

Tested with latest Domoticz (beta) and works correctly. Way to many devices 😁

Roel6 commented 9 months ago

still the same problems with the present DOMOTICZ beta version. aaahhhhhh I also updated python but no results. What am I doing wrong

gizmocuz commented 9 months ago

You can use my fork, this is working with the latest beta

https://github.com/gizmocuz/SDM630-Modbus

Hope to have to additional meters here this week to verify this.

Roel6 commented 9 months ago

Thanks, I think it is a big step ahead. I now have this warning " Connection problem " only and all parameters are 0.

gizmocuz commented 9 months ago

Your modbus address should not be 0, as well as the other settings, better check and correct them Make sure you are on one of the later beta versions

Roel6 commented 9 months ago

DOMOTICZ 2023.2 (build 15658) Python 3.9.2 showing in DOMOTICZ but upgraded to 3.9.15 minimalmodbus.py installed running on raspberry pi 3b+ Distributor ID: Raspbian Description: Raspbian GNU/Linux 11 (bullseye)

It was working in previous version of Raspbian GNU/Linux and a older version of domoticz . I had to upgrade LINUX to use a newer version of domoticz and then the trouble started. I have several SDM630 installed reading interval 2 minutes baud-rate 9600 on all SDM630 devices and domoticz

image

For testing I now only use device with ID 4 All other devices (puls and smartmeter) devices are working.

Surgestion?

Roel6 commented 9 months ago

I installed phyton 3.11.4 (was 3.9.2) and now it is working again ! !

Roel6 commented 9 months ago

https://stackoverflow.com/questions/76942052/raspberry-pi-cant-install-python-3-11

gizmocuz commented 9 months ago

Tested with 3 meters and working!

Roel6 commented 9 months ago

Tested with 5 SDM630 V2 (38k4 and 2 min intervals) and it is working. The raspberry PI 3B is having a hard time

Thanks for the help

gizmocuz commented 9 months ago

Great to hear! What do you mean with 'The raspberry PI 3B is having a hard time' ? I think we should rewrite this plugin... instead of the option to provide 1 modbus id, we should let the user enter a comma separate list This way the plugin can scan all id's instead of doing a trial and error and timeout/reconnect stuff Anyone want to be willing to give this a try?

Roel6 commented 9 months ago

DOMOTICZ WWW server is getting slow due to high CPU use (80% or more) I like the separate modbus ID approach so that each SDM630 gets a different name.

gizmocuz commented 9 months ago

Do you have MQTT (not the auto discovery) enabled by any change? If not, this plugin really needs updating

Roel6 commented 9 months ago

1702307042: mosquitto version 2.0.11 starting 1702307042: Using default config. 1702307042: Starting in local only mode. Connections will only be possible from clients running on this machine. 1702307042: Create a configuration file which defines a listener to allow remote access. 1702307042: For more details see https://mosquitto.org/documentation/authentication-methods/ 1702307042: Opening ipv4 listen socket on port 1883. 1702307042: Error: Address already in use

It looks like MQTT is in use

gizmocuz commented 9 months ago

You should be able to see this in the hardware setup screen. If you have a hardware named 'MQTT Client Gateway with LAN interface' then you do In this case i think it is because of the amount of devices that are send to MQTT Since the latest beta version you should have a 'setup' button here, if you press it, you can specify the devices you want to be published