jvconnected.engine
- class jvconnected.engine.Engine(*args, **kwargs)[source]
Bases:
DispatcherTop level component to handle config, discovery and device control
- DictProperty devices: Dict[str, Device]
Mapping of
Deviceinstances using theiridas keysdevicesis apydispatch.DictPropertyobject.
- DictProperty interfaces: Dict[str, jvconnected.interfaces.base.Interface]
Container for
Interfaceinstancesinterfacesis apydispatch.DictPropertyobject.
- Event on_config_device_added(conf_device: DeviceConfig)[source]
Fired when an instance of
DeviceConfigis addedon_config_device_addedis apydispatch.Eventobject.
- Event on_device_discovered(conf_device: DeviceConfig)[source]
Fired when a device is detected on the network. An instance of
DeviceConfigis found (or created) and passed as the argumenton_device_discoveredis apydispatch.Eventobject.
- Event on_device_added(device: Device)[source]
Fired when an instance of
Deviceis added todeviceson_device_addedis apydispatch.Eventobject.
- Event on_device_connected(device: Device)[source]
Fired when an instance of
Devicehas been added and successfully connectedon_device_connectedis apydispatch.Eventobject.
- Event on_device_removed(device: Device, reason: RemovalReason)[source]
Fired when an instance of
Deviceis removed- Parameters
device (Device) – The device that was removed
reason (RemovalReason) – Reason for removal
on_device_removedis apydispatch.Eventobject.
- Property auto_add_devices = True
If
True, devices will be added automatically when discovered on the network. Otherwise, they must be added manually usingadd_device_from_conf()auto_add_devicesis apydispatch.Propertyobject.
- connection_status: Dict[str, ReconnectStatus]
Mapping of
ReconnectStatusinstances using the associateddevice_idas keys
- async add_always_connected_devices()[source]
Create and open any devices with
always_connectset to True
- async add_device_from_conf(device_conf: jvconnected.config.DeviceConfig)[source]
Add a client
Deviceinstance from the givenDeviceConfigand attempt to connect.If auth information is incorrect or does not exist, display the error and remove the newly added device.
- async disconnect_device(device_id: str)[source]
Disconnect the device matching the given id (if connected)
- async reconnect_device(device_conf: DeviceConfig, wait_for_status: bool = False)[source]
Attempt to reestablish a device connection
This method is primarily useful when a new device is discovered and authentication information is needed for it. Once the information is set on the device_conf, this method may be used to retry the connection.
- Parameters
device_conf (DeviceConfig) – The
DeviceConfigto reconnectwait_for_status (bool) – If
True, attempt to wait for the connection state (usingReconnectStatus.wait_for_connect_or_failure()). Default is False
- add_discovered_device(info: zeroconf.ServiceInfo) DeviceConfig[source]
Create a
DeviceConfigand add it todiscovered_devices