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
73.55k stars 30.72k forks source link

Some Issue with Switchbot cloud entities #103674

Closed SiriosDev closed 5 months ago

SiriosDev commented 1 year ago

The problem

the climate entity of SwitchBot cloud suffer from some problems:

  1. Power on/off in separate entity
  2. Some climate devices have a different parameter (0 instead of 1) of turning on automatic/heat-cool mode

sources here

resolution:

  1. use the off parameter of setall to turn off or alternatively directly integrate the turn off/on function
  2. not sure, but maybe a toggle button might be a good idea (when off use parameter 1 to turn heatcool mode on, when on use parameter 0 to turn heatcool mode on)

Also, in the past I tentatively developed a (extremely basic) python script to manage some devices, I tried to write some PR for this integration but unfortunatelly I don't have time to study the docs so I'll leave you the link here (main branch is stable but developing branch is newest), if you can use it take whatever you need

of course I know you use python module and I use api directly, however for the logic part it changes little, take it if you need it

What version of Home Assistant Core has the issue?

core-2023.11.1

What was the last working version of Home Assistant Core?

none

What type of installation are you running?

Home Assistant OS

Integration causing the issue

SwitchBot Cloud

Link to integration documentation on our website

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

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 @seraphicrav, mind taking a look at this issue as it has been labeled with an integration (switchbot_cloud) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `switchbot_cloud` 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 switchbot_cloud` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


switchbot_cloud documentation switchbot_cloud source (message by IssueLinks)

SeraphicRav commented 1 year ago

@SiriosDev I see, thank you for the suggestion.

For the on/off feature, I think I need to find a way to synchronize the state of the switch entity and the climate one so that both can turn off or on/start a chosen mode.

I see, for the mode 0/1, I will see if I can find a way to synchronize entities or I will see what happens if I add an alternative auto mode.

SiriosDev commented 1 year ago

nice!

For the on/off feature...

just out of curiosity, once added the off mode why keep the on/off using switch entities instead of just using the climate entity?

I see, for the mode 0/1...

from my (rudimentary) tests an auto mode alternative, breaks compatible cards with climate entities, the best way is to let the end user choose which auto mode to run based on how it works. At least until the switchbot developers fix this problem, (small note: in fact on the switchbot api repo there are lots of feature-related PRs, but they are all ignored). in my ideas the best thing is a toggle button, however, I admit I do not know if it is practicable.

SeraphicRav commented 12 months ago

Fir back compatibility reasons and it feels easier to just be able to turn on/off the AC instead of always having to choose a mode.

Yeah, I noticed that SwitchBot is ignoring most the issues they are receiving, it is a bit sad for the users (I also posted some issues and only got a GitHub action closing them automatically.

I will investigate how to deal with the auto issue, I don't know when I will be to complete though.

SiriosDev commented 10 months ago

Now that I have free time, I was thinking about the issue of Alternative Auto mode and I came to the conclusion that it might make sense to create a custom entry in the modes called like, Alternative Auto, a bit anti-aesthetic but functional.

I would have gladly done a fork and pr but I didn't quite understand how to test, so I suggest solutions 😅

SeraphicRav commented 10 months ago

@SiriosDev Can you explain to me what you did not understand how to test ? Maybe I can help you :)

I tried adding an alternative mode but it does not seem to work. The icon is missing and when clicking on it, it says that the alternative value is not expected. :( Seems we need to go the hard way with the shared state but did not have the time to investigate yet.

image

SiriosDev commented 10 months ago

Can you explain to me what you did not understand how to test? Maybe I can help you :)

I've had a chance to look at the documentation and I think I can get the code put in, but I haven't figured out how to test the code I write before making a pr

I tried adding an alternative mode but it does not seem to work. The icon is missing and when clicking on it, it says that the alternative value is not expected. :( Seems we need to go the hard way with the shared state but did not have the time to investigate yet.

Oh F😑 what unfortune! I had seen a similar solution from here, I will think of something else🤔

SeraphicRav commented 10 months ago

I've had a chance to look at the documentation and I think I can get the code put in, but I haven't figured out how to test the code I write before making a pr Oh, for that, I went the VS Code Dev container way, I am following this: https://developers.home-assistant.io/docs/development_environment/

Then you can run a Home Assistant on your computer. There are tasks to run unit tests and linters too.

srescio commented 8 months ago

in my case it only discovered one tv remote, for which shows only power button, curtain devices and button bot are both missing

SeraphicRav commented 8 months ago

in my case it only discovered one tv remote, for which shows only power button, curtain devices and button bot are both missing

Yes, it is following what is said in the documentation about the supported devices.

srescio commented 8 months ago

On one hand it makes sense so not a bug per se, on the other these device types have been around for quite some time, is there any plan to add support for these?

SeraphicRav commented 8 months ago

On one hand it makes sense so not a bug per se, on the other these device types have been around for quite some time, is there any plan to add support for these?

If someone is willing to implement them, it will be added. I am personally working on the remote types but I lack time to make some progress.

All I can do is to redirect you to the switchbot_bluetooth version for Bluetooth compatible devices (like the curtains and the bot).

With the cloud version, there is a technical issue with the restriction of API calls that make sensors difficult to use (more not practical to use).

issue-triage-workflows[bot] commented 5 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.