-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrated and improved manual_test_cov which leads to including a defa…
…ult value of 0.15 in covIncrment for analog values in the factory... we don't want None there as it leads to errors when someone register
- Loading branch information
1 parent
bf1cbde
commit 71d504f
Showing
3 changed files
with
41 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import asyncio | ||
import random | ||
|
||
from bacpypes3.primitivedata import Real | ||
|
||
import BAC0 | ||
from BAC0.core.devices.local.factory import analog_value | ||
from BAC0.scripts.script_runner import run | ||
|
||
bacnet = None | ||
|
||
|
||
async def main(): | ||
async with BAC0.start() as bacnet: | ||
device = BAC0.start(port=47809, deviceId=123) | ||
|
||
new_obj = analog_value(presentValue=0) | ||
new_obj.add_objects_to_application(device) | ||
|
||
# From Server | ||
dev_av = device.this_application.app.get_object_name("AV") | ||
print(dev_av.covIncrement) | ||
|
||
# From client | ||
ip = device.localIPAddr.addrTuple[0] | ||
boid = device.Boid | ||
bacnet._log.info("Defining device with poll 0 so the AV won't get updated") | ||
dev = await BAC0.device(f"{ip}:47809", boid, bacnet, poll=0) | ||
av = dev["AV"] | ||
bacnet._log.info("Subscribing to AV") | ||
await dev["AV"].subscribe_cov(lifetime=90) | ||
|
||
while True: | ||
dev_av.presentValue = Real(random.randint(1, 100)) | ||
bacnet._log.info(f"Setting AV to {dev_av.presentValue}") | ||
await asyncio.sleep(5) | ||
|
||
|
||
if __name__ == "__main__": | ||
run(main, bacnet) |
This file was deleted.
Oops, something went wrong.