Git Product home page Git Product logo

Comments (6)

Pythonaire avatar Pythonaire commented on September 21, 2024

I think, the "HomeKit apps" will not be notified generally. The brigde is connected to the HomeKit and send/receive states.
The App connect the HomeKit an send/receive the states to/from the HomeKit. The Homekit mediates only. It seems to me, the second app have no reliable connection to the homekit. Can the second App switch and the first App see the action?

from hap-python.

th0u avatar th0u commented on September 21, 2024

The effect is the same in Use case #3 even when switching the roles of Device/Homekit App #1 and #2. I can rule out connectivity issues.

from hap-python.

Pythonaire avatar Pythonaire commented on September 21, 2024

The effect is the same in Use case #3 even when switching the roles of Device/Homekit App #1 and #2. I can rule out connectivity issues.

Question: both clients Device/Homekit App #1 and #2 are on the same iOS release? And if you swipe down on the Device/Homekit (try refresh the view) nothing changed?

I have an equal use case, but using HTTPServer (example: /accessories/Http.py) to get the device state in reverse. If i'm switching manually, the device send {"aid":XXX,"services": {"Switch": {"On": true}}}' or false to the bridge. It works as expected.

from hap-python.

th0u avatar th0u commented on September 21, 2024

@Pythonaire : Yes, both devices are on same iOS. I observed this behaviour during after multiple test/wipe/test iterations.

The http example hint is unfortunately still not an option, as said in my initial post, the switch does not have the capabilities to send something back.

from hap-python.

Pythonaire avatar Pythonaire commented on September 21, 2024

@Pythonaire : Yes, both devices are on same iOS. I observed this behaviour during after multiple test/wipe/test iterations.

The http example hint is unfortunately still not an option, as said in my initial post, the switch does not have the capabilities to send something back.

could you try additional notify() in conjunction with get_value()?

from hap-python.

Pythonaire avatar Pythonaire commented on September 21, 2024

That's my switch, with setter_callback and getter_callback, it works as expected.

class TestSwitch(Accessory):
    category = CATEGORY_SWITCH
    def __init__(self, *args, **kwargs): 
        super().__init__(*args, **kwargs)
        self.set_info_service(firmware_revision='0.0.3', model='XXX', manufacturer= 'XXX', serial_number="XXX")
        switch = self.add_preload_service('Switch', chars=['On'])
        self.UnitState = switch.configure_char('On') # bool needed
        self.UnitState.set_value(self.getState())
        self.UnitState.setter_callback = self.setState
        self.UnitState.getter_callback = self.getState()
        
    def getState(self):
        try:
            state = requests.get(url).json() # return int
        except ConnectTimeout as e:
            logging.info('**** request to {0} timed out: {1}'.format(url, e)) 
            state = 0
        return bool(state)

    def setState(self, value): # value is bool
        state = int(value)
        try:
            requests.post(url, data = str(value)) # need str
        except ConnectTimeout as e:
            state = 0
            logging.info('**** request.post got exception {0}'.format(e)) 
        return bool(state)

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.