siriosdev / switchbot-api-script-caller Goto Github PK
View Code? Open in Web Editor NEWThis (Py)Script allows you to control all (WIP) your SwitchBot devices via API calls (1.1)
License: GNU General Public License v3.0
This (Py)Script allows you to control all (WIP) your SwitchBot devices via API calls (1.1)
License: GNU General Public License v3.0
Hi i cant get HA to get the "switch.switchbot_remote_<device_name>"
This is how i installed this.
I could not find this in HACS and custom repistories did not work so i downloaded the zip from here and put the "SwitchBot-API-Script-Caller" folder in Homeassistant map "config"
I think im doing wrong at this step:
# use `mkdir -p /config/pyscript/apps/` if the directory doesn't exist
cd /config/pyscript/apps/
# Create a symbolic link to the apps directory named switchbot
ln -s /config/SwitchBot-API-Script-Caller/pyscript/apps/switchbot.py switchbot.py
How do i do that in docker-compose.yaml? i have a synology nas. this is my dockercompose fpr homeassistant;
homeassistant:
container_name: home-assistant
image: homeassistant/home-assistant:latest
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/TZ:/etc/timezone:ro
- /run/dbus:/run/dbus:ro
- /volume3/docker/homeassistant:/config
- /volume3/docker/homeassistant/SwitchBot-API-Script-Caller/pyscript/apps/:/config/pyscript/apps/
environment:
- TZ=Europe/Stockholm
Please help teally want to use my ir devices in homeassistant ! :)
Re 'developing' branch: I made a mistake forgetting to rename the gen_icon(non_ir) function gen_non_ir_icon(non_ir) or similar. It clashes with the gen_icon(dev) function. Alternatively, you could combine gen_icon(dev) and gen_icon(non_ir) and pass in the type key as an argument. Do you want me to fix it and do another pull request?
Add service supporting all commands for a deviceType Light
.
Note: I will create a branch and work on that issue.
Hi,
looks like there is a typo in your switchbot.py.
Currently the custom commands are not woring with your integration.
You need to change following from custom to customize:
Or you could also change your predefined options for the Switchbot Generic Command from
customize to custom.
And also thank you very much for the integration, helped me alot! ๐ :)
Br Adrian
Re developing branch: I made errors in the switchbot_curtain_command. Do you want me to fix it and do another pull request? It should be as follows:
@service
def switchbot_curtain_command(device=None, command=None, parameter=None):
"""yaml
name: SwitchBot Curtain Command
description: Control Switchbot curtain.
fields:
device:
name: Device
description: the name of the device as in the SwitchBot app
example: cover.switchbot_remote_bedroom_curtains
default:
required: true
selector:
entity:
domain: cover
command:
name: Command
description: the name of the command
example: turnOff
default:
required: true
selector:
select:
options:
- turnOn
- turnOff
- setPosition
mode: list
parameter:
name: Parameters
description: the setPosition command requires a position parameter
example:
default:
required: false
selector:
number:
min: 0
max: 100
step: 1
mode: box
"""
deviceId = extract_device_id(device)
headers_dict = auth(**pyscript.app_config)
if parameter != None:
parameter_string = "0,ff," + str(parameter)
command_execute(headers_dict, deviceId, command, parameter=parameter_string)
else:
command_execute(headers_dict, deviceId, command, parameter=parameter)
Hey, I've just configured this caller and have pyscript setup. When I try to call refresh_devices I see the below error.
I'm pretty sure I've got the !include
to pull in the config correctly so am not entirely sure what I'm missing.
Do you have any ideas?
2023-02-03 19:11:52.204 ERROR (MainThread) [custom_components.pyscript.file.switchbot.switchbot_refresh_devices] Exception in <file.switchbot.switchbot_refresh_devices> line 106:
headers_dict=auth(**pyscript.app_config)
^
NameError: name 'pyscript.app_config' is not defined
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.