If you’re using the rest calls, make sure the device numbers [0], [1], etc. are changed as well. Post your yaml if you’re still having issues.
Here is my configuration.yaml. I noticed that I had the order of the blinds different than what is shown on the app and changed it to what is listed below. That has seemed to stop the both from adjusting when I would change one but I do notice that if I make changes in the app, they are not reflected on my dashboard. Is that expected?
## Input Numbers
input_number:
# Blinds
office_blinds_slider:
name: Office Blinds Slider
min: -100
max: 100
step: 10
master_bedroom_blinds_slider:
name: Master Bedroom Blinds Slider
min: -100
max: 100
step: 10
## Rest Commands
rest_command:
sunsa_office_blinds:
url: !secret api_sunsa_office_blinds
method: PUT
headers:
accept: 'application/json'
payload: '{"Position": {{ position }}}'
content_type: 'application/json'
sunsa_master_bedroom_blinds:
url: !secret api_sunsa_master_bedroom_blinds
method: PUT
headers:
accept: 'application/json'
payload: '{"Position": {{ position }}}'
content_type: 'application/json'
## Sensors
sensor:
- platform: rest
resource: !secret api_sunsa_main
name: api_sunsa_main
json_attributes:
- devices
value_template: "OK"
- platform: template
sensors:
# NOTE - Modify the [0], [1], etc device identifier below for each device, to ensure it's calling the right one. These are listed top to bottom in the Sunsa app. First device is [0], second is [1] and so on.
# Office Blinds
office_blinds_battery_percentage:
friendly_name: 'Office Blinds Battery Percentage'
device_class: battery
value_template: "{{ state_attr('sensor.api_sunsa_main', 'devices')[0]['batteryPercentage'] }}"
unit_of_measurement: '%'
icon_template: mdi:battery-high
office_blinds_position:
friendly_name: 'Office Blinds Position'
value_template: "{{ state_attr('sensor.api_sunsa_main', 'devices')[0]['position'] }}"
unit_of_measurement: '%'
icon_template: mdi:blinds-horizontal
office_blinds_is_connected:
friendly_name: 'Office Blinds Connection Status'
value_template: "{{ state_attr('sensor.api_sunsa_main', 'devices')[0]['isConnected'] }}"
icon_template: mdi:connection
# Master Bedroom Blinds
master_bedroom_blinds_battery_percentage:
friendly_name: 'Master Bedroom Blinds Battery Percentage'
device_class: battery
value_template: "{{ state_attr('sensor.api_sunsa_main', 'devices')[1]['batteryPercentage'] }}"
unit_of_measurement: '%'
icon_template: mdi:battery-high
master_bedroom_blinds_position:
friendly_name: 'Master Bedroom Blinds Position'
value_template: "{{ state_attr('sensor.api_sunsa_main', 'devices')[1]['position'] }}"
unit_of_measurement: '%'
icon_template: mdi:blinds-horizontal
master_bedroom_blinds_is_connected:
friendly_name: 'Master Bedroom Blinds Connection Status'
value_template: "{{ state_attr('sensor.api_sunsa_main', 'devices')[1]['isConnected'] }}"
icon_template: mdi:connection
The automations are what keeps rest in sync with HA, without them, it won’t sync. You need 2 automations, per blind. One to sync rest to the slider, one to sync the slider with rest.
THIS IS AMAZING. Great integration and great walkthrough. I followed it to the letter, and it’s up and running, flawlessly.
What steps have to be taken to convert this to an actual integration (and get this guy some credit for a great product!)?
This was a really helpful guide - thank you to everyone who provided examples and for the work you did you get this working. After many bonehead errors, I got it working.
One note: I found it was better to put the sensors stuff in my sensors.yaml so I didn’t have duplicate keys in my configuration.yaml
I also would like to clean up my configuration.yaml. I tried moving the sensor script to sensors.yaml and everything became fubared. @spacebass, or someone, could you share your sensors.yaml script so I can see where I’ve messed up?
Thank you!!!
YAML works like a hierarchy of labels. Everything on the left without spaces in front of it is considered a to be at the top level and they can’t be repeated or they will cause a conflict. That means all of your sensors need to be under that label and nothing else, even if the different sensors are for different things.
It’s possible to take entire sections out and point them at a different file. However, that file can only have things that would have been under that section. Unfortunately, you can’t just take everything from different sections related to your Sunsa Wands and put them in their own file.
A good example included with HA by default is automations. Your configuration.yaml
file has a line that looks like this:
automation: !include automations.yaml
All of your automations need to go under the automation:
label, but it’s pointing that section to a different file called automations.yaml
. That file doesn’t have the top level automation:
label inside it. Instead it has everything that would have been under it shifted one set of spaces to the left.
Hopefully that helps you figure out where you went wrong.
Are we ever going to get local control over these blinds?
This was so easy and easy to follow - thank you! I’m new to HA - why isn’t sunsa an integration like everything else is?
Ok, I see, if I’m reading everything correct sunsa can’t be an integration because we’re calling an external API. I’m assuming once sunsa can be accessible locally it would be able to integrate without accessing their external API. It’s pretty flawless anyhow.
Has anybody been in contact with sunsa about this?
You can access Sunsa’s Feature Request site to improve the vote count for a local API.
I also received an email (content below) from Sunsa/Indigogo on April 14 that stated Matter support was upcoming. Presumably this would enable local integration with HASS.
We are excited to announce that we will be supporting the new Matter standard! While we don’t have an exact timeline on this, the good news is your Sunsa Wands will work with all supported ecosystems seamlessly, like Google, Amazon, Apple, and way more
I just installed my first set and now have ordered several more thanks to the Sunsa flash sale. Kudos to everyone who helped figure this out, especially to @veinoffeeling whose setup I copied, works very well - thank you!
Sunsa recently confirmed that they will be adding Matter support later this year.
In the meantime, I’m brushing up a custom HA integration that uses their public cloud API.
Will you release it?
You bet. I’ll let you guys know when it’s out within a few days.
Thanks, looking forward to this!
Folks, integration is out. Take a stab at it.
This is really nice work, and greatly appreciated! It’s far better than all that rest command API logic. Your new integration almost makes me forget this is still cloud based.
Now we can control not just open/close, but anywhere in-between. And the temperature value seems to be reasonably accurate (when not in direct sunlight).
I’ve only purchased a single sunsa mini, way back during the early bird Indigogo release. I’ve held off purchasing any more until they get their local control API completed. Good to hear that Matter support that has been promised for a long time is still in the works.
Thanks! The temperature sensor can be wildly inaccurate from wand to wand. In a future firmware update Sunsa will add an offset setting for user calibration. Also, the wands have a light sensor, but has not been activated yet; to be done with later firmware too.
Thank you! This is neat.