home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
74.2k stars 31.16k forks source link

Soma Connect - Soma Tilt: Report 100% (Closed Up) as Closed instead of Open #94532

Closed austwhite closed 1 year ago

austwhite commented 1 year ago

The problem

This is an ongoing issue since the change a few versions back that meant tilt blinds have 50% as full open with 100% closed up and 0% closed down.
I recently got a couple of Switchbot Tilt Motors and found that integration read 100% (closed up) as closed,
I am wondering if the same logic can be applied to the Soma Blind Tilt motors controlled under the SOMA integration.

What version of Home Assistant Core has the issue?

2023.6.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

SOMA Connect

Link to integration documentation on our website

https://www.home-assistant.io/integrations/soma/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @ratsept, @sebfortier2288, mind taking a look at this issue as it has been labeled with an integration (soma) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `soma` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign soma` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


soma documentation soma source (message by IssueLinks)

ratsept commented 1 year ago

Hi @austwhite,

This would not be difficult to change but then how would be allow control in both directions? I don't have Switchbot Tilt yet so I don't know how they do that. Can the Switchbot devices also be closed in both directions from HA?

austwhite commented 1 year ago

The same way they do with the Switchbot Integration I guess. 100% up on Switchbott Tilt equals closed, 0% also equals closed. I am not sure how the programmers worked it, but it makes more sense than fully closed up, 100% still reporting the blind as open. I think what they did was just make it so the blind reports closed at 100% and at 0%. The two directions of movement still work properly.
I am not sure how they achieved, as I am not a programmer myself. I just thought this might be a nice feature so the integration worked the same as the switchbot tilt does.
Sorry I am not more help with this. I know you are busy, but maybe the guys who did the switchbot integration might have some ideas?

ratsept commented 1 year ago

I'm not sure I understand what you are saying here. I'm sorry, English is not my first language so maybe I'm just missing something.

If 100% and 0% on the Switchbot both equal closed then it works the same way as SOMA, doesn't it? that would make 50% "open" on both.

Like I said I don't have a Switchbot so maybe I'm just misunderstanding the problem. Can you post screenshots here of what you mean. I just checked the latest version of HA and the shades UI has changed a bit so maybe it's something new that I just haven't implemented yet.

austwhite commented 1 year ago

Yes Switchbot and Soma work the same way with one big difference.

SOMA Connect - 100% still reports status of blind as OPEN in Home Assistant. Switchbot Tilt - 100% reports as status CLOSED in Home Assistant.

So if you do an automation where you use the state of the blind as CLOSED. Switchbot works whether closed up or down. SOMA will only report the blind state as CLOSED when it is at 0% - which is fully closed down. When fully closed up, 100%, the state of the blind is reported as OPEN

Does that make sense? Sorry, I am sometimes bad at explaining

ratsept commented 1 year ago

Thank you, that clears it up for me. I didn't even know HA had OPEN/CLOSED states. I don't think the SOMA integration touches these at all at the moment. I will look at how Switchbot did that and implement that for SOMA as well. It may take a few weeks until I get some time to work on this though.

austwhite commented 1 year ago

soma100% closed up switchbot

The Balcony Blind is a Switchbot Tilt. The other is a Soma Tilt 2

Both are 100% closed up

austwhite commented 1 year ago

@ratsept No rush on the fix, I have a work around using below and above positions for now in automations. It's just a bit hacky and wanted to have something more uniform and easier to use if that makes sesne :)

Thanks for the quick reponses to this

austwhite commented 1 year ago

@ratsept
Just bumping this to keep it alive so the bot doesn't close it :)

austwhite commented 1 year ago

hi @ratsept
Any update on this?

austwhite commented 1 year ago

@ratsept
Hope all is well. Just bumping this again to keep it alive.
It has been a long time

ratsept commented 1 year ago

I'm looking at the switchbot tilt code and it seems that all they do is set the self._attr_is_closed variable to true whenever the position is 20% from either end position (so from 0% -> 20% = closed and from 80% -> 100% = closed). I think the same can be done for the SOMA integration. Is that the functionality you are looking for? I'm really not sure how HA handles that variable internally but that was all I could see at a quick glance.

austwhite commented 1 year ago

@ratsept If it gives the same result of reporting closed when it is closed regardless of closed up or down, then that would be fine

ratsept commented 1 year ago

I will try to look into this as soon as possible. Apparently it is now possible to make these small fixes completely in GitHub Codespaces with no need to install a local dev environment.

austwhite commented 1 year ago

thanks @ratsept Really appreciate your help