ChristianTremblay / BAC0

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

I-Am response broken #332

Closed LytixDev closed 2 years ago

LytixDev commented 2 years ago
import BAC0, json
with open('parameters_copy.json') as f:
    parameters = json.load(f)

my_ip = parameters["my_ip"]
bbmdIP = parameters["bbmdIP"]
bbmdTTL = parameters["bbmdTTL"]
bacnet = BAC0.connect(ip=my_ip, bbmdAddress=bbmdIP, bbmdTTL=bbmdTTL)

where:

"my_ip": "xxx.xxx.xxx.xxx/24",
"bbmdIP": "xxx.xxx.xxx.xxx:47811",
"bbmdTTL":  1800,

Then when running len(bacnet.whois()) I sometimes get 8 and sometimes 9. After I have gotten 9 once it will remain giving 9. However, there are in fact 55 devices on the network. I have verified this with a BACnet Discovery Tool.

Furthermore bacnet.discover() gives:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
c:\Users\nicol\Documents\sintef\bacforsk\discoverControllers.ipynb Cell 2' in <cell line: 1>()
----> [1](vscode-notebook-cell:/c%3A/Users/nicol/Documents/sintef/bacforsk/discoverControllers.ipynb#ch0000001?line=0) bacnet.discover()

File c:\Users\nicol\AppData\Local\Programs\Python\Python310\lib\site-packages\BAC0\scripts\Lite.py:225, in Lite.discover(self, networks, limits, global_broadcast, reset)
    223 # Try to find local routers...
    224 self.whois_router_to_network()
--> 225 self._log.info("Found those networks : {}".format(self.known_network_numbers))
    227 if networks:
    228     if isinstance(networks, list):
    229         # we'll make multiple whois...

File c:\Users\nicol\AppData\Local\Programs\Python\Python310\lib\site-packages\BAC0\scripts\Lite.py:177, in Lite.known_network_numbers(self)
    175         net = addr.split(":")[0] if ":" in addr else None
    176         if net:
--> 177             self.this_application.nse._learnedNetworks.add(int(net))
    179 return self.this_application.nse._learnedNetworks

ValueError: invalid literal for int() with base 10: '10.205.34.103'
LytixDev commented 2 years ago

Fixed by removing the default gateway