Hunter Douglas Powerview component - expanding this API


#1

Someone published the Powerview API using this API I was able to get the state of the blinds rather than just calling the scenes.

Code to display the position of the Hunter Douglas Blinds below

But I would like to see a slider implemented so that you could set them in Home Assistant rather than set using Scenes.

sensors.yaml

  - platform: rest
    resource: http://<IP ADDRESS OF BLIND HUB>/api/shades
    name: Shade Positions
    json_attributes:
      - shadeData
    value_template: "{{ value_json.value }}"
    scan_interval: 20

      main_shade_position:
        friendly_name: Main Shade Position
        icon_template: mdi:blinds
        value_template: >
          {% if states.sensor.shade_positions.attributes.shadeData[1].positions.position1 == 65535 %}
            Open
          {% elif states.sensor.shade_positions.attributes.shadeData[1].positions.position1 == 0 %}
            Closed
          {% else %}
            {{ ((1 - (states.sensor.shade_positions.attributes.shadeData[1].positions.position1 / 65535)) * 100) | round(0) }}%
          {% endif %}
      kitchen_shade_position:
        friendly_name: Kitchen Shade Position
        icon_template: mdi:blinds
        value_template: >
          {% if states.sensor.shade_positions.attributes.shadeData[0].positions.position1 == 65535 %}
            Open
          {% elif states.sensor.shade_positions.attributes.shadeData[0].positions.position1 == 0 %}
            Closed
          {% else %}
            {{ ((1 - (states.sensor.shade_positions.attributes.shadeData[0].positions.position1 / 65535)) * 100) | round(0) }}%
          {% endif %}

#2

How well are these blinds working with HA for you? Do you bu chance have Duette Duolite blinds? If so, can you set them to “up”, “opaque”, and “sheer” settings separately (even if through scenes)?

Looking at getting these, concerned about integration.


#3

I use IFTTT triggers right now to activate different scenes and works pretty well. It was frustrating to not know the position of them though. But through my above script I can now see them. It was be awesome if someone would implement a shade similar to the app so you could send the position and it go there.

I only have the electric rolling shades. So mine are either down or up (or in between)
Overall very happy to have automated / electric shades.


#4

I don’t know how to do it, but it seems like a Template Cover could be created from the PowerView API. It should allow a set_cover_position command, as well as open/close, while reporting current position via position_template. Anyone with expertise willing to show us how this is done?


#5

Yeah I know APIs pretty well but not so much on making a decent looking component. But if anyone wants to work on this that would be amazing.


#6

It would be amazing if someone can get this working since it seems that 0.86.4 has broken PowerView scenes for me


#7

Hi bit of a newbie to this, tried putting your code into the my sensors.yaml and get an error when checking the configuraiton - Error loading /config/configuration.yaml: mapping values are not allowed here - if I just leave the paramters section in i get a sensor for my blinds


#8
- platform: rest
  resource: !secret blind_hub_rest_url
  name: Shade Positions
  json_attributes:
    - shadeData
  value_template: "{{ value_json.value }}"
  scan_interval: 15

This exact code is in my sensors.yaml configuration, make sure your spacing is correct.
I have broken up my config into muliple configs so it’s easy for me to parse through, but feel free to look at my GitHub here, if you find it useful Star the repo so others can find it. Thanks!

The file that I use is /components/sensors/api_rest.yaml

If the API part is working and showing up in HomeAssistant but the templates are not working, check the code out below

- platform: template
  sensors:
    main_shade_position:
      friendly_name: Main Shade Position
      icon_template: mdi:blinds
      value_template: >
        {% if states.sensor.shade_positions.attributes.shadeData[1].positions.position1 == 65535 %}
          Open
        {% elif states.sensor.shade_positions.attributes.shadeData[1].positions.position1 == 0 %}
          Closed
        {% else %}
          {{ ((1 - (states.sensor.shade_positions.attributes.shadeData[1].positions.position1 / 65535)) * 100) | round(0) }}%
        {% endif %}
    kitchen_shade_position:
      friendly_name: Kitchen Shade Position
      icon_template: mdi:blinds
      value_template: >
        {% if states.sensor.shade_positions.attributes.shadeData[0].positions.position1 == 65535 %}
          Open
        {% elif states.sensor.shade_positions.attributes.shadeData[0].positions.position1 == 0 %}
          Closed
        {% else %}
          {{ ((1 - (states.sensor.shade_positions.attributes.shadeData[0].positions.position1 / 65535)) * 100) | round(0) }}%
        {% endif %}

File truncated for your use, but if you need this file. It’s here /components/sensors/sensor_template.yaml


#9

I didn’t have any issues on 0.86.4, I have since moved to 0.87.0, but I just trigger my PowerView scenes via IFTTT and this seems to work like a charm for me. Make sure your IFTTT key is correct and you are calling the correct webhook event. I linked my Github below, feel free to check that out if you think it will help.


#10

Thanks for the advice - working great now - have it also pulling back the battery information, which is what I wanted more of a view of. So I now know when to purchase another big box of AA batteries


#11

That’s awesome, glad I could help!


#12

Can you share your code on how you got the battery levels to show up?


#13

Hi

Use the following in sensors

  • platform: rest
    resource: !secret powerview
    name: Shade Information
    json_attributes:
    • shadeData
      value_template: “{{ value_json.value }}”
      scan_interval: 20
  • platform: template
    sensors:
    kitchen_shade_bat:
    friendly_name: Kitchen Battery
    icon_template: mdi:battery
    value_template: >
    {{ ((states.sensor.shade_information.attributes.shadeData[0].batteryStrength / 2)) }}%
    lounge1_shade_bat:
    friendly_name: Lounge1 Battery
    icon_template: mdi:battery
    value_template: >
    {{ ((states.sensor.shade_information.attributes.shadeData[1].batteryStrength / 2)) }}%
    lounge2_shade_bat:
    friendly_name: Lounge2 Battery
    icon_template: mdi:battery
    value_template: >
    {{ ((states.sensor.shade_information.attributes.shadeData[2].batteryStrength / 2)) }}%
    lounge3_shade_bat:
    friendly_name: Lounge3 Battery
    icon_template: mdi:battery
    value_template: >
    {{ ((states.sensor.shade_information.attributes.shadeData[3].batteryStrength / 2)) }}%