Developer Interface

This part of the documentation covers all the interfaces of libpurecool.

Classes

Common

DysonAccount

class libpurecool.dyson.DysonAccount(email, password, country)[source]

Dyson account.

devices()[source]

Return all devices linked to the account.

logged

Return True if user is logged, else False.

login()[source]

Login to dyson web services.

NetworkDevice

class libpurecool.dyson_device.NetworkDevice(name, address, port)[source]

Network device.

address

Device address.

name

Device name.

port

Device port.

Fan/Purifier devices

DysonPureCool

class libpurecool.dyson_pure_cool.DysonPureCool(json_body)[source]

Dyson pure cool device.

class DysonDeviceListener(serial, add_device_function)

Message listener.

add_service(zeroconf, device_type, name)

Add device.

Parameters:
  • zeroconf – MSDNS object
  • device_type – Service type
  • name – Device name
remove_service(zeroconf, device_type, name)

Remove listener.

active

Active status.

add_message_listener(callback_message)

Add message listener.

auto_connect(timeout=5, retry=15)

Try to connect to device using mDNS.

Parameters:
  • timeout – Timeout
  • retry – Max retry
Returns:

True if connected, else False

auto_update

Auto update configuration.

callback_message

Return callback functions when message are received.

clear_message_listener()

Clear all message listener.

command_topic

MQTT command topic.

connect(device_ip, device_port=1883)

Connect to the device using ip address.

Parameters:
  • device_ip – Device IP address
  • device_port – Device Port (default: 1883)
Returns:

True if connected, else False

connected

Device connected.

connection_callback(connected)

Set function called when device is connected.

credentials

Device encrypted credentials.

device_available

Return True if device is fully available, else false.

disable_auto_mode()[source]

Disable auto mode.

disable_frontal_direction()[source]

Disable frontal direction.

disable_night_mode()[source]

Disable night mode.

disable_oscillation()[source]

Disable oscillation.

disable_sleep_timer()[source]

Disable the sleep timer.

disconnect()

Disconnect from the device.

enable_auto_mode()[source]

Enable auto mode.

enable_frontal_direction()[source]

Enable frontal direction.

enable_night_mode()[source]

Enable night mode.

enable_oscillation(oscillation_angle_low=None, oscillation_angle_high=None)[source]

Enable oscillation.

Both angle arguments represent degrees. They must be ints between 5 and 355. The high angle must either be equal or 30 bigger than the low one. If any of the arguments are empty it will use the previously set values.

Parameters:
  • oscillation_angle_low – int between 5 and 355. High angle of oscillation. Can be empty
  • oscillation_angle_high – int between 5 and 355. Low angle of oscillation. Can be empty
enable_sleep_timer(duration)[source]

Enable the sleep timer.

Parameters:duration – int between 1 and 540 representing minutes
environmental_state

Environmental Device state.

name

Device name.

network_device

Network device.

new_version_available

Return if new version available.

static on_connect(client, userdata, flags, return_code)

Set function callback when connected.

static on_message(client, userdata, msg)

Set function Callback when message received.

product_type

Product type.

remove_message_listener(callback_message)

Remove a message listener.

request_current_state()

Request new state message.

request_environmental_state()

Request new state message.

sensor_data_available()

Call when first sensor data are available. Internal method.

serial

Device serial.

set_configuration(**kwargs)

Configure fan.

Parameters:kwargs – Parameters
set_fan_configuration(data)

Configure Fan.

Parameters:data – Data to send
set_fan_speed(fan_speed)[source]

Set the fan speed.

Parameters:fan_speed – FanSpeed to set (const.FanSpeed)
state

Device state.

state_data_available()

Call when first state data are available. Internal method.

status_topic

MQTT status topic.

turn_off()[source]

Turn on the fan.

turn_on()[source]

Turn off the fan.

version

Device version.

DysonPureCoolState

class libpurecool.dyson_pure_state.DysonPureCoolState(payload)[source]

Dyson device state.

fan_mode

Fan mode.

fan_state

Fan state.

filter_life

Filter life.

static is_state_message(payload)[source]

Return true if this message is a Dyson Pure state message.

night_mode

Night mode.

oscillation

Oscillation mode.

quality_target

Air quality target.

speed

Fan speed.

standby_monitoring

Monitor when inactive (standby).

DysonEnvironmentalSensorState

class libpurecool.dyson_pure_state.DysonEnvironmentalSensorState(payload)[source]

Environmental sensor state.

dust

Dust level.

humidity

Humidity in percent.

static is_environmental_state_message(payload)[source]

Return true if this message is a state message.

sleep_timer

Sleep timer.

temperature

Temperature in Kelvin.

volatil_organic_compounds

Volatil organic compounds level.

DysonPureHotCoolState

class libpurecool.dyson_pure_state.DysonPureHotCoolState(payload)[source]

Dyson device state.

fan_mode

Fan mode.

fan_state

Fan state.

filter_life

Filter life.

focus_mode

Focus the fan on one stream or spread.

heat_mode

Heat mode on or off.

heat_state

Return heat state.

heat_target

Heat target of the temperature.

static is_state_message(payload)

Return true if this message is a Dyson Pure state message.

night_mode

Night mode.

oscillation

Oscillation mode.

quality_target

Air quality target.

speed

Fan speed.

standby_monitoring

Monitor when inactive (standby).

tilt

Return tilt status.

Eye 360 robot vacuum device

Dyson360Eye

class libpurecool.dyson_360_eye.Dyson360Eye(json_body)[source]

Dyson 360 Eye device.

abort()[source]

Abort cleaning.

active

Active status.

add_message_listener(callback_message)

Add message listener.

auto_update

Auto update configuration.

static call_callback_functions(functions, message)[source]

Call callback functions.

callback_message

Return callback functions when message are received.

clear_message_listener()

Clear all message listener.

command_topic

MQTT command topic.

connect(device_ip, device_port=1883)[source]

Try to connect to device.

Parameters:
  • device_ip – Device IP address
  • device_port – Device Port (default: 1883)
Returns:

True if connected, else False

connection_callback(connected)

Set function called when device is connected.

credentials

Device encrypted credentials.

device_available

Return True if device is fully available, else false.

name

Device name.

network_device

Network device.

new_version_available

Return if new version available.

static on_connect(client, userdata, flags, return_code)

Set function callback when connected.

static on_message(client, userdata, msg)[source]

Set function Callback when message received.

pause()[source]

Pause cleaning.

product_type

Product type.

remove_message_listener(callback_message)

Remove a message listener.

request_current_state()

Request new state message.

resume()[source]

Resume cleaning.

serial

Device serial.

set_power_mode(power_mode)[source]

Set power mode.

:param power_mode Power mode (const.PowerMode)

start()[source]

Start cleaning.

state

Device state.

state_data_available()

Call when first state data are available. Internal method.

status_topic

MQTT status topic.

version

Device version.

Dyson360EyeState

class libpurecool.dyson_360_eye.Dyson360EyeState(json_body)[source]

Dyson 360 Eye state.

battery_level

Return battery level.

clean_id

Return clean id.

full_clean_type

Return full clean type.

static is_state_message(payload)[source]

Return true if this message is a Dyson 360 Eye state message.

position

Return position.

power_mode

Return power mode.

state

Return state status.

Dyson360EyeTelemetryData

class libpurecool.dyson_360_eye.Dyson360EyeTelemetryData(json_body)[source]

Dyson 360 Eye Telemetry Data.

field1

Return field 1.

field2

Return field 2.

field3

Return field 3.

field4

Return field 4.

static is_telemetry_data(payload)[source]

Return true if this message is a telemetry data message.

telemetry_data_id

Return Telemetry data id.

time

Return time.

Dyson360EyeMapData

class libpurecool.dyson_360_eye.Dyson360EyeMapData(json_body)[source]

Dyson 360 Eye map data.

clean_id

Return Clean Id.

content

Return content.

content_encoding

Return content encoding.

content_type

Return content type.

grid_id

Return Grid id.

static is_map_data(payload)[source]

Return true if this message is a map data message.

time

Return time.

Dyson360EyeMapGrid

class libpurecool.dyson_360_eye.Dyson360EyeMapGrid(json_body)[source]

Dyson 360 Eye map grid.

anchor

Return Anchor.

clean_id

Return clean id.

grid_id

Return grid id.

height

Return height.

static is_map_grid(payload)[source]

Return true if this message is a map grid message.

resolution

Return resolution.

time

Return time.

width

Return width.

Dyson360EyeMapGlobal

class libpurecool.dyson_360_eye.Dyson360EyeMapGlobal(json_body)[source]

Dyson 360Eye map global.

angle

Return angle.

clean_id

Return clean id.

grid_id

Return grid id.

static is_map_global(payload)[source]

Return true if this message is a map global message.

position_x

Return x.

position_y

Return y.

time

Return time.

Exceptions

DysonNotLoggedException

exception libpurecool.exceptions.DysonNotLoggedException[source]

Not logged to Dyson Web Services Exception.

DysonInvalidTargetTemperatureException

exception libpurecool.exceptions.DysonInvalidTargetTemperatureException(temperature_unit, current_value)[source]

Invalid target temperature Exception.