Wink API status sensors

Leaving everything below for reference, but this solution is flawed. Any time Wink make an update element are added to the page breaking the counts. So @fabaff suggested using the feedreader component. The below config will send a notification of the update’s title.

Setup the feed.

feedreader:
  urls:
    - http://status.winkapp.com/history.atom

And the automation

  - alias: wink feed
    trigger:
      - platform: event
        event_type: feedreader
    action:
      service: notify.notify
      data_template:
        message: "{{ trigger.event.data.title }}"

I also believe that trigger.event.data.content can be used to get the details of the feed update.

Everything below is here for reference, but doesn’t work correctly.

There have been Home-Assistant issues opened in the past for issue that were actually a result of Wink API issues. These sensors parse the http://status.winkapp.com page and will provide users with an easy way to check/get notify of Wink API problems. @fabaff Thanks for the work on the new scrape platform!

Below are all of the availble API statuses. Chances are you won’t want/need all of them. To get the status of all systems, use the first sensor. This will report “All Systems Operational” if everything is working.

If you would like more specifc statuses review the other availble sensors, The wink.com sensor will not indicate any issues with devices, and is only reporting on the status of the end user wink.com public site.

As far as I can tell there are 5 possible statuses for the sensors (other than the overall status sensor) those statuses are listed below.

Operational
Degraded Performance
Partial Outage
Major Outage
Maintenance

At the bottom of this post I have also included an automation example for sending a notification based on the status of the wink core api.

  - platform: scrape
    resource: http://status.winkapp.com/
    name: Overall Wink Status
    select: "span:nth-of-type(5)"
  - platform: scrape
    resource: http://status.winkapp.com/
    name: Wink.com
    select: "span:nth-of-type(9)"
  - platform: scrape
    resource: http://status.winkapp.com/
    name: Wink core API
    select: "span:nth-of-type(13)"
  - platform: scrape
    resource: http://status.winkapp.com/
    name: Wink hub API
    select: "span:nth-of-type(16)"
  - platform: scrape
    resource: http://status.winkapp.com/
    name: Nest integration
    select: "span:nth-of-type(19)"
  - platform: scrape
    resource: http://status.winkapp.com/
    name: TCP integration
    select: "span:nth-of-type(22)"
  - platform: scrape
    resource: http://status.winkapp.com/
    name: Honeywell integration
    select: "span:nth-of-type(25)"
  - platform: scrape
    resource: http://status.winkapp.com/
    name: Chamberlain MyQ integration
    select: "span:nth-of-type(28)"
  - platform: scrape
    resource: http://status.winkapp.com/
    name: Sensi integration
    select: "span:nth-of-type(31)"
  - platform: scrape
    resource: http://status.winkapp.com/
    name: Echo integration
    select: "span:nth-of-type(34)"

Automation

  - alias: wink troubles
    trigger:
      platform: state
      entity_id: sensor.wink_core_api
      from: "Operational"
    action:
      service: notify.notify
      data_template:
        message: >
          Wink core API {{ states.sensor.wink_core_api.state }}.
5 Likes

Holy crap! I was planning on doing the same thing as soon as @fabaff did the PR for the scraper. I owe you one as this saved me an enormous amount of work! Cheers!!

This is great! Hoping that they actually update their status page when they should!

I’ve used a slightly different automation rule that I’ll share:

- alias: "130_0003 Wink Issues"
  trigger:
    platform: state
    entity_id:
      - sensor.wink_core_api
      - sensor.wink_hub_api
      - sensor.nest_integration
      - sensor.echo_integration
    from: "Operational"
  action:
    service: notify.notify
    data_template:
      message: 'Wink issues reported for: {{ trigger.to_state.attributes.friendly_name }}'

On another, completely different topic, I got the new Wink Hub 2 today and the time it takes to start HASS has dramatically lessened. It used to take around 4-5 minutes from start command to every last automation rule initialized. It now takes less than 30 seconds. The new hub is the ONLY thing to have changed. Either my old hub had issues or this new one is much faster! I know there is a hardware upgrade, but didn’t expect this much performance gain. Perhaps the wired connection…?

1 Like

Glad you found this useful! I do know they updated the page last week during that big ddos so pretty sure they keep it updated.

Not sure how the new hub could speed things up, HA currently only access the wink api, no direct connection to the wink hub. However, I have noticed speed improvements in the lasted HA build, did you just upgrade?

No problem, I was doing this prior to the scrape sensor, but using a command line sensor and another python script. This way is much cleaner.

I’m pretty quick to upgrade, so nope it wasn’t an upgrade. It is odd especially since it is so dramatic and consistent.

@w1ll1am23 - How did you figure out this part?

I was looking to create a similar set of sensors for IFTTT, which uses the same format as Wink at status.ifttt.com and I’m looking at the divs and can’t figure out how you got here. I tried to compare your code to the CSS on status.wink.com but can’t figure out how you determined which span to use and how you got the count.

It was a pain lol. So I had to look at the doc for beautifulsoup4 which is what the scrape sensor is using to know how to use the span:nth-of-type() and @fabaff explained it as well. Once I figured that out I downloaded the HTML for the wink status page and started at the top and counted the number of spans. Anything that is a <span></span> counts as 1. It took some trial and error as well because I kept missing spans I didn’t see.

So… if I counted right I think you should be able to use “span:nth-of-type(7)” to get the status of the first item on that page “IFTTT.com

1 Like

I forgot that was mentioned in the original pull request for the scraper… I feel kinda dumb for making you take the time to tell me that; I should have looked it up. But I really do appreciate the pointer as well as you taking the extra time to look at IFTTT and give me a starting point.

I do hope I can find a way to help you out in the future as a payback!

Not a problem, glad I could help. Just make sure once you get it all figured out you post it somewhere so someone else has to do it again!

1 Like

Of course! I share everything I can here.

So… just had an issue with this and I am not sure how to fix it. Wink just updated their page and indicated there are delays in realtime updates. I believe this added an additional <span></span> which throws this all off. I did get a notification that there was an issue, but the text in the notification was incorrect. So if anyone has any idea how to handle a page that is dynamic using beautifulsoup4 maybe @fabaff ? input would be awesome.

Perhaps could the feedreader component be an alternative as Wink.com is providing feeds.

If there is no real identification option for a tag then nth-of-type(x) doesn’t work well when new elements appear.

I tried setting this up when I first started but there’s little to no documentation on feedreader or any examples of how to display the results. That’s why I was so happy when you created the scraper.

BTW, this is OT @fabaff but on your trend sensor (which I also am a huge fan of) is there any way you could add support for the icon attribute in customize? I’m using it as part of my weather analysis page and I’d love to use relevant icons.