Try wrapping the value in a PlcINT, so PlcINT(2)

On Tue, 29 Oct 2024 at 10:21 PM, telmobarrena98 (via GitHub) <g...@apache.org>
wrote:

>
> telmobarrena98 opened a new issue, #1856:
> URL: https://github.com/apache/plc4x/issues/1856
>
>    ### What happened?
>
>    I am trying to write an integer variable value with python and modbus
> with the following code:
>    ```
>    with connection.write_request_builder() as builder:
>                builder.add_item("Random Tag 1", "4x00001", 2)
>                request = builder.build()
>    ```
>    However, I am receiving this error:
>    `AttributeError: 'int' object has no attribute 'get_int'`
>    Changing the DataItem.py 583 line, from:
>    `value: int = _value.get_int()`
>    to:
>    `value: int = _value`
>    makes the code work, is it a bug? or should I convert the integer value
> in
>    `builder.add_item("Random Tag 1", "4x00001", 2)`
>    to any type?
>
>    ### Version
>
>    v0.13
>
>    ### Programming Languages
>
>    - [ ] plc4j
>    - [ ] plc4go
>    - [ ] plc4c
>    - [ ] plc4net
>
>    ### Protocols
>
>    - [ ] AB-Ethernet
>    - [ ] ADS /AMS
>    - [ ] BACnet/IP
>    - [ ] CANopen
>    - [ ] DeltaV
>    - [ ] DF1
>    - [ ] EtherNet/IP
>    - [ ] Firmata
>    - [ ] KNXnet/IP
>    - [X] Modbus
>    - [ ] OPC-UA
>    - [ ] S7
>
>
> --
> This is an automated message from the Apache Git Service.
> To respond to the message, please log on to GitHub and use the
> URL above to go to the specific comment.
>
> To unsubscribe, e-mail: issues-unsubscr...@plc4x.apache.org.apache.org
>
> For queries about this service, please contact Infrastructure at:
> us...@infra.apache.org
>
>

Reply via email to