Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Dirty solution to have both fast and slow speed available for Switchbot Curtain 3

Notifications You must be signed in to change notification settings

Brephlas/dirty-slow-curtain3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

Archive notice

There is a better solution as a custom component available, use this instead:

https://github.com/v6ak/v6-quietdrift or https://github.com/Brephlas/quietdrift


dirty-slow-curtain3

Dirty solution to have both fast and slow speed available for Switchbot Curtain 3

This solution requires you to replace /homeassistant/deps/lib/python3.12/site-packages/switchbot/devices/curtain.py with the modified file. If you need the original one back, you can get it from the original repository.

I used the file /config/custom_components/.slow as a binary identification between the modes. You can modify the path in the file curtain.py by changing the global variable FILE_SPEED_IDENTIFIER.

This is a pretty dirty and hacky solution but it is working fine for me and since I am not into integration development I was not able to develop a better solution quickly.

Steps to apply this to your installation

  1. Replace the curtain.py file inside the docker container: docker cp /homeassistant/curtain.py homeassistant:/usr/local/lib/python3.12/site-packages/switchbot/devices/curtain.py

    Alternatively, you can add the pyswitchbot-repo using Custom deps deployment and replace the curtain.py file there. The path is:

    • before HA 2024.2: /homeassistant/deps/lib/python3.11/site-packages/switchbot/devices/curtain.py
    • after HA 2024.2: /homeassistant/deps/lib/python3.12/site-packages/switchbot/devices/curtain.py

    If it was installed with python3.11 you can just rename the folder to python3.12

  2. Adjust configuration.yaml and add the directory where the identifier .slow file should be saved to the allowlist_external_dirs

    allowlist_external_dirs:
        - "/config/custom_components"
    
  3. Create directory /config/custom_components and file .slow inside

  4. Write 0 or 1 into the file

  5. Add shell_command to enable or disable slow mode for the curtains

    switchbot_curtain_enable_slow: 'echo "1" > /config/custom_components/.slow'
    switchbot_curtain_disable_slow: 'echo "0" > /config/custom_components/.slow'
    
  6. Reboot Home Assistant

  7. Have fun and use it by calling either one of the services before calling the cover-services:

    shell_command.switchbot_curtain_enable_slow
    shell_command.switchbot_curtain_disable_slow
    

What does this modification do?

Basically, this modification only checks if 0 or 1 is in the file .slow and use this as binary identification to either go slow or fast. The following excerpt shows the file read:

with open(FILE_SPEED_IDENTIFIER, "r") as fr:
    r = int(fr.read().strip())
    if r == 1:
        self.slow = 1
    else:
        self.slow = 255

If you for example call the cover.open_cover service, the speed will be set before sending the command to the switchbot:

speed = self.readState()

Credits

About

Dirty solution to have both fast and slow speed available for Switchbot Curtain 3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages