Modbus read/write entity

Hi,

I have problem that I know how to read value from modbus, but I do not know how to make it so that I would have entity on which I can see at the same time status (read value) + that I push write value in case of my interaction with entity.

Currently as only read entity:
image

The goal is to have entity as this one:
image

This is my current flow:

Flow export:
[{"id":"aefd1c89.6d311","type":"function","z":"a3a75d9a.1537a","name":"Modbus register DOV","func":"msg.payload = { value: msg.payload,\n 'fc': 3,\n 'unitid': 128,\n 'address': 21,\n 'quantity': 1\n }\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":300,"y":2200,"wires":[["48343af1.348654"]]},{"id":"48343af1.348654","type":"modbus-flex-getter","z":"a3a75d9a.1537a","name":"Modbus branje DOV","showStatusActivities":true,"showErrors":true,"logIOActivities":false,"server":"4614aa98.b0a5c4","useIOFile":false,"ioFile":"","useIOForPayload":false,"emptyMsgOnFail":false,"keepMsgProperties":false,"x":580,"y":2200,"wires":[["55bfeb05.3058f4"],[]]},{"id":"55bfeb05.3058f4","type":"function","z":"a3a75d9a.1537a","name":"msgDOV","func":"var msgDOV = parseFloat(msg.payload[0]);\n\nvar msgDOVo;\n\nmsgDOVo = {payload:msgDOV};\n\nreturn [ msgDOVo ];","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":800,"y":2180,"wires":[["751afbe6.cf32d4"]]},{"id":"751afbe6.cf32d4","type":"ha-entity","z":"a3a75d9a.1537a","name":"seltron-DOV","server":"9e9d7e1d.b9b0d","version":1,"debugenabled":false,"outputs":1,"entityType":"binary_sensor","config":[{"property":"name","value":"Centralna DOV"},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""}],"state":"payload","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? \"on\": \"off\"","outputPayloadType":"jsonata","x":990,"y":2200,"wires":[[]]},{"id":"a6fc8a86.e1e8b8","type":"inject","z":"a3a75d9a.1537a","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":90,"y":2200,"wires":[["aefd1c89.6d311"]]},{"id":"4614aa98.b0a5c4","type":"modbus-client","name":"SeltronWXD","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"tcpHost":"192.168.3.142","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"128","commandDelay":"500","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":true},{"id":"9e9d7e1d.b9b0d","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

So, can somebody help me?

Thank you.

Also, I forgot to write, that I’m reading modbus values every 60 seconds by injecting timestamp…

It looks like you have “Enkraten vklop…” configured as binary sensor, not as switch as you wanted…
My guess, but I could be wrong.

Another question: what’s your hardware…which Seltron model and any communication interface…?

Hi… I’m using WXD20M, so for main communication I use modbus via TCPIP device from papouch.com

slika

My problem is that I can read any data, but I do not have knowledge how to write it…

Hello, Can you provvide the Catalog of modbus registers for WXD20M and the shema for the communication connection, I have a similar project to do, and want to be prepared,

Hvala , Dino