Calaos home automation client library
Project description
Python Calaos
Client for the Calaos v3 home automation server. This client keeps the home, rooms and items status in cache, in order to reduce the quantity of requests towards the Calaos server.
Use pycalaos.discover to discover the Calaos server IP address.
Use pycalaos.Client to connect to the Calaos server.
This library has been developed with Home Assistant in mind.
Notice
This integration is an independent project: the Calaos team is by no means involved in its development.
discover
The pycalaos.discover function broadcasts a discovery message on the network
and returns the IP address of a discovered Calaos instance, or raises
pycalaos.NoDiscoveryError.
Client
pycalaos.Client is a client that connects to a Calaos server.
Initialize it with:
from pycalaos import Client
client = Client(url, username, password)
When initializing the client, it automatically fetches the Calaos configuration
(rooms and items). In order to reload the configuration,
use client.reload_home().
The client has the following methods and properties:
reload_home(): reload the whole configuration (rooms and items)client.update_all(): checks and updates state for all known items, and returnspycalaos.item.Eventobjects for each change.client.poll()requests changes since the previous poll:- if there is no previous execution of the
pollfunction, it registers for polling and acts asupdate_all - if there is a previous execution of the
pollfunction, it requests only changes for this registration (see the Calaos developer doc for more information) and returnspycalaos.item.Eventobjects for each change since the previous poll
- if there is no previous execution of the
client.rooms: rooms as a list ofpycalaos.client.Roomclient.items: items as dictionary of item ID topycalaos.item.Itemclient.item_types: complete list of item types currently in useclient.items_by_type(type: type): returns all items of that type (see types in the 2nd columns of the mapping table)
Room
Calaos rooms are represented in pycalaos as pycalaos.client.Room objects.
Rooms have the following properties:
name: name of the roomtype: type from Calaositems: items in that room, as a list ofpycalaos.item.common.Itemobjects
Item
All Calaos IOs are represented in pycalaos as pycalaos.item.common.Item
objects, or objects that inherit from this one.
Items have the following properties:
info: item description (id, name, type) as a stringid: ID from Calaosgui_type: "gui_type" from Calaosio_type: "io_type" from Calaosname: name from Calaosstate: current item state (see the mapping section below)type: type from Calaosvar_type: "var_type" from Calaosvisible: "visible" according to Calaosroom: thepycalaos.Roomobject this item belongs to
Items also have the following functions for internal use (they should not be called directly):
internal_set_stateinternal_from_event
Event
Each state change results in a pycalaos.item.common.Event object, when calling
client.update_all() or client.poll().
Events have the following properties:
item: item the event is related to, as apycalaos.item.common.Itemobjectstate: state for this event
Calaos IOs vs pycalaos items mapping
Mapping from Calaos IOs to pycalaos items is based on the Calaos type:
| Calaos type | pycalaos object type |
|---|---|
| Generic | |
| InPlageHoraire | io.InPlageHoraire |
| InputTime | io.InputTime |
| InputTimer | io.InputTimer |
| InternalBool | io.InternalBool |
| InternalInt | io.InternalInt |
| InternalString | io.InternalString |
| Scenario | io.Scenario |
| Wago | |
| WIDigitalBP | io.InputSwitch |
| WIDigitalLong | io.InputSwitchLongPress |
| WIDigitalTriple | io.InputSwitchTriple |
| WODali | io.OutputLightDimmer |
| WODigital | io.OutputLight |
| WOVoletSmart | io.OutputShutterSmart |
| Web | |
| WebInputAnalog | io.InputAnalog |
| WebInputString | io.InputString |
| WebInputTemp | io.InputTemp |
| Fallback | |
| Any other type | common.Item |
common.Item
- state: string
- methods: none
io.InPlageHoraire
- state: boolean:
TrueorFalse - methods: none
io.InputAnalog
- state: float
- methods: none
io.InputString
- state: string
- methods: none
io.InputSwitch
- state: boolean:
TrueorFalse - methods: none
io.InputSwitchLongPress
- state:
pycalaos.item.io.InputSwitchLongPressState:NONE,SHORT,LONG - methods: none
io.InputSwitchTriple
- state:
pycalaos.item.io.InputSwitchTripleState:NONE,SINGLE,DOUBLE,TRIPLE - methods: none
io.InputTemp
- state: float
- methods: none
io.InputTime
- state: boolean:
TrueorFalse - methods: none
io.InputTimer
- state: boolean:
TrueorFalse - methods:
start(): Start the timerstop(): Stop the timerreset(hours, minutes, seconds, milliseconds): Reset the configured time to a value
io.InternalBool
- state: boolean:
TrueorFalse - methods:
true(): Set a value to truefalse(): Set a value to falsetoggle(): Invert boolean valueimpulse(*pattern): Do an impulse on boolean value with a pattern. Arguments may be durations (in ms) or "old" to reset to the previous state after the impulse
io.InternalInt
- state: integer
- methods:
set(value): Set a specific integer valueinc(): Increment value with configured stepdec(): Decrement value with configured stepinc(value): Increment value by valuedec(value): Decrement value by value
io.InternalString
- state: string
- methods:
set(value): Set a specific string value
io.OutputLight
- state: boolean:
TrueorFalse - methods:
true(): Switch the light onfalse(): Switch the light offtoggle(): Invert light stateimpulse(*pattern): Do an impulse on light state with a pattern. Arguments may be durations (in ms) or "old" to reset to the previous state after the impulse
io.OutputLightDimmer
- state: integer between 0 and 100
- methods:
true(): Switch the light onfalse(): Switch the light offtoggle(): Invert light stateimpulse(*pattern): Do an impulse on light state with a pattern. Arguments may be durations (in ms) or "old" to reset to the previous state after the impulseset_off(value): Set light value without switching on. This will be the light intensity for the next ONset(value): Set light intensity and swith on if light is offup(value): Increase intensity by X percentdown(value): Decrease intensity by X percenthold_press(): Dynamically change light intensity when holding a switch (press action)hold_stop(): Dynamically change light intensity when holding a switch (stop action)
io.OutputShutterSmart
- state: dictionary, with two elements:
action:pycalaos.item.io.OutputShutterAction:STATIONARY,UP,DOWN,STOP,CALIBRATIONposition: integer between 0 and 100
- methods:
up(): Open the shutterdown(): Close the shutterstop(): Stop the shuttertoggle(): Invert shutter stateimpulse_up(duration): Open shutter for X msimpulse_down(duration): Close shutter for X msset(value): Set shutter at position X in percentup(value): Open the shutter by X percentdown(value): Close the shutter by X percentcalibrate(): Start calibration on shutter. This opens fully the shutter and resets all internal position values. Use this if shutter sync is lost.
io.Scenario
- state: boolean:
TrueorFalse - methods:
true(): Start the scenariofalse(): Stop the scenario (only for special looping scenarios)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pycalaos-0.0.29.tar.gz.
File metadata
- Download URL: pycalaos-0.0.29.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2efa602dfce8950f232bff6748fd38b58944368aa99ce0e0e068e3988070f72
|
|
| MD5 |
6a356ddf63f5e43a528b7c3886196639
|
|
| BLAKE2b-256 |
3aa26dfa9c614a7542cf5a3463013a4b1d1623a45ebd128045a0ef9b43ffa856
|
File details
Details for the file pycalaos-0.0.29-py3-none-any.whl.
File metadata
- Download URL: pycalaos-0.0.29-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7433a8d10762679a553a1006f7f3367525139de3e7cd673e97d7e99356c4c180
|
|
| MD5 |
d86cd6546aea6eee205796883f44a439
|
|
| BLAKE2b-256 |
5c4c90a7a00826dff9e70a5822a5ee3290cb9e4fb0a5805e15afb24cb38c1aa4
|