Protocole pour webservice Calaos

La centrale propose une protocole de communication grâce à des requêtes HTTP. Les données échangés sont au format JSON.

Le Calaos Network propose également ce type de service, en particulier pour les applications clientes et l'authentification des utilisateurs.

Détails des requêtes

Les requêtes se font en HTTPS soit sur la centrale directement, soit sur le Calaos Network. Les requêtes sur le Calaos Network se font grâce à l'url suivante:

https://www.calaos.fr/calaos_network/api.php

Les requêtes sur la centrale se font grâce à l'url suivante:

https://ip_centrale/api.php

API Calaos Network

get_ip

Cette commande permet le login et la récupération de l'adresse IP de la centrale.

Exemple

Données JSON à envoyer:

{
"cn_user": "mail@example.com",
"cn_pass": "the_password",
"action": "get_home"
}

Réponse:

{
"home": [
{
"type": "salon",
"hits": "0",
"name": "Salon",
"items": {
"inputs": [
{
"visible": "false",
"var_type": "bool",
"id": "input_0",
"hits": "0",
"name": "Interrupteur",
"type": "WIDigitalBP",
"state": "false"
},
{
"visible": "",
"var_type": "string",
"id": "input_1",
"hits": "0",
"name": "Caméra 1",
"type": "CamInput",
"state": ""
},
{
"visible": "",
"var_type": "string",
"id": "input_2",
"hits": "0",
"name": "lecteur pull-house",
"type": "AudioInput",
"state": ""
}
],
"outputs": [
{
"id": "output_0",
"hits": "0",
"name": "Lumière",
"gtype": "light",
"state": "false",
"type": "WODigital",
"visible": "true",
"var_type": "bool"
},
{
"id": "output_1",
"hits": "0",
"name": "Volet",
"state": "stop -2.14748e 09",
"type": "WOVoletSmart",
"visible": "true",
"var_type": "string"
},
{
"id": "output_2",
"hits": "0",
"name": "Caméra 1",
"state": "",
"type": "CamOutput",
"visible": "",
"var_type": "string"
},
{
"id": "output_3",
"hits": "0",
"name": "lecteur pull-house",
"state": "",
"type": "AudioOutput",
"visible": "",
"var_type": "string"
}
]
}
}
],
"cameras": [
{
"url_lowres": "https://127.0.0.1/camera.php?camera_id=0&width=300&height=225",
"name": "Caméra 1",
"ptz": "false",
"url_highres": "https://127.0.0.1/camera.php?camera_id=0&width=640&height=480"
}
],
"audio": [
{
"player_id": 0,
"volume": "0",
"time_elapsed": "0",
"cover_url": "https://127.0.0.1/music.php?player_id=0",
"current_track": {
"title": "?",
"duration": "0",
"artist": "?",
"album": "?",
"coverart": "1"
},
"status": "error",
"name": "lecteur pull-house",
"playlist": "true",
"database": "true"
}
]
}