Cloud API¶
CloudApi wraps every cloud endpoint used by the app;
CloudClient handles the HTTP session underneath.
See the Cloud API protocol notes for the wire format.
api
¶
Typed wrappers around every cloud endpoint used by the Daisy app.
CloudApi
¶
CloudApi(client: CloudClient)
High-level access to the Teleco cloud endpoints.
register
async
¶
register(
email: str,
password: str,
*,
firstname: str,
lastname: str,
advertising: bool = False,
app: str = "DAISY",
) -> Any
Create an account (account-registration); the e-mail must then be confirmed.
app is the brand app's id (its build flavor in upper case: DAISY,
BIOSSUN, GIBUS...).
node_active
async
¶
node_active(installation: Installation) -> bool
Is the box online for the cloud (tmate20/nodestatus).
pair_installation
async
¶
pair_installation(
inst_code: str,
description: str,
*,
order: int = 0,
active_timer: bool = True,
workdays: str = "",
firmware_version: str = "",
) -> Any
Add a box to the account by its code (account-installation-pair).
unpair_installation
async
¶
unpair_installation(installation: Installation) -> Any
Remove the box from the account (account-installation-unpair).
rename_installation
async
¶
rename_installation(
installation: Installation, description: str
) -> None
rooms
async
¶
rooms(
installation: Installation, *, full: bool = True
) -> list[Room]
Rooms and devices. full also returns each device's commands and timers.
save_room
async
¶
save_room(installation: Installation, room: Room) -> Room
room-setup: re-posts the whole room with all of its devices.
device_commands
async
¶
device_commands(
installation: Installation, id_installation_device: int
) -> list[Command]
command-device-list: the commands of one device.
scenario_commands
async
¶
scenario_commands(
installation: Installation, id_scenario: int
) -> list[Command]
command-scenario-list: the commands of one scenario.
device_status
async
¶
device_status(
installation: Installation, id_installation_device: int
) -> list[StatusItem]
save_scenario
async
¶
save_scenario(
installation: Installation,
*,
description: str,
steps: list[ScenarioStep],
id_installation_scenario: int = 0,
icon: int = 0,
order: int = 0,
id_installation_room: int = 0,
) -> Scenario
Create (id 0) or update a scenario.
save_timers
async
¶
save_timers(
installation: Installation,
id_installation_device: int,
timers: list[Timer],
) -> list[Timer]
Replace the device's full timer list (a timer left out is deleted).
feed_commands
async
¶
feed_commands(
installation: Installation,
commands: list[WireCommand],
*,
scenario_id: int = 0,
is_scenario: bool | None = None,
) -> TmateResponse
send_and_wait
async
¶
send_and_wait(
installation: Installation,
commands: list[WireCommand],
*,
scenario_id: int = 0,
is_scenario: bool | None = None,
ack_timeout: float = 15.0,
until: tuple[str, ...] = (ACK_PROCESSED, ACK_ACCEPTED),
) -> TmateResponse
Send commands and poll getackcommand until the box confirms.
Device screens stop on PROC; timer/schedule flows wait for ACK.
client
¶
Low-level HTTP client for the Teleco "tmate" cloud.
Every endpoint is a JSON POST protected by a static basic auth. The user session
(idSession + idAccount) travels inside the JSON body. Two response formats
exist:
- the standard envelope
{codEsito, msgEsito, valRisultato}; - the
tmate20/*format{MessageType, MessageID, MessageText, ActionReference}(nodestatusreturns a bare object).
SessionFields
¶
CloudSession
dataclass
¶
TmateResponse
dataclass
¶
TmateResponse(
message_type: str | None,
message_id: str | None,
message_text: str | None,
action_reference: str | None,
)
Response of feedthecommands / getackcommand.
CloudClient
¶
CloudClient(
http: ClientSession,
email: str,
password: str,
*,
base_url: str = BASE_URL,
device_serial: str = DEFAULT_DEVICE_SERIAL,
device_description: str = DEFAULT_DEVICE_DESCRIPTION,
request_timeout: float = 15.0,
auto_relogin: bool = True,
)
Authenticated access to the Teleco cloud.
The aiohttp.ClientSession is injected (Home Assistant provides its own) and
is never closed by this class.
call
async
¶
POST to a standard-envelope endpoint and return valRisultato.
Session fields are injected; an invalid session triggers one re-login.
call_raw
async
¶
call_raw(
endpoint: Endpoint | str,
body: JsonDict,
*,
fields: SessionFields = ACCOUNT,
) -> JsonDict
POST and return the raw JSON object, handling session expiry.
call_tmate
async
¶
call_tmate(
endpoint: Endpoint | str, body: JsonDict
) -> TmateResponse
POST to a tmate20/* command endpoint.