This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

write to modbus with bitmask
#6
(10.02.2022, 08:25)admin Wrote: Try using multiple register write instead:
Code:
value = 4 -- bit 2 set to 1
res, err = mb:writemultipleregisters(33471, value)
log(res, err)

I get this output now:
* arg: 1
  * number: 1
* arg: 2
  * nil
I see the alarms are reset this way. Thanks.

(10.02.2022, 07:48)Erwin van der Zwart Wrote: Hi,

You can use your setbit script but instead of writing direct to modbus by script you should write the output value of your script to a virtual object and use the modbus template mapped to this virtual object.

Hi Erwin,

The reset works with the writemultipleregisters in the script. Now I want to move on to the profile way as you suggested.
1/ Is it sufficient to add to the modbus profile something like this:
    {
      "name": "reset flow error (err 20)",
      "bus_datatype": "int16",
      "datatype": "int16",
      "type": "register",
      "address": 33471,
      "writable": 1,
      "value_bitmask": 0x4
    }
and then link that to a virtual object?
2/ I've set the polling interval of that device to 55 seconds. Is then the value of the object written to the device every time? I'm asking because now I use a script to write values, but only when they change (like the setpoint for the cooling depending on the dewpoint).

Greets
Reply


Messages In This Thread
RE: write to modbus with bitmask - by admin - 09.02.2022, 07:52
RE: write to modbus with bitmask - by admin - 10.02.2022, 08:25
RE: write to modbus with bitmask - by jeroen@stevens.biz - 10.02.2022, 17:09
RE: write to modbus with bitmask - by admin - 11.02.2022, 08:03

Forum Jump: