initial commit
This commit is contained in:
commit
afb3ed129e
36
p1p-broadcast.py
Normal file
36
p1p-broadcast.py
Normal file
|
@ -0,0 +1,36 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import socket
|
||||
|
||||
SSDP_ADDR = "255.255.255.255";
|
||||
SSDP_PORT = 2021;
|
||||
|
||||
ssdp_content = "NOTIFY * HTTP/1.1\r\n" + \
|
||||
"HOST: 239.255.255.250:1900\r\n" + \
|
||||
"Server: Buildroot/2018.02-rc3 UPnP/1.0 ssdpd/1.8\r\n" + \
|
||||
"Location: 10.10.10.10\r\n" + \
|
||||
"NT: urn:bambulab-com:device:3dprinter:1\r\n" + \
|
||||
"USN: 000000000000000\r\n" + \
|
||||
"Cache-Control: max-age=1800\r\n" + \
|
||||
"DevModel.bambu.com: C11\r\n" + \
|
||||
"DevName.bambu.com: 3DP-01S-174\r\n" + \
|
||||
"DevSignal.bambu.com: -30\r\n" + \
|
||||
"DevConnect.bambu.com: lan\r\n" + \
|
||||
"DevBind.bambu.com: free\r\n" + \
|
||||
"Devseclink.bambu.com: secure\r\n" + \
|
||||
"\r\n"
|
||||
|
||||
ssdp_content = bytes(ssdp_content, 'utf-8')
|
||||
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||
|
||||
# Bind to localhost so we send to loopback
|
||||
sock.bind(('127.0.0.1', 1900))
|
||||
|
||||
# Set Packet Type to Broadcast
|
||||
sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
|
||||
|
||||
# Finally send out the interface
|
||||
sock.sendto(ssdp_content, (SSDP_ADDR, SSDP_PORT))
|
12
readme.md
Normal file
12
readme.md
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Broadcast for Bambu P1P Printer
|
||||
|
||||
The python script included was made so I could use Bambu Studio without the need for an internet connection. Additionally, I wanted the printer to be isolated on an IoT vlan with a statically assigned ip address, allowing only necessary traffic.
|
||||
|
||||
For discovery, the printer uses SSDP protocol, and this python script will replicate what the printer sends.
|
||||
|
||||
You will need to replace the following values in the script:
|
||||
|
||||
- `10.10.10.10` with the ip address of the printer
|
||||
- `000000000000000` with the serial number of the printer
|
||||
|
||||
Once updated, run the script and it will broadcast the packet on the local interface
|
Loading…
Reference in a new issue