Comments (2)
It looks like you are writing the entire priority array in one shot when you should be writing a Null
to the to the Present_Value property and providing the priority as a the parameter to the Write Property Request. The Priority_Array is a read-only property.
>>> request = WritePropertyRequest(destination=Address("1.2.3.4"),
... objectIdentifier=('analogValue', 1), propertyIdentifier='presentValue',
... propertyValue=Any(),
... priority=8
... )
>>> request.propertyValue.cast_in(Null())
You really don't want to stomp on the priority array items that have been written by other, perhaps higher priority processes, and you don't want to have to read the whole thing then write it back out again for the same reason, so it's read-only.
from bacpypes.
thanks Joel - that actually makes sense - maybe I'm getting the hang of python / BACnet
updated code for reference
`def release_bacnet_priority(device_instance, addr, object_type, priority=8):
logging.info(f"Releasing Priority {priority} on Device {device_instance} at {addr} ({object_type})")
# Create the write request
request = WritePropertyRequest(
objectIdentifier=(object_type, device_instance),
propertyIdentifier='presentValue',
propertyValue=Any(),
priority=priority
)
request.propertyValue.cast_in(Null())
request.pduDestination = Address(addr)
iocb = IOCB(request)
# Attach the address to the IOCB instance
iocb.addr = addr
iocb.object_type = object_type
callback_function = lambda iocb, prop='presentValue': on_property_release_response(iocb, prop)
iocb.add_callback(callback_function)
this_application.request_io(iocb)
def on_property_release_response(iocb, prop):
if iocb.ioError:
logging.error(f"{color.RED}Error Releasing to property {prop} on {iocb.addr} ({iocb.object_type}): {iocb.ioError}{color.END}")
else:
logging.info(f"{color.GREEN}Successfully Released Priority on property {prop} on {iocb.addr} ({iocb.object_type}){color.END}")`
from bacpypes.
Related Issues (20)
- asyncore removed from python 3.12 HOT 4
- Issue in dockerising an MSTP application using Misty and BACpypes HOT 1
- Problem with ConfirmedEventNotification in BACpypes Sample HOT 2
- BACnet device is not discoverable in Yabe HOT 4
- MAC Address from I-Am HOT 2
- Do we need to modify our code if we are prefering BACnet port as TCP over UDP? HOT 1
- Dependency asyncore has been removed in python 3.12. HOT 2
- How do I alter the object properties' values while the simulator is running? HOT 1
- Remote network responds to WhoIsIAm but not ReadProperty HOT 5
- COV - how is Priority handled HOT 1
- COV subscription setting lifetime to 0 causes Error HOT 2
- Erroneous Day-of-week code in packet when building readRange log-buffer request with time-range HOT 6
- Upload GitHub release and PyPI archive HOT 2
- Python 3.12 Unsupported version of Python HOT 2
- Priority Array HOT 2
- External Device writing to one of My Objects HOT 7
- Is there a way to detect where a change came from in the BACnet Stack? HOT 2
- Issue with first use of set_timeout of IOCB when updating from v0.16 to v0.18 HOT 2
- [HELP] Unable to detect multiple devices connected to the same panel address HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bacpypes.