ChristianTremblay / BAC0

BAC0 - Library depending on BACpypes3 (Python 3) to build automation script for BACnet applications
GNU Lesser General Public License v3.0
177 stars 100 forks source link

BACnet Write Property Request Not Being Sent (Verified via Wireshark) #498

Open tjarkst opened 7 hours ago

tjarkst commented 7 hours ago

The write_property method is not sending BACnet packets as expected. While read operations work correctly, write operations fail silently with no packets visible in Wireshark.

Reproduction Steps


import BAC0

# Initialize connection
bacnet = BAC0.lite(ip='192.168.0.97', port=port)

# Read works
read_result = bacnet.read('192.168.0.100 analogValue 459 presentValue')
print(f"Read successful: {read_result}")

# Write fails silently
write_result = bacnet.write('192.168.0.100 analogValue 459 presentValue 100 - 8')
print(f"Write attempted: {write_result}")

![image](https://github.com/user-attachments/assets/26cca76a-5016-4a06-b987-7c2cebeae650)
ChristianTremblay commented 7 hours ago

Try

await bacnet._write(args)

And tell me if it is better

ChristianTremblay commented 7 hours ago

Complément : the write method creates a asyncio task. With await _write you force the write to happen now.

tjarkst commented 7 hours ago

It worked indeed