Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Dec 01 07:15
    Sheng2216 opened #368
  • Nov 30 03:15
    kheldaroz402 edited #367
  • Nov 30 03:15
    kheldaroz402 opened #367
  • Nov 30 02:39
    kheldaroz402 opened #366
  • Nov 30 02:13
    kheldaroz402 closed #364
  • Nov 30 02:13
    kheldaroz402 commented #364
  • Nov 29 02:41
    github-actions[bot] closed #350
  • Nov 29 02:41
    github-actions[bot] labeled #354
  • Nov 29 02:41
    github-actions[bot] commented #354
  • Nov 28 20:43
    kheldaroz402 commented #364
  • Nov 28 16:36
    ChristianTremblay commented #364
  • Nov 28 16:30
    bbartling commented #364
  • Nov 28 13:46
    ChristianTremblay commented #360
  • Nov 28 13:41

    ChristianTremblay on develop

    Merge pull request #351 from Ch… Update infos.py Update Schedule.py and 1 more (compare)

  • Nov 28 13:41
    ChristianTremblay closed #356
  • Nov 28 13:35
    ChristianTremblay commented #364
  • Nov 28 12:58
    bbartling commented #360
  • Nov 28 12:41
    bbartling commented #364
  • Nov 28 02:46
    ChristianTremblay commented #357
  • Nov 28 02:45
    github-actions[bot] labeled #352
Christian Tremblay
@ChristianTremblay
define 2 IP adresses on the same NIC
Raghavan Viswanathan
@raghavan97
Christian, That would require me to have root access. I don't have it. Is there any other work around ?
Christian Tremblay
@ChristianTremblay
a wifi + ethernet, using same subnet ?
Joel Bender
@JoelBender
@raghavan97 do you know if your controller software can be configured to be a BBMD with foreign device registration?
Raghavan Viswanathan
@raghavan97
Yes. It can be configured to be a BBMD with foreign registration
Christian Tremblay
@ChristianTremblay
Then you can use BAC0 on a different port, and register it as a foreign device
or make BAC0 the BBMD and do reverse
Raghavan Viswanathan
@raghavan97

It looks like I might be doing something wrong. This is how it is going.
code
admin@JKTGG92:~$ cat test1.py
import BAC0

def main():
bbmdIP = '192.168.11.234:47808'
bbmdTTL = 900
bacnet = BAC0.connect(
ip='192.168.11.234/24', port=47809, bbmdAddress=bbmdIP, bbmdTTL=bbmdTTL
)

bacnet.discover() #networks=[962])

print(bacnet.devices)

if name == 'main':
main()
admin@JKTGG92:~$ bgtester.python test1.py
2022-10-03 20:43:32,635 - INFO | Starting BAC0 version 21.12.03 (Lite)
2022-10-03 20:43:32,636 - INFO | Use BAC0.log_level to adjust verbosity of the app.
2022-10-03 20:43:32,637 - INFO | Ex. BAC0.log_level('silence') or BAC0.log_level('error')
2022-10-03 20:43:32,637 - INFO | Starting TaskManager
2022-10-03 20:43:32,640 - INFO | Using ip : 192.168.11.234:47809
2022-10-03 20:43:32,758 - INFO | Starting app...
2022-10-03 20:43:32,760 - INFO | BAC0 started
2022-10-03 20:43:32,761 - INFO | Registered as Foreign Device
2022-10-03 20:43:32,768 - INFO | Update Local COV Task started
2022-10-03 20:43:36,775 - INFO | Found those networks : set()
2022-10-03 20:43:36,777 - INFO | No BACnet network found, attempting a simple whois using provided device instances limits (0 - 4194303)
[]

Raghavan Viswanathan
@raghavan97
Thanks for the approach. I suspect there is an issue with the BBMD and that is why I am not getting the expected results. I will continue to debug. Thanks again, @ChristianTremblay , @JoelBender
ewmaguer
@ewmaguer

Hello @ChristianTremblay and @JoelBender and first of all, thank you for this library.
I currently need to upload information from bacnet PLC. I am connected in VPN to the local installation.
The public address of the VPN is '185.xxx.xxx.xxx/31' to a public interface '192.168.23.0/24'. On this interface, there are 4 PLCs 192.168.23.200, 192.168.23.201, 192.168.23.202, 192.168.23.203. The operator confirmed to me that no filter was applied on the bacnet port at the router and firewall. The default bacnet port is used by the PLCs. It is possible to ping the various PLCs, but impossible to perform a telnet command on the Bacnet port. However, I can't discover the PLCs on the network. Here is the code I used. Is there a problem due to the different subnet ? Or can you see others issues ?

import BAC0
bacnet=BAC0.lite(ip='185.xxx.xxx.xxx/31')
bacnet.whois()
bacnet.disconnect()

and also this one

import BAC0
print(BAC0.version)
bacnet = BAC0.lite()
device = BAC0.device("192.168.23.200", 1, bacnet);
device = BAC0.device("192.168.23.201", 2, bacnet);
device = BAC0.device("192.168.23.202", 3, bacnet);
device = BAC0.device("192.168.23.203", 4, bacnet);
print(bacnet.registered_devices)
print(device.points)
bacnet.disconnect()

Thank you in advance for your help

Ben Bartling
@bbartling
I think you may have better luck not going thru a VPN...can you remote into a machine onsite install Py and pip install BAC0 on it?
Try a BACnet scan tool to see if the scan tool can hit the devices to trouble shoot BAC0
I use this it's free...if this doesn't work BAC0 or some sort of scripting method definitely won't work either.....you can do the same thing thru the tool perform device and point sensors, make read and writes .... To release write null, etc...
ewmaguer
@ewmaguer
Thank you for your answer. The problem is that we have to go through a VPN. But I will try to go on site in order to eliminate a problem in the local network. However, I have little hope because a bacnet supervision is already in operation. Unless I am mistaken, the first script should be able to discover the whole bacnet network ?
Joel Bender
@JoelBender
@ewmaguer You have told us the public (outside) IPv4 of the VPN into the network, I suspect that you are given a dynamic address on the inside, assume that it is 192.168.23.99. At the time you connect you should be able to find that address and it's going to change each time you connect out of pool of IPv4 addresses.
Joel Bender
@JoelBender
Now when you tell BAC0 to open the socket, use 192.168.23.99/24. Because BACnet is UDP and not TCP (there is no "connection") you probably will not be able to open a "broadcast listener" socket on ('192.168.23.255', 47808), the VPN tunnel not allow that. You can use unicast packets (talk directly to the device without trying to discover it) and read the point list, or register as a foreign device with one of the other four BACnet/IPv4 devices that happens to have that feature enabled.
Note that may VPN client/server software implementations are not at all happy with UDP and stick strictly to TCP. BACnet Secure Connect is designed help with that because the sockets used during the connection are all ephemeral.
ewmaguer
@ewmaguer
Thank you for your answer Joel Bender. I will try this.
I would just like to have a clarification on how to implement the connection. If I perform the following command:
bacnet = BAC0.lite("192.162.23.99/24"), the server will be unable to perform the action since the only public interface known locally is the VPN public address 185.xxx.yyy.zzz. Did I understand something wrong when you wrote "tell BAC0 to open the socket, use 192.168.23.99/24" ?
Thanks again for your help
Christian Tremblay
@ChristianTremblay

When connected to the VPN, your computer will receive an IP address in some range given by the VPN server. Use that IP to define bacnet = BAC0.lite

This will tell BAC0 to use the VPN network interface for communication.

If this IP is in the range of the controllers, discovery will be possible. If the VPN server make some kind of route between a VPN subnet and another network, you will need a BBMD in the controllers subnet. BAC0 will be able to register itself as a foreign device to it.
ewmaguer
@ewmaguer
Okay, thanks a lot, I see. So I need to configure one of the devices on the network subnet as a BBMD. It is a device configuration. Thanks again
Xiaohan Fu
@Reapor-Yurnero
Hello, do we have documentation that is viewable online for this tool?
Christian Tremblay
@ChristianTremblay
image.png
Xiaohan Fu
@Reapor-Yurnero
thanks!
Christian Tremblay
@ChristianTremblay
I'm open to PR improving the docs, just saying
ewmaguer
@ewmaguer
Sorry to bother you again. I don't understand why we need a bbmd if we use an IPSEC tunnel. With this system we are supposed to connect directly to the local interface?
Is there a problem with encapsulating bacnet frames through the tunnel?
Christian Tremblay
@ChristianTremblay
it is just a matter of subnet for broadcast. If your VPN interface gets an address in the same subnet, it will work without BBMD.
Christian Tremblay
@ChristianTremblay
If you point to a controller directly, not using any discovery tool (whois,etc) relying on broadcast, communication will work without a BBMD. (BACnet Broadcast Management Device)
2 replies
Chipbutty
@chipbutty

I have a python/BAC0 script that used to work before. However we recently updated the BACnet stack to revision 4. Running the script now disconnects the device. Nothing has changed in the script except the BACnet stack upgrade on the device on which the test is run.

============================= test session starts =============================
collecting ... 2022-10-18 13:59:09,772 - INFO | Starting BAC0 version 21.12.03 (Lite)
2022-10-18 13:59:09,772 - INFO | Use BAC0.log_level to adjust verbosity of the app.
2022-10-18 13:59:09,772 - INFO | Ex. BAC0.log_level('silence') or BAC0.log_level('error')
2022-10-18 13:59:09,773 - INFO | Starting TaskManager
2022-10-18 13:59:09,774 - INFO | Using ip : 192.168.1.9
2022-10-18 13:59:09,971 - INFO | Starting app...
2022-10-18 13:59:09,971 - INFO | BAC0 started
2022-10-18 13:59:09,971 - INFO | Registered as Simple BACnet/IP App
2022-10-18 13:59:09,975 - INFO | Update Local COV Task started
2022-10-18 13:59:09,975 - INFO | Changing device state to DeviceDisconnected'>

BACNET/test_setpoints_bacnet.py:None (BACNET/test_setpoints_bacnet.py)
..\BACNET\test_setpoints_bacnet.py:26: in <module>
controller = BLib.BAC0controller(my_object_list=sp_obj_list)
..\commonLib.py:254: in BAC0controller
my_controller = BAC0.device(device_ip, device_instance, bacnet, object_list=my_object_list, segmentation_supported=False )
C:\Program Files\Python310\lib\site-packages\BAC0\core\devices\Device.py:199: in init
self.new_state(DeviceDisconnected)
C:\Program Files\Python310\lib\site-packages\BAC0\core\devices\Device.py:215: in new_state
self._init_state()
C:\Program Files\Python310\lib\site-packages\BAC0\core\devices\Device.py:853: in _init_state
self.connect()
C:\Program Files\Python310\lib\site-packages\BAC0\core\devices\Device.py:865: in connect
name = self.properties.network.read(
C:\Program Files\Python310\lib\site-packages\BAC0\core\io\Read.py:123: in read
self.build_rp_request(
C:\Program Files\Python310\lib\site-packages\BAC0\core\io\Read.py:437: in build_rp_request
obj_inst = int(obj_inst)
E ValueError: invalid literal for int() with base 10: '\x0014567'

Xiaohan Fu
@Reapor-Yurnero
@ChristianTremblay Hi Christian, I wonder why do we minus 1 here at:https://github.com/ChristianTremblay/BAC0/blob/0d12fc1903d4beb6072866a461cc7261f8703017/BAC0/core/functions/Schedule.py#L112 when defining dailyschedule object. this doesn't seem to be consistent with the behavior of reading. For example, if a multistate has 4 states, the reading of presentValue will be 1-4 in correspondence to each state. I would be very surprised to see that when writing it will be 0-3
Xiaohan Fu
@Reapor-Yurnero
Also the if statement above this line will never be true because it will always be a dictionary rather than a list. Moreover, in the case of {"inactive": 0, "active": 1}, the above minus 1 will make it negative when v= 'inactive' and cause "unsigned int required" error in Enumerated().
Christian Tremblay
@ChristianTremblay
@chipbutty please open an issue on Gitter.. it's too hard to follow here
@Reapor-Yurnero I don't remember why... but there was a mismatch and the code works
Xiaohan Fu
@Reapor-Yurnero
I don't have a device by my hand that has a schedule linked to a multistate so I can't test it readily now. but the code does not work when the linked object is a binaryValue according to my test because of the reason I mentioned above. I also have submitted a pull request for that issue which fix the typo I mentioned
Christian Tremblay
@ChristianTremblay
I see ! I have the reverse situation. MV schedules...no BV
Chipbutty
@chipbutty
@ChristianTremblay I've logged an issue related to bacnet.write()
ChristianTremblay/BAC0#357
Sekiro-kost
@Sekiro-kost

Hello
I tried to change the log level of :
Task 281473074335984 | update_local_cov_Update Local COV Task executed. update_local_cov_Update Local COV Task | Avg exec delay : 5.01 sec | Avg latency : 0.01 sec | last executed : 2022-11-16 11:01:44 | Next Time : 2022-11-16 11:01:49
0265|[2022-11-16 11:01:49]DEBUG : Executing : update_local_cov_Update Local COV Task

I tried with BAC0.log_level('silence') or other, and it's works for others messages, but not for this Task messages

Someone got an idea ?
archanagogawale-eaton
@archanagogawale-eaton
I need to read data from controller (Gateway) which is connected to multiple devices. For all this device I have single ip address. Check my Yabe view for gateway , I can connect to gateway using device= BAC0.device('IP ', 102, BACNet) but I am unable to connect with other devices (132, 133 ....) . Gateway basically assign id's to these devices. We need provide only base ID and routed network number in gateway BACNet configuration . @ChristainTremblay any pointers to resolve this ?
image.png
Christian Tremblay
@ChristianTremblay
what would help is
bacnet.discover()
there isn't enough information on that picture
archanagogawale-eaton
@archanagogawale-eaton
image.png
This is outcome of discover command , 400 network has multiple devices (device id 132 to 139) all of them are communicating over same ip address , I am able to connect with router using device= BAC0.device('ip address', 102, bacnet) command. As device 102 is router to 400 network, but I am not able to connect with other devices device= BAC0.device('ip address', 132, bacnet) is not working
Christian Tremblay
@ChristianTremblay
Once discover is done, you can call bacnet.devices
You will see that device under 400 probably have an address like 400:2 (example)
Use that instead of ip
archanagogawale-eaton
@archanagogawale-eaton
It worked , I used bacnet.discoveredDevices . Thanks!