API Reference

Client to the DIO Chacon wifi API. It is mainly a proxy to the chacon's cloud server. It manages authentication, the protocol through the websocket connection and server side callback events.

__init__(login_email, password, service_name='python_generic', callback_device_state=None)

Initialize the client API. Actually do nothing but storing informations. The effective authentication and connection are lazyly achieved.

Parameters:
  • login_email (str) –

    string containing your email in DIO app

  • password (str) –

    string containing your password in DIO app

  • service_name (str, default: 'python_generic' ) –

    arbitrary string identifying this client

  • callback_device_state (callable, default: None ) –

    the callback method that will be called for server side events

disconnect() async

Disconnects for the cloud server and properly closes the connection. It must be called at the of API usage or before python program ending.

get_status_details(ids, notifyCallback=False, device_infos=None) async

Retrieves the status detailed of devices ids given.

Parameters:
  • ids (list) –

    the device ids to search details for.

  • notifyCallback (bool, default: False ) –

    True to notify the callback function par device.

  • device_infos (dict, default: None ) –

    the devices infos (name and model) for requested ids. Used only to produce a log.

Returns:
  • dict

    A list of tuples composed of id, connected ; openlevel and movement for shutter, is_on for switch.

get_user_id() async

Search for the user technical id based on its authentification elements.

Returns:
  • str

    A string for the unique user id from the server.

move_shutter_direction(shutter_id, direction) async

Moves the given shutter in the given direction.

Parameters:
  • shutter_id (str) –

    the device id defining the chosen shutter.

  • direction (ShutterMoveEnum) –

    up, down or stop movement.

move_shutter_percentage(shutter_id, openlevel) async

Moves the given shutter at a given position.

Parameters:
  • shutter_id (str) –

    the device id defining the chosen shutter.

  • openlevel (int) –

    the open level percentage between 0 and 100.

search_all_devices(device_type_to_search=None, with_state=False) async

Search all the known devices with their states : positions for shutters and on/off for switches

Parameters:
  • device_type_to_search (list[DeviceTypeEnum], default: None ) –

    the device type to search for. None means to return all type (SHUTTERS and SWITCHES)

  • with_state (bool, default: False ) –

    True to return the detailed states like shutter position and switches on or off.

Returns:
  • dict

    A list of tuples composed of id, name, type, openlevel and movement for shutter, is_on for switches.

set_callback_device_state(callback_device_state)

Register after the constructor the global callback method that will be called for server side events

set_callback_device_state_by_device(target_id, callback_device_state)

Register the per device callback method that will be called for server side events

switch_switch(switch_id, set_on) async

Switches on or off the given switch.

Parameters:
  • switch_id (str) –

    the device id defining the chosen switch.

  • set_on (bool) –

    on or off as desired state.