10. The same call from the SDK
This step uses the Python SDK. Install it:
pip install openapp-sdkOther languages are listed in the SDK overview. Your API key string embeds the API base URL, so connecting usually needs only the key—see SDK authentication.
from openapp_sdk import Client
ENTITY_ID = "paste-your-entity-id-here"API_KEY = "paste-your-full-api-key-here"
def main() -> None: client = Client.connect(api_key=API_KEY) result = client.entities.actions(ENTITY_ID, "switchable.open") print(result)
if __name__ == "__main__": main()Client is the synchronous facade. For asyncio code, use AsyncClient and await the same calls—see Async usage.
client.entities.actions is the usual pattern for one OpenApp call from application code.
Open the door with OpenApp Scripting (client.scripting)
Section titled “Open the door with OpenApp Scripting (client.scripting)”For several operations in one program—or the same action packaged as a .openapp file on disk—use the client.scripting sub-client. The following two styles are equivalent; both call entity_action on the door entity (the same effect as switchable.open above).
Scripting runs as an asynchronous execution: execute submits the program, waits for it to finish, and returns the script’s result — the SDK polls for you.
1. Pass scripting source as a string to execute:
result = client.scripting.execute( script=f'entity_action("{ENTITY_ID}", "switchable.open", #{{}});')print(result)2. Read a .openapp file and pass its contents (the SDK posts them to POST /scripting/executions):
Create open-door.openapp next to your script:
entity_action("paste-your-entity-id-here", "switchable.open", #{});from pathlib import Path
result = client.scripting.execute(script=Path("open-door.openapp").read_text())print(result)OpenApp Scripting in the next step walks through the same open-door program with a bit more context; Scripting reference covers the full language.