so how to translate i get some info but it is not correct
Need translate start sddress from HEX to OCT. Sample: start sddress 000C (HEX) = 0014 (OCT)
I was able to get it working however i am getting no response errors
Update of sensor.dht22_sensor8_humidity is taking over 10 seconds
12:33 PM util/async_.py (WARNING)
No response from modbus slave 50, register 358
12:32 PM components/sensor/modbus.py (ERROR)
my current delay is 100
any solution for this i am using two meters
If i will change the speed of reading should it reduce the no responsive comments?
Anyone using the SDM220Modbus with a USR-TCP232-410s Modbus RTU > Modbus TCP RS485 converter? I have both and the SDM220Modbus is measuring power and connected to the USR-TCP232-410s but using either HA or Modbus poll, I can’t seem to connect and poll the data.
P.S I’m using the registers from here Eastron (SDM220) data logging - MODBUS registers map
I got this working. I found a blog post that indicated the A and B terminals on my SDM220 may be printed backwards so I re-wired it (incorrectly) as I failed to note the blog post was 2015!!
Wired correctly, changed baud rate for comms to 9600 and used the following config and I have some nice looking gauges now using this very cost-effective MODBUS RTU > MODBUS TCP gateway!
- platform: modbus
# scan_interval: 30
registers:
- name: Reg0
unit_of_measurement: V
register: 0
register_type: input
count: 2
slave: 1
precision: 2
data_type: float
- name: Reg6
unit_of_measurement: A
register: 6
register_type: input
count: 2
slave: 1
precision: 2
data_type: float
- name: Reg12
unit_of_measurement: W
register: 12
register_type: input
count: 2
slave: 1
precision: 2
data_type: float
# reverse_order: true
- name: Reg70
unit_of_measurement: Hz
register: 70
register_type: input
count: 2
slave: 1
precision: 2
data_type: float
- name: Reg342
unit_of_measurement: kwh
register: 342
register_type: input
count: 2
slave: 1
precision: 2
data_type: float
modbus:
type: tcp
host: 10.0.1.10
port: 26
Hey , I found the issue with this meter 9600 data transfer is really loading the bus of modbus,
so i have connected separate converter and i am doing HTTP server
Using:
I have setup the converter by ID to resolve the USB address changes.
Hi sir,I found rs485 to wifi converter. it is possible use you code for reader my EASTRON SDM modbus ?
Hi, If it’s just a WiFi to RS485 ( no modbus conversion) the settings are the same, but change tcp to rtuovertcp.
I did just that, and it works like a charm
Working flawlessly until update to 0.108
The following integrations and platforms could not be set up:
- modbus
- modbus.sensor
Yes I have issues on 0.108 and 0.108.1 too with these modbus (RTU) sensors.
Same here, also for a serial modbus setup, still working perfect on 0.107.7. After updating to 0.108.2 it throws the following error.
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 171, in _async_setup_component
hass, processed_config
File "/usr/src/homeassistant/homeassistant/components/modbus/__init__.py", line 139, in async_setup
await hass.async_add_executor_job(start_modbus)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/modbus/__init__.py", line 111, in start_modbus
client.setup()
File "/usr/src/homeassistant/homeassistant/components/modbus/__init__.py", line 207, in setup
loop=self._loop,
File "/usr/local/lib/python3.7/site-packages/pymodbus/client/asynchronous/serial.py", line 75, in __new__
yieldable = factory_class(framer=framer, port=port, **kwargs)
File "/usr/local/lib/python3.7/site-packages/pymodbus/client/asynchronous/factory/serial.py", line 104, in async_io_factory
client = AsyncioModbusSerialClient(port, proto_cls, framer, loop, **kwargs)
File "/usr/local/lib/python3.7/site-packages/pymodbus/client/asynchronous/asyncio/__init__.py", line 689, in __init__
self._connected_event = asyncio.Event()
File "/usr/local/lib/python3.7/asyncio/locks.py", line 249, in __init__
self._loop = events.get_event_loop()
File "/usr/local/lib/python3.7/asyncio/events.py", line 644, in get_event_loop
% threading.current_thread().name)
RuntimeError: There is no current event loop in thread 'SyncWorker_1'.
There are two bugreports who could be related to these issues. One is about a direct serial connection.That one has a fix but it’s not in a release yet:
https://github.com/home-assistant/core/issues/33872
The other one is about RTU over TCP, that one is still open:
https://github.com/home-assistant/core/issues/33947
If you already run a NodeRed Instance you could switch from HA modbus integration to NodeRed & MQTT and grab the data via MQTT Sensors in HA. I did that yesterday with my installation
I have done the same, I moved all modbus read inside nodered, below my export for read sdm120 and publish data as MQTT
[{“id”:“c233fe31.d746b”,“type”:“inject”,“z”:“c5d09c5.47fefe”,“name”:“”,“topic”:“”,“payload”:“”,“payloadType”:“date”,“repeat”:“5”,“crontab”:“”,“once”:false,“onceDelay”:0.1,“x”:150,“y”:100,“wires”:[[“78678abc.6260ac”]]},{“id”:“78678abc.6260ac”,“type”:“function”,“z”:“c5d09c5.47fefe”,“name”:“sdm120 config”,“func”:“msg.payload = { value: msg.payload, ‘fc’: 4, ‘unitid’: 1, ‘address’: 0 , ‘quantity’: 72 } \nmsg.topic ="sdm120"\nreturn msg “,“outputs”:1,“noerr”:0,“x”:340,“y”:100,“wires”:[[“10575b73.1e080d”]]},{“id”:“10575b73.1e080d”,“type”:“modbus-flex-getter”,“z”:“c5d09c5.47fefe”,“name”:“sdm120Read”,“showStatusActivities”:true,“showErrors”:true,“logIOActivities”:false,“server”:“e022a16d.7d87e”,“useIOFile”:false,“ioFile”:””,“useIOForPayload”:false,“emptyMsgOnFail”:false,“x”:540,“y”:100,“wires”:[[“c2897480.708678”],]},{“id”:“c2897480.708678”,“type”:“function”,“z”:“c5d09c5.47fefe”,“name”:“”,“func”:“var rawData = new ArrayBuffer(4);\nvar intView = new Uint16Array(rawData);\nvar fltView = new Float32Array(rawData);\n\n\nintView[0] = msg.payload[1]; //low\nintView[1] = msg.payload[0]; //high\n\nvar msg1 = { payload:Math.round(parseFloat(fltView[0].toFixed(1))) };\nmsg1.topic = "smd/1/voltage";\n\n\n\nintView[0] = msg.payload[7]; //low\nintView[1] = msg.payload[6]; //high\n\nvar msg2 = { payload:parseFloat(fltView[0].toFixed(1)) };\nmsg2.topic = "smd/1/current";\n\n\n\nintView[0] = msg.payload[13]; //low\nintView[1] = msg.payload[12]; //high\nvar msg3 = { payload:Math.round(parseFloat(fltView[0].toFixed(1))) };\nmsg3.topic = "smd/1/power";\nglobal.set("actPower",msg3.payload);\n\n\nintView[0] = msg.payload[71]; //low\nintView[1] = msg.payload[70]; //high\n\nvar msg4 = { payload:parseFloat(fltView[0].toFixed(1)) };\nmsg4.topic = "smd/1/frequency";\n\n\n\nreturn [msg1, msg2, msg3 , msg4 ];\n\n”,“outputs”:4,“noerr”:0,“x”:770,“y”:100,“wires”:[[“f7a9ca52.3640d8”],[“450203de.5d6c8c”],[“76a2743f.cd745c”],[“22d0c38e.84ee4c”]]},{“id”:“f7a9ca52.3640d8”,“type”:“function”,“z”:“c5d09c5.47fefe”,“name”:“payload is changed”,“func”:“var mem=context.get("memory");\nvar forceCall=global.get("force_call");\n\nnode.status({shape:"ring",fill:"green",text:"msg: "+msg.payload +" | msg_old:"+ mem + " | fc: "+forceCall});\n\nif ((msg.payload != mem || forceCall)) {\n context.set("memory",msg.payload);\n return msg; \n }\n\nreturn null;\n\n”,“outputs”:1,“noerr”:0,“x”:1010,“y”:80,“wires”:[[“25585f16.519318”]],“info”:“if msg payload is changed then return the msg.payload otherwise return null “},{“id”:“450203de.5d6c8c”,“type”:“function”,“z”:“c5d09c5.47fefe”,“name”:“payload is changed”,“func”:“var mem=context.get("memory");\nvar forceCall=global.get("force_call");\n\nnode.status({shape:"ring",fill:"green",text:"msg: "+msg.payload +" | msg_old:"+ mem + " | fc: "+forceCall});\n\nif ((msg.payload != mem || forceCall)) {\n context.set("memory",msg.payload);\n return msg; \n }\n\nreturn null;\n\n”,“outputs”:1,“noerr”:0,“x”:1010,“y”:140,“wires”:[[“3347fd0.b2d7284”]],“info”:“if msg payload is changed then return the msg.payload otherwise return null “},{“id”:“76a2743f.cd745c”,“type”:“function”,“z”:“c5d09c5.47fefe”,“name”:“payload is changed”,“func”:“var mem=context.get("memory");\nvar forceCall=global.get("force_call");\n\nnode.status({shape:"ring",fill:"green",text:"msg: "+msg.payload +" | msg_old:"+ mem + " | fc: "+forceCall});\n\nif ((msg.payload != mem || forceCall)) {\n context.set("memory",msg.payload);\n return msg; \n }\n\nreturn null;\n\n”,“outputs”:1,“noerr”:0,“x”:1010,“y”:200,“wires”:[[“a9167b3c.ced7f8”,“46985845.386ec8”]],“info”:“if msg payload is changed then return the msg.payload otherwise return null “},{“id”:“22d0c38e.84ee4c”,“type”:“function”,“z”:“c5d09c5.47fefe”,“name”:“payload is changed”,“func”:“var mem=context.get("memory");\nvar forceCall=global.get("force_call");\n\nnode.status({shape:"ring",fill:"green",text:"msg: "+msg.payload +" | msg_old:"+ mem + " | fc: "+forceCall});\n\nif ((msg.payload != mem || forceCall)) {\n context.set("memory",msg.payload);\n return msg; \n }\n\nreturn null;\n\n”,“outputs”:1,“noerr”:0,“x”:1010,“y”:320,“wires”:[[“ced7c462.eda5d8”]],“info”:“if msg payload is changed then return the msg.payload otherwise return null “},{“id”:“ced7c462.eda5d8”,“type”:“mqtt out”,“z”:“c5d09c5.47fefe”,“name”:””,“topic”:“sdm120/1/frequency”,“qos”:“0”,“retain”:“true”,“broker”:“3c4f987a.7246”,“x”:1300,“y”:320,“wires”:},{“id”:“a9167b3c.ced7f8”,“type”:“mqtt out”,“z”:“c5d09c5.47fefe”,“name”:””,“topic”:“sdm120/1/power”,“qos”:“0”,“retain”:“true”,“broker”:“3c4f987a.7246”,“x”:1250,“y”:200,“wires”:},{“id”:“3347fd0.b2d7284”,“type”:“mqtt out”,“z”:“c5d09c5.47fefe”,“name”:””,“topic”:“sdm120/1/current”,“qos”:“0”,“retain”:“true”,“broker”:“3c4f987a.7246”,“x”:1250,“y”:140,“wires”:},{“id”:“25585f16.519318”,“type”:“mqtt out”,“z”:“c5d09c5.47fefe”,“name”:””,“topic”:“sdm120/1/voltage”,“qos”:“0”,“retain”:“true”,“broker”:“3c4f987a.7246”,“x”:1250,“y”:80,“wires”:},{“id”:“e022a16d.7d87e”,“type”:“modbus-client”,“z”:“”,“name”:“Serial_9600_8_N_1”,“clienttype”:“serial”,“bufferCommands”:true,“stateLogEnabled”:false,“queueLogEnabled”:false,“tcpHost”:“127.0.0.1”,“tcpPort”:“502”,“tcpType”:“DEFAULT”,“serialPort”:“/dev/ttyUSB0”,“serialType”:“RTU-BUFFERD”,“serialBaudrate”:“9600”,“serialDatabits”:“8”,“serialStopbits”:“1”,“serialParity”:“none”,“serialConnectionDelay”:“100”,“unit_id”:“”,“commandDelay”:“30”,“clientTimeout”:“2000”,“reconnectOnTimeout”:true,“reconnectTimeout”:“5000”,“parallelUnitIdsAllowed”:false},{“id”:“3c4f987a.7246”,“type”:“mqtt-broker”,“z”:“”,“name”:“”,“broker”:“localhost”,“port”:“1883”,“clientid”:“”,“usetls”:false,“compatmode”:false,“keepalive”:“60”,“cleansession”:true,“birthTopic”:“”,“birthQos”:“0”,“birthPayload”:“”,“closeTopic”:“”,“closeQos”:“0”,“closePayload”:“”,“willTopic”:“”,“willQos”:“0”,“willPayload”:“”}]
could one of these objects connected to my two sd230 modbuss work?
Hey Bard,
I’m struggling long time to read reliable data from the SDM120.
Ive tried it with node-red solution as well as modbus-implementation of ha.
But not reliable.
I would try your node-red implementation but importing ends wit an Unexpected token “ in JSON at position 2
Can you help me, please.
Regards Uwe
Hi @UBS-P sorry for delay, I’ll prepare a quick procedure for insert the code manually.
First of all:
-
do you have already last available node-red addon in your system?
-
have installed the library: node-red-contrib-modbus?
Anyway you can try to load this code:
https://flows.nodered.org/flow/75a4715fb6a3595057343a92abc493e4
this guy prepared also a nice video explaining the configuration of the sdm120 and then the nodered part
when i developed the code I started from this code and then I modified a little the code in order to reduce the number of reading and then demux the data read in one block of code
let me know
Hey Bard,
thanks for supporting.
The code works fine!
Especially the -formerly annoying- error message in lovelace is gone!
Regards
Uwe