Skip to content

Instantly share code, notes, and snippets.

View JoelBender's full-sized avatar
🎯
Focusing

Joel Bender JoelBender

🎯
Focusing
View GitHub Profile
@JoelBender
JoelBender / send-confirmed-event-notifications.json
Created October 22, 2023 03:01
Send confirmed event notification samples
[
{
"process-identifier": 1,
"initiating-device-identifier": "device,999",
"event-object-identifier": "analog-value,1",
"time-stamp": {
"time": "01:02:03"
},
"notification-class": 1,
"priority": 0,
import asyncio
from bacpypes3.debugging import ModuleLogger
from bacpypes3.argparse import SimpleArgumentParser
from bacpypes3.app import Application
from bacpypes3.local.analog import AnalogValueObject
from bacpypes3.local.binary import BinaryValueObject
_debug = 0
@JoelBender
JoelBender / 1_Info.py
Created July 28, 2023 16:51
Streamlit relative import
import sys
import os
import os.path
import streamlit as st
from streamlit.logger import get_logger
# humph
# utils_path = os.path.realpath(os.path.pardir)
# if utils_path not in sys.path:
@JoelBender
JoelBender / data-expecting-reply.py
Created September 23, 2022 01:50
Turning on and off pduExpectingReply to follow through the stack
import sys
from bacpypes.debugging import btox
from bacpypes.pdu import Address, PDU
from bacpypes.pdu import PDU
from bacpypes.apdu import APDU, ReadPropertyRequest
from bacpypes.npdu import NPDU
from bacpypes.analysis import decode_packet
@JoelBender
JoelBender / WhoIsFuzz.py
Created June 15, 2022 06:13
Put in a "fuzz" layer in an application stack
#!/usr/bin/env python
"""
This application presents a 'console' prompt to the user asking for Who-Is
commands which create the related APDUs and sends them through a "fuzz" layer
for additional processing.
"""
from bacpypes.debugging import bacpypes_debugging, ModuleLogger
from bacpypes.consolelogging import ConfigArgumentParser
@JoelBender
JoelBender / read_property_client_only.py
Created April 14, 2022 03:49
Client-only Application
#!/usr/bin/env python
"""
This is a clone of the ReadProperty.py sample application that does not
support the Who-Is and Read-Property services (which are provided by default)
making this essentially a client-only device.
Note that it is not completely stealthy, it will respond with a Reject if
it is sent a Read-Property request.
"""
@JoelBender
JoelBender / config-file-server.json
Created August 24, 2021 04:14
JSON Writable Configuration File
{
"avar": 74.1,
"bvar": "inactive"
}
@JoelBender
JoelBender / GroupObject.py
Created August 22, 2021 06:09
GroupObject Sample
#!/usr/bin/env python
"""
This sample application shows how to create a GroupObject.
"""
import os
import random
from bacpypes.debugging import bacpypes_debugging, ModuleLogger
@JoelBender
JoelBender / sometimes-writable-value.py
Created August 13, 2021 22:15
Sometimes write access is denied
#!/usr/bin/env python
"""
This sample application shows how to extend one of the basic objects, an Analog
Value Object in this case, to provide a present value that is writable but
occasionally returns an error.
"""
import os
import random
@JoelBender
JoelBender / gist:e7de20c9b207bc3988e38b6d289c5a1b
Created July 22, 2021 03:20
AnalogValueObject with a writable object name
"""
Writable Analog Value Object
"""
from bacpypes.errors import ExecutionError
from bacpypes.primitivedata import Real, CharacterString
from bacpypes.basetypes import EngineeringUnits
from bacpypes.object import register_object_type, WritableProperty, AnalogValueObject
# from bacpypes.consolelogging import ConsoleLogHandler