-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use as Bridge #7
Comments
Hi! Try the below. There is another example in Best, from pyhap.util import generate_mac
from pyhap.accessories.AM2302 import AM2302
from pyhap.accessories.ShutdownSwitch import ShutdownSwitch
from pyhap.accessory import Bridge
from pyhap.accessory_driver import AccessoryDriver
def create_bridge():
bridge = Bridge(display_name="pyhap", mac=generate_mac(), pincode=b"203-23-999")
am2302 = AM2302("DHT22")
shutdown_switch = ShutdownSwitch("Halt")
bridge.add_accessory(am2302)
bridge.add_accessory(shutdown_switch)
return bridge
def main():
bridge = create_bridge()
driver = AccessoryDriver(bridge, port=..., address=..., persist_file=...)
# signal.signal(signal.SIGINT, driver.signal_handler) optional
# signal.signal(signal.SIGTERM, driver.signal_handler) optional
driver.start() |
I can not make it work, i can see accessory mode in homekit but not bridge mode |
This is odd. What's in your code that starts the Bridge? Is it like the one above? Or if you are using main.py from HAP-python, did you delete the file |
i test it with main.py and the one above, y delete accessory.pickle too |
i just test it with fresh install of respbian, still not working :( |
I just got a clean copy of the project and I can see both Bridge and Accessory (I am using main.py), both from a mac OS and a Raspberry Pi. Are you using a different mac address for the bridge ( Do you still see ONLY the Accessory and not the Bridge? |
in fresh install of raspberry pi i need this sudo apt-get install libavahi-compat-libdnssd-dev, now is working. i will keep testing and let you know |
Oh, avahi, for the mDNS, of course... I need to add this to the setup script. Thanks! Yes, please let me know if you manage to run it properly (or if you don't) :) |
do you have an example for use as bridge?
The text was updated successfully, but these errors were encountered: