HA stops reporting Wink state changes

Well crap, thanks for testing. The work on python-wink 1.0.0 is almost done and it should fix this so it looks like we will need to wait on that.

What is the correct path for a non dev branch?

I was originally putting this in /home/hass/custom_components/

Doing that, I get this error:

17-01-19 15:01:30 homeassistant.loader: Circular dependency detected: wink -> wink

You need to add another sub directory binary_sensor/wink.py

I just did that and am restarting. So I haven’t been testing this correctly to begin with then? I am so sorry.

Still there for me too.

OK, I have things working, though a bit ugly. Credit to @happydutch from this post: https://community.home-assistant.io/t/wink-pubnub-v4-seems-to-have-broken-something/8883/3?u=tenpole21

I had to update the wink.py file found in /srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/ for this temporary fix to work. Modifying the wink.py file in custom_components did not do anything. Why is that?

1 Like

Not sure why that is happening could be why the other fixes I suggested aren’t working too?

What @happydutch suggested is a temporary work around for sure. The reason None is passed into the pubnub update is because the response from pubnub was bad. This forces an API poll to get the correct state.

I think I am going to pick up a relay in the next couple days and see what I can figure out.

@happydutch just so you know, if you have the lutron connected bulb remote support should be coming soon to allow you to use it in HA. It will also correct the error you are seeing.

I just wanted to add that it seems like it’s the physical Relay itself and in my case, only the one button that is actually connected to a load.

In addition I can turn on/off that load button from the Wink App OR from HA without generating an error. But if I use the physical button, it immediately generates the error.

I’ll hold off on using the fix that @TeNpoLe21 mentioned unless you suggest otherwise.

That’s great news @w1ll1am23. I am happy to hear that I was able to locate the bug. I haven’t been developing in HA yet, so don’t quite know how to debug this kind of situation. Next thing on my to-do list :slight_smile:

The Lutron remote support is very welcome. The Wink built in support is a bit rigid. Love to be able to fully customize it. The Lutron switches are wonderful. Small, reliable an cheap (and look good).

Oh and thanks for building the Wink support!

1 Like

This makes sense. When you push the physical button both the button and the switch in the api are trigger. Wink then determines which one to do something with. When you trigger in the app, only the active one is triggered.

Can you provide me with your exact configuration on the relay? I want to set one up the same as you. Meaning which button do you have connected to what.

Top button is connected to single gang light switch in hallway.
Bottom button is connected to a Wink shortcut for “Sleep Mode” (Turn off all lights, lock door, turn on Hue lightstrip in bedroom).

Hello w1ll1am23.

I believe I have applied your latest fixes, but my Wink devices are still not updating. I presume I have done something wrong. Would you please post the procedure for getting your latest code installed properly.

Thanks again for all your contributions.

@rpitera @kevince52 @jaalperin @happydutch @TeNpoLe21 @scadaguru

python-wink 1.0.0 has been published! I am still working on the Home-Assistant code, but it is in a state that is testable. (Mostly missing new features)

Here are the steps to test. They are going to be a little complicated but I will do my best to explain. These instructions will only working in Linux… as far as I know.

**NOTE The below steps will NOT effect your current installation because everything is going on inside of a virtualenv

  1. Open a terminal windows and navigate to your home directory cd ~/
  2. Create a new virtualenv to test in. virtualenv -p python3 hasstest
  3. Move into the new directory cd hasstest
  4. Activate the virtaulenv source bin/activate
    • Notice that your prompt changes to (hasstest) this indicates your are in the virtualenv
  5. Clone my repo git clone https://github.com/w1ll1am23/home-assistant.git
  6. Move into the home-assistant directory cd home-assistant
  7. Checkout the branch to test git checkout wink_update
  8. Install that branch to the virtaulenv python3 setup.py install
  9. Move back up a directory cd ..
  10. Make a new config directory mkdir config
  11. Move into the config directory cd config
  12. Copy your current config into this new config directory cp ~/.homeassistant/config/*.yaml .
    • Note: Your config may be somewhere else
  13. Stop your currently running home-assistant instance. sudo systemctl stop WHATEVER.service
    • Note: your service could be called anything probably something like homeassistant.service
  14. from inside the new config directory start hass. hass -c .
    • This is going to run in the foreground it is really complicated to explain how to make this run as a service

You should now be running the new python-wink and the new home-assistant code. Below are the changes you should be made aware of.

  • Door/windows sensors names have changed to include what is called their capability so what was once binary_sensor.front_door will now be called binary_sensor.front_door_opened
  • Wink Relays will now report three more sensors.
    • the gang’s connection status, will most likely be called gang and probably doesn’t have much of a purpose.
    • The top button as a binary sensor indicating if the button was pressed.
    • The bottom button as a binary sensor indicating if the button was pressed.
    • Only switches that are connect to a load will show up
  • You no longer need to set your user-agent in the home-assistant config to get access to the Wink Relay sensors.
  • Lutron connected bulb remotes will show up as a binary_sensor. The status of that sensor will be true if any button on the remote is pressed. The sensor has attributes for each button so new sensors can be made with a template sensor or automations can be made with template triggers. (Pico remotes aren’t supported)
  • Quirky powerstrips now report three devices
    • Outlet 1
    • Outlet 2
    • The main power strip. Toggling the powerstrip device will turn on/off both outlets at once.
  • Canary cameras are support as an alarm control panel. With the following state translations.
    • Disarm = Home
    • Armed = Away
    • Armed Home = Night
    • There is currently no support for setting privacy mode in Home-Assistant (Haven’t figured it out yet)
  • Nest smoke protectors now report two more sensors
    • Smoke severity (I think in a percentage)
    • CO severity also in a percentage I think.
  • Sprinklers are now support should show up as a binary switch
  • Door bells are supported as binary sensors
    • Motion
    • Button pressed
  • There is a new method of authentication. If you don’t have a client_id and client_secret you can add just your email and password to the config and your access token will be pulled from the home-assistant.io site automatically during startup.

As you can see there is a ton going on here so the more testing that can be done the better. I have tested most of these changes, and I just installed my Relay and haven’t been able to recreate any of the NoneType errors running this code.

1 Like

In the middle of another project but once I get done I’ll give this a shot. Going to look over the instructions again after lunch.

This looks like a monumental update to Wink support and I’m looking forward to testing it! Thanks for all your hard work on this project!!!

1 Like

Am I doing this in the root of the home directory or in the root of my pi user? I’m ready to give this a shot and wanted to make sure. In other words, when I execute step 2, should I be in /home or /home/pi ?

/home/pi the command in step two is an alias that takes you to the current users home directory.

I’m at the config step but I’m a bit hesitant to proceed. I’m running split configs with some configs in subdirectories. Would I be better off just running a basic config and adding only the Wink stuff for testing purposes?

That would work, or you could copy the entire config directory to the new config directory.

Well, tried copying all the YAML and conf files into hasstest/config along with the subdirectories:

pi@raspi1:~/hasstest/config$ cd ..
pi@raspi1:~/hasstest$ source bin/activate
(hasstest) pi@raspi1:~/hasstest$ cd config
(hasstest) pi@raspi1:~/hasstest/config$ hass -c
usage: hass [-h] [--version] [-c path_to_config_dir] [--demo-mode] [--debug]
            [--open-ui] [--skip-pip] [-v] [--pid-file path_to_pid_file]
            [--log-rotate-days LOG_ROTATE_DAYS] [--runner] [--script ...]
            [--daemon]
hass: error: argument -c/--config: expected one argument
(hasstest) pi@raspi1:~/hasstest/config$

Then I ran again without the -c option and it looks like it is running and installing dependencies. I’ll let it run for a bit and then check if I can get to the UI.