Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential Error in _parse_wp_args #500

Open
Kabilan001 opened this issue Sep 19, 2023 · 1 comment
Open

Potential Error in _parse_wp_args #500

Kabilan001 opened this issue Sep 19, 2023 · 1 comment

Comments

@Kabilan001
Copy link

Kabilan001 commented Sep 19, 2023

Firstly, I'm a big fan of your work.

I have an object named "limitEnable" with a current value of [0,0]. I would like to change it to [1,1] using the command:

bacnet.write("200.0.0.29 analogInput 3 limitEnable [1,1]")

However, I'm encountering the error "ValueError: invalid literal for int() with base 10: '-'." I've checked the code base and the function _parse_wp_args, but I'm still getting the same error. Could you please assist me with this?

@JoelBender
Copy link
Owner

This is a BAC0 issue, so you're actually a fan of his work :-).

The basic reason is that the particular "sub-language" in that write command doesn't support that syntax for a bit string. It's possible to extend _validate_value_vs_datatype(); if the datatype is a subclass of Enumerated then something like value = [int(x) for x in value.split(",")] then maybe a assert all(x in (0,1) for z in value) to make sure they are just bits. Your write() call becomes bacnet.write("... 1,1").

Not tested! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants