How can I fix "Network unreachable" error in BACnet temperature sensor setup on Raspberry Pi 4

Hey guys, am creating a building automation system using a Raspberry Pi 4 with Embedded Linux. The system should read data from a BACnet temperature sensor. I have checked the BACnet network configuration and IP address, verified the BACnet device status and settings, ensured the BACnet library is correctly installed and configured. But am getting the error Network unreachable
from bacpypes.core import run
from bacpypes.app import BIPSimpleApplication
from bacpypes.object import AnalogInputObject
from bacpypes.service.device import LocalDeviceObject

this_device = LocalDeviceObject(
objectIdentifier=('device', 1234),
objectName='BACnetDevice',
vendorIdentifier=15
)

this_application = BIPSimpleApplication(this_device, '192.168.1.10/24')

temperature_sensor = AnalogInputObject(
objectIdentifier=('analogInput', 1),
objectName='TemperatureSensor',
presentValue=0.0,
)

this_application.add_object(temperature_sensor)

def read_temperature():
temperature = temperature_sensor.presentValue
print(f"Temperature: {temperature}")

run()
from bacpypes.core import run
from bacpypes.app import BIPSimpleApplication
from bacpypes.object import AnalogInputObject
from bacpypes.service.device import LocalDeviceObject

this_device = LocalDeviceObject(
objectIdentifier=('device', 1234),
objectName='BACnetDevice',
vendorIdentifier=15
)

this_application = BIPSimpleApplication(this_device, '192.168.1.10/24')

temperature_sensor = AnalogInputObject(
objectIdentifier=('analogInput', 1),
objectName='TemperatureSensor',
presentValue=0.0,
)

this_application.add_object(temperature_sensor)

def read_temperature():
temperature = temperature_sensor.presentValue
print(f"Temperature: {temperature}")

run()
@Middleware & OS
Solution:
Systemctl stop firewalld
Jump to solution
8 Replies
controls4all
controls4all6mo ago
Is there firewall installed make sure udp 47808 is open
Boss lady
Boss lady6mo ago
Yes my firewall is still up should I deactivate it
controls4all
controls4all6mo ago
Stop firewalld
Solution
controls4all
controls4all6mo ago
Systemctl stop firewalld
controls4all
controls4all6mo ago
Or add 47808 allowed as udp
controls4all
controls4all6mo ago
Glad to see people on building automation here 🤘
controls4all
controls4all6mo ago
In bound to raspberry pi could be the culprit
Boss lady
Boss lady6mo ago
Lemme do this now and recheck my configuration, I would give a feedback 👍
Want results from more Discord servers?
Add your server