Code Monkey home page Code Monkey logo

Comments (9)

dmulcahey avatar dmulcahey commented on June 16, 2024

@drjared88 the linked PR on HA fixes this.

from zigpy.

drjared88 avatar drjared88 commented on June 16, 2024

@dmulcahey I tried your PR and I don't know if its working correctly. It seems to just send the switch state every 30 seconds which is causing my automatons to run every 30 seconds.

from zigpy.

dmulcahey avatar dmulcahey commented on June 16, 2024

Did you change polling on your own? That’s the only way that would happen...

from zigpy.

drjared88 avatar drjared88 commented on June 16, 2024

@dmulcahey No I did not.

I also noticed that with or without your code, my zha switch that if I manually try to change the state, it automatically changed back within a few seconds. It seems like the zha component constantly check the device and is sending an update at that time.

That being said I really don't know what I'm talking about. Just guessing....

from zigpy.

HDC67 avatar HDC67 commented on June 16, 2024

If you're having trouble with automations you might want them set so they detect a change from off to on or on to off rather than just detecting the state. My automations are mostly from "" to "on" or "" to "off" in HA and that works for me - I don't get repeated triggers.

from zigpy.

drjared88 avatar drjared88 commented on June 16, 2024

@ShonkyCH While this would kind of work, it takes me back to my original problem where when the switch and light are out of sync, it won't work. This happens one of two ways. First is when home assistant restarts the switch defaults to on regardless of previous state. The time this happens is if the light is controlled by automation. What ends up happening is the switch is 'on' and the light is 'off' which prevents we from being able from turning the light on without turning the switch off first.

The fix that @dmulcahey has is almost perfect. It is sending the command 'on' state even if the switch is already 'on'. Unfortunately though with the switch continually sending its state ~30 seconds it renders it useless.

from zigpy.

dmulcahey avatar dmulcahey commented on June 16, 2024

@drjared88 as I mentioned before that isn’t possible unless polling is on. I have 8 of these connected to 2 different systems and I am not experiencing this. Can you disable all of your automations and just watch state updates in the logs to see if it still happens?

from zigpy.

drjared88 avatar drjared88 commented on June 16, 2024

@dmulcahey I think I found my problem... For some reason I was missing this

@property

def should_poll(self) -> bool:

    """Let zha handle polling."""

    return False

I must have copy and pasted over top of that but I am guessing that is my issue. Sorry to bother you. You code looks good! Now hopefully it gets rolled into the master branch.

edit I'm not going crazy. In the master branch for 'class Switch' the polling section isn't there. I guess I have learned to copy the whole file instead of just the changed section. With this polling section is also seems to allow me to manually set the state through the API which I wasn't able to do before without it changing back.

from zigpy.

Adminiuga avatar Adminiuga commented on June 16, 2024

Should be supported in HA 0.93.1 via ZHA Events. Please give it a try and reopen if it doesn't work.

from zigpy.

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.