I noticed you didn’t say this issue starts happening after awhile, does that mean you have this issue as soon as HA is restarted or do you have problem after several hours of it running?
I assume you aren’t seeing any issues in your logs?
I’m not sure if I’m doing things correctly, but when I try to run the script using “pip3 wink_test.py” I get ERROR: unknown command “wink_test.py”
I put my client_id and client_secret in both places where it said. 2 each for YOUR_CLIENT_ID and YOUR_CLIENT_SECRET
Do I have to put the script in a special place? I have it in the pi user’s home directory and ran it from there.I tried it both with and without sudo also.
You need to open the URL in your browser when it says “Please visit…” then after entering your username and password the URL in the address bar will have a code at the end. That code needs to be entered in the terminal
I really hate to be so stupid, but I’m on a RPi running stretch lite. No desktop to use a browser. I can’t remember for the life of me how I did this months back when I first setup wink.
I tried going to that url from another computer on the same network but I first got Redirect URI is not authorized. So I updated the 127.0.0.1 with the Redirect URI in developer and I got the login. When I login I get a 404 not found.
Ok, not sure if this is correct, but in the URL from the 404 page there is a code=REMOVED
I took that code and entered it in the script and got a token.
I commented out lines 4-11.
Added the token to and uncommented line 15.
Ran it again and no output.
So assuming this is all correct, now I run this when I have the updating state problem?
Ran a quick test. This is done remotely so I’m relying on the wink app to give me the proper state of the light.
I turned the light on from HA’s frontend. Wink app showed the light turned on but HA still showed it off. Ran the test script and the state updated to show the light was on.
I then turned the light off via the wink app and took maybe 2 or 3 seconds and HA showed the state was off.
Next I turned the light on and off via the wink app and HA updated the state within 2 or 3 seconds. I’ll be home in a few hours and I will try again so I can confirm the light is actually turning on and off.
That I do not know for sure. Last reboot was last night but I didn’t try any wink lights till just now with this test. So I don’t know if it’s a problem right from the start or if it takes a while.
Should I do another restart and test the wink lights right away?
Sounds good. I’ll check and see if it stops working again from this point forward. Or after one of my reboots because ZHA stopped working which happens every few days. May just move all my zigbee stuff back over to wink and live with the 2 or 3 second delay.
Just providing some feedback. The state in wink for my lock is correct. The HA is not. After I do a wink refresh from HA it shows correctly. In my case I am unlocking from hombridge and the status in homekit stays unlocking and HA never changes to unlocked. Wink shows updated state of unlocked
Update. The next morning the state update problem is back. I ran the test script about 2:30pm central time yesterday. I tested about 9pm and the state was still updating. I didn’t try again till 9am the next morning and the problem was back.
I ran the test script and the problem was again fixed. I will try and remember to test throughout the day to see how long it takes to stop working.