Git Product home page Git Product logo

Comments (8)

gerswin avatar gerswin commented on May 23, 2024 1

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

from hap-python.

ikalchev avatar ikalchev commented on May 23, 2024

Hi!

Try the below. There is another example in main.py. If you have any more questions, please ask :)

Best,
Ivan

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()

from hap-python.

gerswin avatar gerswin commented on May 23, 2024

I can not make it work, i can see accessory mode in homekit but not bridge mode

from hap-python.

ikalchev avatar ikalchev commented on May 23, 2024

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 accessory.pickle before changing from accessory to bridge? (this file contains a cached accessory: after a restart of HAP-python, it reads from it and does not create a new accessory object, i.e. you may have changed the code, but the old state from the file is being used)

from hap-python.

gerswin avatar gerswin commented on May 23, 2024

i test it with main.py and the one above, y delete accessory.pickle too

from hap-python.

gerswin avatar gerswin commented on May 23, 2024

i just test it with fresh install of respbian, still not working :(

from hap-python.

ikalchev avatar ikalchev commented on May 23, 2024

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 (generate_mac() provides a random one, so if you are using this - yes)? Have you tried starting it more than once?

Do you still see ONLY the Accessory and not the Bridge?

from hap-python.

ikalchev avatar ikalchev commented on May 23, 2024

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) :)

from hap-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.