Hunter Douglas Powerview component - expanding this API

I’ve made a custom integration because I am looking at getting these blinds.

If there are problems, let me know. Please provide detailed logs, descriptions, etc.

2 Likes

sweet, thanks man! Any chance you could make the compatible with HACS?
Also, some things to be aware of before buying these blinds:

  • BLE is crap, if your house is big, you’ll need a TON of repeaters. I literally have a repeater for every room and my house actually isn’t even that large.
  • Speaking of BLE being crap, some blinds will randomly miss commands and not follow a schedule. Ive never been able to chase this down, but between myself and a family member with these, we’ve got quite a few windows and the same behavior is seen by both of us.
  • If you get the top down, bottom up cellular shades, they have major issues with them, the strings that hold them in place slip, and commonly need to be adjusted. I’ve had mine replaced multiple times, they could never figure out the answer.
  • if you get the silhouettes, they too have issues with knowing when to stop at the end, and they’ll go beyond the ‘closed’ point and actually open slightly.

These are probably gripes, but I feel they’re justified because $20k in blinds seems like I should be getting blinds that are 100% perfect.

1 Like

Thanks Jon. Good to know.
I don’t really want dumb blinds because I like Home Assitant.

Hunter Douglas have a new Zigbee based system which should have better coverage but i can’t see an integration for it yet.

And I’ll add it to HACS once I know it works. It would be great to get some feedback here.

Oh interesting, I wasn’t aware of their zigbee option… Hopefully that is better. I’d honestly look at Lutron if I were going to do it again, even knowing that it is 1.5x the price.

Its called Qmotion.
https://www.luxaflex.com.au/products/smart-home-automation-and-motorisation/qmotion/

I asked about it in the forums but no responses.

Great idea for integration. Unfortunately, it doesn’t work for me. I’ll be happy to assist in any way possible.

Im runing HA in a docker environment on Ubuntu. Several custom integrations work like a charm.

2019-12-09 21:59:58 ERROR (MainThread) [homeassistant.components.cover] hd_powerview: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 292, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 448, in async_device_update
    await self.async_update()
  File "/config/custom_components/hd_powerview/cover.py", line 109, in async_update
    self._cover_data = self._pv.get_shade(self._cover_id)
  File "/config/custom_components/hd_powerview/cover.py", line 155, in get_shade
    shade = Shade(request['id'], b64decode(request['name']).decode('UTF-8'), round((request['positions']['position1'] / 65535) * 100), round(request['batteryStrength'] / 2))
KeyError: 'id'

power-view-hub-ip/api/shades returns

{
  "shadeIds": [
    20516,
    31636,
    55784
  ],
  "shadeData": [
    {
      "id": 20516,
      "type": 42,
      "capabilities": 0,
      "batteryStatus": 3,
      "batteryStrength": 165,
      "roomId": 15451,
      "firmware": {
        "revision": 1,
        "subRevision": 8,
        "build": 1944
      },
      "motor": {
        "revision": 51,
        "subRevision": 52,
        "build": 11825
      },
      "name": "U21hbGwgTGl2aW5n",
      "groupId": 57728,
      "positions": {
        "position1": 65535,
        "posKind1": 1
      },
      "signalStrength": 4
    },
    {
      "id": 31636,
      "type": 42,
      "capabilities": 0,
      "batteryStatus": 3,
      "batteryStrength": 163,
      "roomId": 15451,
      "firmware": {
        "revision": 1,
        "subRevision": 8,
        "build": 1944
      },
      "motor": {
        "revision": 51,
        "subRevision": 52,
        "build": 11825
      },
      "name": "QmlnIExpdmluZw==",
      "groupId": 57728,
      "signalStrength": 4,
      "positions": {
        "position1": 0,
        "posKind1": 1
      }
    },
    {
      "id": 55784,
      "type": 42,
      "capabilities": 0,
      "batteryStatus": 2,
      "batteryStrength": 120,
      "roomId": 14714,
      "firmware": {
        "revision": 1,
        "subRevision": 8,
        "build": 1944
      },
      "motor": {
        "revision": 51,
        "subRevision": 52,
        "build": 11825
      },
      "name": "QmVkcm9vbSBCbGluZHM=",
      "groupId": 7921,
      "signalStrength": 4,
      "positions": {
        "posKind1": 1,
        "position1": 3
      }
    }
  ]
}

Thanks.
I tried on my test rig with your data and it worked nicely.

Can you enable debugging for this component in configuration.yaml:

logger:
  default: info
  logs:
    homeassistant.core: debug
    custom_components.hd_powerview: debug

Then look in homeassistant.log for related log entries.

Also please post the output of:
http://ip_address/api/shade/20516
and
http://ip_address/api/shades/20516
(or any of the shade Ids)

It is unclear which if these is the correct syntax.

The correct syntax is /api/shades. I got that you were using /api/shade from the log, changed it in cover.py…

2019-12-10 23:02:45 DEBUG (MainThread) [custom_components.hd_powerview.cover] !!! URL, method, request, data: http://192.168.10.114/api/shades, get, /api/shades, None

still no cigar. Same error that is.

hd_powerview: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 292, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 448, in async_device_update
    await self.async_update()
  File "/config/custom_components/hd_powerview/cover.py", line 109, in async_update
    self._cover_data = self._pv.get_shade(self._cover_id)
  File "/config/custom_components/hd_powerview/cover.py", line 155, in get_shade
    shade = Shade(request['id'], b64decode(request['name']).decode('UTF-8'), round((request['positions']['position1'] / 65535) * 100), round(request['batteryStrength'] / 2))
KeyError: 'id'

api/shades/20516 returns

{
  "shade": {
    "id": 20516,
    "type": 42,
    "capabilities": 0,
    "batteryStatus": 3,
    "batteryStrength": 165,
    "roomId": 15451,
    "firmware": {
      "revision": 1,
      "subRevision": 8,
      "build": 1944
    },
    "motor": {
      "revision": 51,
      "subRevision": 52,
      "build": 11825
    },
    "name": "U21hbGwgTGl2aW5n",
    "groupId": 57728,
    "positions": {
      "position1": 65535,
      "posKind1": 1
    },
    "signalStrength": 4
  }
}

and api/shade/20516 returns

{"message":"Not Found","error":{}}

Im sure its a typo somewhere, but since python is not my language of choice, I don’t see it.

Thanks.

It seems that the API info linked to at the top of this series of posts is pretty wrong.
The API path is wrong and there is a “shade” object returned for a specific shade ID.

I have updated the master branch now to reflect these changes.

It should be pretty close.

It is pretty close indeed. Blinds show now up in HA as cover entities.

current_position: 100
battery_level: 60
friendly_name: Bedroom Blinds
supported_features: 15
device_class: shade

A couple of problems though. First one has to do with the fact mentioned by @go4ble previously: the hub caches battery_level and position values. A call to /api/shades instantly returns json. When ?refresh=true or ?updateBatteryLevel=true is appended to the url it takes approximately 5 seconds. Created a pull request on GitHub about this one.

The second problem is that the slider - plain and simple - doesn’t work. Meaning moving the slider - does not set the position.

Conclusion
open_shade, close_shade and stop_shade - working
set_shade_position - does not work

Regarding the refresh.
Does manually moving the blind update the values in the hub tto be reaed by HA?
If so, then we can set refresh=true only when changing position.

Regarding the position:
No idea. This post sets the position using the same Json:

I assume the correct url and message is in the logs?

I’ve fixed most of the bugs now.

The refresh issue will be ongoing as the hub effectively has a fault where it will not automatically updated the positions and battery levels after a shade is moved.

Also, for a more complete API reference, see here:

I have the Duette and Applause Standard shades. I installed through HACS and opened the shades and reloaded HA and the shades do appear but only the slider control works. The up and down arrows don’t. Is that what is expected currently?

Up and down have been noted to work.
Maybe it depends on the hub version.
I don’t actually have these shades so I’m relying on debug output from helpers.
Maybe the messages “down” and “up” are not working on your system. Maybe they need a numerical value.
Can you assist with debugging?

I have the GEN1 hub. Output is below. The numerical value for closed is 0 and if it was open all the way the value would be 65535 just like in the first post. I left off some stuff as I’m not sure if it’s sensitive data or not. “position1”:0 means it’s closed. "position1:65535 means it’s open all the way. I think the first post in this thread lays out how to get the position?

“order”:4,“type”:6,“batteryStrength”:111,“batteryStatus”:2, “positions”:{“position1”:0,“posKind1”:1}}]}

I think the Hub v1 vs v2 is the issue.

Just uploaded a change to the master branch which you should be able to access via HACS.

Give it a go!

Thanks! That did the trick for up and down however stop doesn’t work. I’ve been working on this page in my setup. Currently looks like this…

That looks great!

I think motion:stop (or up or down) is not supported in the V1 hub.

Thanks! Ah ok. There is some weirdness though. I restarted HA and only one of the shades appeared so I pulled up the output of the api and only one of them had the position populated, I manually moved the shades without a position and then the position appeared. This then requires another restart of HA. I wonder if they go to sleep possibly? Do you think a jog of the shades is needed if HA is restarted?

I have set the ability to add:

version: 1

in configuration.yaml to remove the STOP function for version 1 hubs.

I also tweaked it a bit to ensure it does a refresh=true at startup.