VeSync Outlets↲
Overview↲
- Outlet State Object
- Etekcity 7A Outlet
- Etekcity 10A European Outlet
- Etekcity 15A Outlet
- Etekcity 15A Outdoor Dual Outlet
- Etekcity 10A USA Outlet
- VeSync BSODG Smart Outlet
- VeSyncOutlet Base Class
pyvesync.base_devices.outlet_base.OutletState ↲
Bases: DeviceState
Base state class for Outlets.
This class holds all of the state information for the outlet devices. The state
instance is stored in the state
attribute of the outlet device. This is only
for holding state information and does not contain any methods for controlling
the device or retrieving information from the API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
device
|
VeSyncOutlet
|
The device object. |
required |
details
|
ResponseDeviceDetailsModel
|
The device details. |
required |
feature_map
|
OutletMap
|
The feature map for the device. |
required |
Attributes:
Name | Type | Description |
---|---|---|
active_time |
int
|
Active time of device, defaults to None. |
connection_status |
str
|
Connection status of device. |
device |
VeSyncOutlet
|
Device object. |
device_status |
str
|
Device status. |
features |
dict
|
Features of device. |
last_update_ts |
int
|
Last update timestamp of device, defaults to None. |
energy |
float
|
Energy usage in kWh. |
monthly_history |
ResponseEnergyResult
|
Monthly energy history. |
nightlight_automode |
str
|
Nightlight automode status. |
nightlight_brightness |
int
|
Nightlight brightness level. |
nightlight_status |
str
|
Nightlight status. |
power |
float
|
Power usage in Watts. |
voltage |
float
|
Voltage in Volts. |
weekly_history |
ResponseEnergyResult
|
Weekly energy history. |
yearly_history |
ResponseEnergyResult
|
Yearly energy history. |
Methods:
Name | Description |
---|---|
update_ts |
Update last update timestamp. |
to_dict |
Dump state to JSON. |
to_json |
Dump state to JSON string. |
to_jsonb |
Dump state to JSON bytes. |
as_tuple |
Convert state to tuple of (name, value) tuples. |
Note
Not all attributes are available on all devices. Some attributes may be None or not supported depending on the device type and features. The attributes are set based on the device features and the API response.
Source code in src\pyvesync\base_devices\outlet_base.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
|
Attributes↲
connection_status
instance-attribute
↲
Inherited From DeviceState
device_status
instance-attribute
↲
Inherited From DeviceState
Functions↲
annual_history_to_json ↲
Dump annual history.
Source code in src\pyvesync\base_devices\outlet_base.py
as_tuple ↲
Inherited From DeviceState
Convert state to tuple of (name, value) tuples.
display ↲
Inherited From DeviceState
Print formatted state to stdout.
monthly_history_to_json ↲
Dump monthly history.
Source code in src\pyvesync\base_devices\outlet_base.py
to_dict ↲
Inherited From DeviceState
Convert state to dictionary.
to_json ↲
Inherited From DeviceState
Dump state to JSON string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
indent
|
bool
|
If True, indent JSON output, defaults to False. |
False
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
JSON formatted string of device state. |
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
to_jsonb ↲
Inherited From DeviceState
Convert state to JSON bytes.
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
update_ts ↲
Inherited From DeviceState
Update last update timestamp.
weekly_history_to_json ↲
Dump weekly history.
Source code in src\pyvesync\base_devices\outlet_base.py
pyvesync.devices.vesyncoutlet.VeSyncOutlet7A ↲
Bases: VeSyncOutlet
Etekcity 7A Round Outlet Class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
details
|
ResponseDeviceDetailsModel
|
The device details. |
required |
manager
|
VeSync
|
The VeSync manager. |
required |
feature_map
|
OutletMap
|
The feature map for the device. |
required |
Attributes:
Name | Type | Description |
---|---|---|
state |
OutletState
|
The state of the outlet. |
last_response |
ResponseInfo
|
Last response from API call. |
device_status |
str
|
Device status. |
connection_status |
str
|
Connection status. |
manager |
VeSync
|
Manager object for API calls. |
device_name |
str
|
Name of device. |
device_image |
str
|
URL for device image. |
cid |
str
|
Device ID. |
connection_type |
str
|
Connection type of device. |
device_type |
str
|
Type of device. |
type |
str
|
Type of device. |
uuid |
str
|
UUID of device, not always present. |
config_module |
str
|
Configuration module of device. |
mac_id |
str
|
MAC ID of device. |
current_firm_version |
str
|
Current firmware version of device. |
device_region |
str
|
Region of device. (US, EU, etc.) |
pid |
str
|
Product ID of device, pulled by some devices on update. |
sub_device_no |
int
|
Sub-device number of device. |
product_type |
str
|
Product type of device. |
features |
dict
|
Features of device. |
Source code in src\pyvesync\devices\vesyncoutlet.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
|
Attributes↲
config_module
instance-attribute
↲
Inherited From VeSyncBaseDevice
connection_type
instance-attribute
↲
Inherited From VeSyncBaseDevice
current_firm_version
instance-attribute
↲
Inherited From VeSyncBaseDevice
device_image
instance-attribute
↲
Inherited From VeSyncBaseDevice
device_region
instance-attribute
↲
Inherited From VeSyncBaseDevice
firmware_update
property
↲
Inherited From VeSyncBaseDevice
Return True if firmware update available.
This is going to be updated.
last_response
instance-attribute
↲
last_response: ResponseInfo | None = None
Inherited From VeSyncBaseDevice
nightlight_modes
instance-attribute
↲
Inherited From VeSyncOutlet
state
instance-attribute
↲
state: OutletState = OutletState(self, details, feature_map)
Inherited From VeSyncBaseDevice
sub_device_no
instance-attribute
↲
Inherited From VeSyncBaseDevice
supports_energy
property
↲
Inherited From VeSyncOutlet
Return True if device supports energy.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if device supports energy, False otherwise. |
supports_nightlight
property
↲
Inherited From VeSyncOutlet
Return True if device supports nightlight.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if device supports nightlight, False otherwise. |
Functions↲
clear_timer
async
↲
Inherited From VeSyncBaseDevice
Clear timer for device from API.
This may not be implemented for all devices. Please open an issue if there is an error.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if successful, False otherwise. |
Source code in src\pyvesync\devices\vesyncoutlet.py
display ↲
Inherited From VeSyncBaseDevice
Print formatted static device info to stdout.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
bool
|
If True, include state in display, defaults to True. |
True
|
Example:
Device Name:..................Living Room Lamp
Model:........................ESL100
Subdevice No:.................0
Type:.........................wifi
CID:..........................1234567890abcdef
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
displayJSON
deprecated
↲
Inherited From VeSyncBaseDevice
Deprecated
Use to_json() instead
Return JSON details for device. - Deprecated use to_json().
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
get_details
async
↲
Inherited From VeSyncBaseDevice
Get device details.
This method is defined in each device class to contain
the logic to pull the device state from the API and update
the device's state
attribute. The update()
method should
be called to update the device state.
Source code in src\pyvesync\devices\vesyncoutlet.py
get_monthly_energy
async
↲
Inherited From VeSyncOutlet
Build Monthly Energy History Dictionary.
The data is stored in the device.state.monthly_history
attribute
as a ResponseEnergyResult
object.
Source code in src\pyvesync\base_devices\outlet_base.py
get_state ↲
Inherited From VeSyncBaseDevice
Get device state attribute.
get_timer
async
↲
Inherited From VeSyncBaseDevice
Get timer for device from API and set the state.Timer
attribute.
This may not be implemented for all devices. Please open an issue if there is an error.
Note
This method may not be implemented for all devices. Please open an issue if there is an error.
Source code in src\pyvesync\devices\vesyncoutlet.py
get_weekly_energy
async
↲
Inherited From VeSyncOutlet
Build weekly energy history dictionary.
The data is stored in the device.state.weekly_history
attribute
as a ResponseEnergyResult
object.
Source code in src\pyvesync\base_devices\outlet_base.py
get_yearly_energy
async
↲
Inherited From VeSyncOutlet
Build Yearly Energy Dictionary.
The data is stored in the device.state.yearly_history
attribute
as a ResponseEnergyResult
object.
Source code in src\pyvesync\base_devices\outlet_base.py
parse_energy_detail
staticmethod
↲
Parse energy details to be compatible with new and old firmware.
Source code in src\pyvesync\devices\vesyncoutlet.py
set_nightlight_auto
async
↲
Inherited From VeSyncOutlet
Set nightlight to auto mode.
Source code in src\pyvesync\base_devices\outlet_base.py
set_nightlight_state
async
↲
Inherited From VeSyncOutlet
Set nightlight mode.
Available nightlight states are found in the device.nightlight_modes
attribute.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mode
|
str
|
Nightlight mode to set. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if nightlight mode set successfully, False otherwise. |
Source code in src\pyvesync\base_devices\outlet_base.py
set_state ↲
Inherited From VeSyncBaseDevice
Set device state attribute.
set_timer
async
↲
Inherited From VeSyncBaseDevice
Set timer for device.
This may not be implemented for all devices. Please open an issue if there is an error.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
duration
|
int
|
Duration in seconds. |
required |
action
|
str | None
|
Action to take when timer expires. |
None
|
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if successful, False otherwise. |
Source code in src\pyvesync\devices\vesyncoutlet.py
to_dict ↲
Inherited From VeSyncBaseDevice
Return device information as a dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
bool
|
If True, include state in dictionary, defaults to True. |
True
|
Returns:
Type | Description |
---|---|
dict[str, Any]
|
dict[str, Any]: Dictionary containing device information. |
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
to_json ↲
Inherited From VeSyncBaseDevice
Print JSON API string for device details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
bool
|
If True, include state in JSON output, defaults to True. |
True
|
indent
|
bool
|
If True, indent JSON output, defaults to True. |
True
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
JSON formatted string of device details. |
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
to_jsonb ↲
Inherited From VeSyncBaseDevice
JSON API bytes for device details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
bool
|
If True, include state in JSON output, defaults to True. |
True
|
indent
|
bool
|
If True, indent JSON output, defaults to True. |
True
|
Returns:
Name | Type | Description |
---|---|---|
bytes |
bytes
|
JSON formatted bytes of device details. |
Example
This is an example without state.
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
toggle_switch
async
↲
Inherited From VeSyncBaseToggleDevice
Toggle device power on or off.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
toggle
|
bool | None
|
True to turn on, False to turn off, None to toggle. |
None
|
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if successful, False otherwise. |
Source code in src\pyvesync\devices\vesyncoutlet.py
turn_off
async
↲
Inherited From VeSyncBaseToggleDevice
Turn device off.
turn_off_nightlight
async
↲
Inherited From VeSyncOutlet
Turn off nightlight if supported.
Source code in src\pyvesync\base_devices\outlet_base.py
turn_on
async
↲
Inherited From VeSyncBaseToggleDevice
Turn device on.
turn_on_nightlight
async
↲
Inherited From VeSyncOutlet
Turn on nightlight if supported.
Source code in src\pyvesync\base_devices\outlet_base.py
update
async
↲
Inherited From VeSyncBaseDevice
Update device details.
update_energy
async
↲
Inherited From VeSyncOutlet
Build weekly, monthly and yearly dictionaries.
pyvesync.devices.vesyncoutlet.VeSyncOutlet10A ↲
Bases: VeSyncOutlet
Etekcity 10A Round Outlets.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
details
|
ResponseDeviceDetailsModel
|
The device details. |
required |
manager
|
VeSync
|
The VeSync manager. |
required |
feature_map
|
OutletMap
|
The feature map for the device. |
required |
Attributes:
Name | Type | Description |
---|---|---|
state |
OutletState
|
The state of the outlet. |
last_response |
ResponseInfo
|
Last response from API call. |
device_status |
str
|
Device status. |
connection_status |
str
|
Connection status. |
manager |
VeSync
|
Manager object for API calls. |
device_name |
str
|
Name of device. |
device_image |
str
|
URL for device image. |
cid |
str
|
Device ID. |
connection_type |
str
|
Connection type of device. |
device_type |
str
|
Type of device. |
type |
str
|
Type of device. |
uuid |
str
|
UUID of device, not always present. |
config_module |
str
|
Configuration module of device. |
mac_id |
str
|
MAC ID of device. |
current_firm_version |
str
|
Current firmware version of device. |
device_region |
str
|
Region of device. (US, EU, etc.) |
pid |
str
|
Product ID of device, pulled by some devices on update. |
sub_device_no |
int
|
Sub-device number of device. |
product_type |
str
|
Product type of device. |
features |
dict
|
Features of device. |
Source code in src\pyvesync\devices\vesyncoutlet.py
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 |
|
Attributes↲
config_module
instance-attribute
↲
Inherited From VeSyncBaseDevice
connection_type
instance-attribute
↲
Inherited From VeSyncBaseDevice
current_firm_version
instance-attribute
↲
Inherited From VeSyncBaseDevice
device_image
instance-attribute
↲
Inherited From VeSyncBaseDevice
device_region
instance-attribute
↲
Inherited From VeSyncBaseDevice
firmware_update
property
↲
Inherited From VeSyncBaseDevice
Return True if firmware update available.
This is going to be updated.
last_response
instance-attribute
↲
last_response: ResponseInfo | None = None
Inherited From VeSyncBaseDevice
nightlight_modes
instance-attribute
↲
Inherited From VeSyncOutlet
request_keys
instance-attribute
↲
request_keys = [
'acceptLanguage',
'appVersion',
'accountId',
'mobileId',
'phoneBrand',
'phoneOS',
'timeZone',
'token',
'traceId',
'uuid',
]
state
instance-attribute
↲
state: OutletState = OutletState(self, details, feature_map)
Inherited From VeSyncBaseDevice
sub_device_no
instance-attribute
↲
Inherited From VeSyncBaseDevice
supports_energy
property
↲
Inherited From VeSyncOutlet
Return True if device supports energy.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if device supports energy, False otherwise. |
supports_nightlight
property
↲
Inherited From VeSyncOutlet
Return True if device supports nightlight.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if device supports nightlight, False otherwise. |
Functions↲
clear_timer
async
↲
Inherited From VeSyncBaseDevice
Clear timer for device from API.
This may not be implemented for all devices. Please open an issue if there is an error.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if successful, False otherwise. |
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
display ↲
Inherited From VeSyncBaseDevice
Print formatted static device info to stdout.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
bool
|
If True, include state in display, defaults to True. |
True
|
Example:
Device Name:..................Living Room Lamp
Model:........................ESL100
Subdevice No:.................0
Type:.........................wifi
CID:..........................1234567890abcdef
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
displayJSON
deprecated
↲
Inherited From VeSyncBaseDevice
Deprecated
Use to_json() instead
Return JSON details for device. - Deprecated use to_json().
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
get_details
async
↲
Inherited From VeSyncBaseDevice
Get device details.
This method is defined in each device class to contain
the logic to pull the device state from the API and update
the device's state
attribute. The update()
method should
be called to update the device state.
Source code in src\pyvesync\devices\vesyncoutlet.py
get_monthly_energy
async
↲
Inherited From VeSyncOutlet
Build Monthly Energy History Dictionary.
The data is stored in the device.state.monthly_history
attribute
as a ResponseEnergyResult
object.
Source code in src\pyvesync\base_devices\outlet_base.py
get_state ↲
Inherited From VeSyncBaseDevice
Get device state attribute.
get_timer
async
↲
get_timer() -> Timer | None
Inherited From VeSyncBaseDevice
Get timer for device from API and set the state.Timer
attribute.
This may not be implemented for all devices. Please open an issue if there is an error.
Note
This method may not be implemented for all devices. Please open an issue if there is an error.
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
get_weekly_energy
async
↲
Inherited From VeSyncOutlet
Build weekly energy history dictionary.
The data is stored in the device.state.weekly_history
attribute
as a ResponseEnergyResult
object.
Source code in src\pyvesync\base_devices\outlet_base.py
get_yearly_energy
async
↲
Inherited From VeSyncOutlet
Build Yearly Energy Dictionary.
The data is stored in the device.state.yearly_history
attribute
as a ResponseEnergyResult
object.
Source code in src\pyvesync\base_devices\outlet_base.py
set_nightlight_auto
async
↲
Inherited From VeSyncOutlet
Set nightlight to auto mode.
Source code in src\pyvesync\base_devices\outlet_base.py
set_nightlight_state
async
↲
Inherited From VeSyncOutlet
Set nightlight mode.
Available nightlight states are found in the device.nightlight_modes
attribute.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mode
|
str
|
Nightlight mode to set. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if nightlight mode set successfully, False otherwise. |
Source code in src\pyvesync\base_devices\outlet_base.py
set_state ↲
Inherited From VeSyncBaseDevice
Set device state attribute.
set_timer
async
↲
Inherited From VeSyncBaseDevice
Set timer for device.
This may not be implemented for all devices. Please open an issue if there is an error.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
duration
|
int
|
Duration in seconds. |
required |
action
|
str | None
|
Action to take when timer expires. |
None
|
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if successful, False otherwise. |
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
to_dict ↲
Inherited From VeSyncBaseDevice
Return device information as a dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
bool
|
If True, include state in dictionary, defaults to True. |
True
|
Returns:
Type | Description |
---|---|
dict[str, Any]
|
dict[str, Any]: Dictionary containing device information. |
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
to_json ↲
Inherited From VeSyncBaseDevice
Print JSON API string for device details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
bool
|
If True, include state in JSON output, defaults to True. |
True
|
indent
|
bool
|
If True, indent JSON output, defaults to True. |
True
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
JSON formatted string of device details. |
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
to_jsonb ↲
Inherited From VeSyncBaseDevice
JSON API bytes for device details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
bool
|
If True, include state in JSON output, defaults to True. |
True
|
indent
|
bool
|
If True, indent JSON output, defaults to True. |
True
|
Returns:
Name | Type | Description |
---|---|---|
bytes |
bytes
|
JSON formatted bytes of device details. |
Example
This is an example without state.
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
toggle_switch
async
↲
Inherited From VeSyncBaseToggleDevice
Toggle device power on or off.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
toggle
|
bool | None
|
True to turn on, False to turn off, None to toggle. |
None
|
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if successful, False otherwise. |
Source code in src\pyvesync\devices\vesyncoutlet.py
turn_off
async
↲
Inherited From VeSyncBaseToggleDevice
Turn device off.
turn_off_nightlight
async
↲
Inherited From VeSyncOutlet
Turn off nightlight if supported.
Source code in src\pyvesync\base_devices\outlet_base.py
turn_on
async
↲
Inherited From VeSyncBaseToggleDevice
Turn device on.
turn_on_nightlight
async
↲
Inherited From VeSyncOutlet
Turn on nightlight if supported.
Source code in src\pyvesync\base_devices\outlet_base.py
update
async
↲
Inherited From VeSyncBaseDevice
Update device details.
update_energy
async
↲
Inherited From VeSyncOutlet
Build weekly, monthly and yearly dictionaries.
pyvesync.devices.vesyncoutlet.VeSyncOutlet15A ↲
Bases: BypassV1Mixin
, VeSyncOutlet
Class for Etekcity 15A Rectangular Outlets.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
details
|
ResponseDeviceDetailsModel
|
The device details. |
required |
manager
|
VeSync
|
The VeSync manager. |
required |
feature_map
|
OutletMap
|
The feature map for the device. |
required |
Attributes:
Name | Type | Description |
---|---|---|
state |
OutletState
|
The state of the outlet. |
last_response |
ResponseInfo
|
Last response from API call. |
device_status |
str
|
Device status. |
connection_status |
str
|
Connection status. |
manager |
VeSync
|
Manager object for API calls. |
device_name |
str
|
Name of device. |
device_image |
str
|
URL for device image. |
cid |
str
|
Device ID. |
connection_type |
str
|
Connection type of device. |
device_type |
str
|
Type of device. |
type |
str
|
Type of device. |
uuid |
str
|
UUID of device, not always present. |
config_module |
str
|
Configuration module of device. |
mac_id |
str
|
MAC ID of device. |
current_firm_version |
str
|
Current firmware version of device. |
device_region |
str
|
Region of device. (US, EU, etc.) |
pid |
str
|
Product ID of device, pulled by some devices on update. |
sub_device_no |
int
|
Sub-device number of device. |
product_type |
str
|
Product type of device. |
features |
dict
|
Features of device. |
Source code in src\pyvesync\devices\vesyncoutlet.py
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 |
|
Attributes↲
config_module
instance-attribute
↲
Inherited From VeSyncBaseDevice
connection_type
instance-attribute
↲
Inherited From VeSyncBaseDevice
current_firm_version
instance-attribute
↲
Inherited From VeSyncBaseDevice
device_image
instance-attribute
↲
Inherited From VeSyncBaseDevice
device_region
instance-attribute
↲
Inherited From VeSyncBaseDevice
firmware_update
property
↲
Inherited From VeSyncBaseDevice
Return True if firmware update available.
This is going to be updated.
last_response
instance-attribute
↲
last_response: ResponseInfo | None = None
Inherited From VeSyncBaseDevice
nightlight_modes
instance-attribute
↲
Inherited From VeSyncOutlet
request_keys
class-attribute
↲
request_keys: list[str] = [
'acceptLanguage',
'appVersion',
'phoneBrand',
'phoneOS',
'accountID',
'cid',
'configModule',
'debugMode',
'traceId',
'timeZone',
'token',
'userCountryCode',
'uuid',
'configModel',
'deviceId',
]
Inherited From BypassV1Mixin
state
instance-attribute
↲
state: OutletState = OutletState(self, details, feature_map)
Inherited From VeSyncBaseDevice
sub_device_no
instance-attribute
↲
Inherited From VeSyncBaseDevice
supports_energy
property
↲
Inherited From VeSyncOutlet
Return True if device supports energy.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if device supports energy, False otherwise. |
supports_nightlight
property
↲
Inherited From VeSyncOutlet
Return True if device supports nightlight.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if device supports nightlight, False otherwise. |
Functions↲
call_bypassv1_api
async
↲
call_bypassv1_api(
request_model: type[RequestBypassV1],
update_dict: dict | None = None,
method: str = 'bypass',
endpoint: str = 'bypass',
) -> dict | None
Inherited From BypassV1Mixin
Send ByPass V1 API request.
This uses the _build_request
method to send API requests to the Bypass V1 API.
The endpoint can be overridden with the endpoint
argument.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request_model
|
type[RequestBypassV1]
|
The request model to use. |
required |
update_dict
|
dict
|
Additional keys to add on. |
None
|
method
|
str
|
The method to use in the outer body. |
'bypass'
|
endpoint
|
str | None
|
The last part of the url path, defaults to
|
'bypass'
|
Returns:
Name | Type | Description |
---|---|---|
bytes |
dict | None
|
The response from the API request. |
Source code in src\pyvesync\utils\device_mixins.py
clear_timer
async
↲
Inherited From VeSyncBaseDevice
Clear timer for device from API.
This may not be implemented for all devices. Please open an issue if there is an error.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if successful, False otherwise. |
Source code in src\pyvesync\devices\vesyncoutlet.py
display ↲
Inherited From VeSyncBaseDevice
Print formatted static device info to stdout.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
bool
|
If True, include state in display, defaults to True. |
True
|
Example:
Device Name:..................Living Room Lamp
Model:........................ESL100
Subdevice No:.................0
Type:.........................wifi
CID:..........................1234567890abcdef
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
displayJSON
deprecated
↲
Inherited From VeSyncBaseDevice
Deprecated
Use to_json() instead
Return JSON details for device. - Deprecated use to_json().
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
get_details
async
↲
Inherited From VeSyncBaseDevice
Get device details.
This method is defined in each device class to contain
the logic to pull the device state from the API and update
the device's state
attribute. The update()
method should
be called to update the device state.
Source code in src\pyvesync\devices\vesyncoutlet.py
get_monthly_energy
async
↲
Inherited From VeSyncOutlet
Build Monthly Energy History Dictionary.
The data is stored in the device.state.monthly_history
attribute
as a ResponseEnergyResult
object.
Source code in src\pyvesync\base_devices\outlet_base.py
get_state ↲
Inherited From VeSyncBaseDevice
Get device state attribute.
get_timer
async
↲
Inherited From VeSyncBaseDevice
Get timer for device from API and set the state.Timer
attribute.
This may not be implemented for all devices. Please open an issue if there is an error.
Note
This method may not be implemented for all devices. Please open an issue if there is an error.
Source code in src\pyvesync\devices\vesyncoutlet.py
get_weekly_energy
async
↲
Inherited From VeSyncOutlet
Build weekly energy history dictionary.
The data is stored in the device.state.weekly_history
attribute
as a ResponseEnergyResult
object.
Source code in src\pyvesync\base_devices\outlet_base.py
get_yearly_energy
async
↲
Inherited From VeSyncOutlet
Build Yearly Energy Dictionary.
The data is stored in the device.state.yearly_history
attribute
as a ResponseEnergyResult
object.
Source code in src\pyvesync\base_devices\outlet_base.py
set_nightlight_auto
async
↲
Inherited From VeSyncOutlet
Set nightlight to auto mode.
Source code in src\pyvesync\base_devices\outlet_base.py
set_nightlight_state
async
↲
Inherited From VeSyncOutlet
Set nightlight mode.
Available nightlight states are found in the device.nightlight_modes
attribute.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mode
|
str
|
Nightlight mode to set. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if nightlight mode set successfully, False otherwise. |
Set nightlight state for 15A Outlets.
Source code in src\pyvesync\devices\vesyncoutlet.py
set_state ↲
Inherited From VeSyncBaseDevice
Set device state attribute.
set_timer
async
↲
Inherited From VeSyncBaseDevice
Set timer for device.
This may not be implemented for all devices. Please open an issue if there is an error.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
duration
|
int
|
Duration in seconds. |
required |
action
|
str | None
|
Action to take when timer expires. |
None
|
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if successful, False otherwise. |
Source code in src\pyvesync\devices\vesyncoutlet.py
to_dict ↲
Inherited From VeSyncBaseDevice
Return device information as a dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
bool
|
If True, include state in dictionary, defaults to True. |
True
|
Returns:
Type | Description |
---|---|
dict[str, Any]
|
dict[str, Any]: Dictionary containing device information. |
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
to_json ↲
Inherited From VeSyncBaseDevice
Print JSON API string for device details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
bool
|
If True, include state in JSON output, defaults to True. |
True
|
indent
|
bool
|
If True, indent JSON output, defaults to True. |
True
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
JSON formatted string of device details. |
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
to_jsonb ↲
Inherited From VeSyncBaseDevice
JSON API bytes for device details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
bool
|
If True, include state in JSON output, defaults to True. |
True
|
indent
|
bool
|
If True, indent JSON output, defaults to True. |
True
|
Returns:
Name | Type | Description |
---|---|---|
bytes |
bytes
|
JSON formatted bytes of device details. |
Example
This is an example without state.
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
toggle_switch
async
↲
Inherited From VeSyncBaseToggleDevice
Toggle device power on or off.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
toggle
|
bool | None
|
True to turn on, False to turn off, None to toggle. |
None
|
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if successful, False otherwise. |
Source code in src\pyvesync\devices\vesyncoutlet.py
turn_off
async
↲
Inherited From VeSyncBaseToggleDevice
Turn device off.
turn_off_nightlight
async
↲
Inherited From VeSyncOutlet
Turn off nightlight if supported.
Source code in src\pyvesync\base_devices\outlet_base.py
turn_on
async
↲
Inherited From VeSyncBaseToggleDevice
Turn device on.
turn_on_nightlight
async
↲
Inherited From VeSyncOutlet
Turn on nightlight if supported.
Source code in src\pyvesync\base_devices\outlet_base.py
update
async
↲
Inherited From VeSyncBaseDevice
Update device details.
update_energy
async
↲
Inherited From VeSyncOutlet
Build weekly, monthly and yearly dictionaries.
pyvesync.devices.vesyncoutlet.VeSyncOutdoorPlug ↲
Bases: BypassV1Mixin
, VeSyncOutlet
Class to hold Etekcity outdoor outlets.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
details
|
ResponseDeviceDetailsModel
|
The device details. |
required |
manager
|
VeSync
|
The VeSync manager. |
required |
feature_map
|
OutletMap
|
The feature map for the device. |
required |
Attributes:
Name | Type | Description |
---|---|---|
state |
OutletState
|
The state of the outlet. |
last_response |
ResponseInfo
|
Last response from API call. |
device_status |
str
|
Device status. |
connection_status |
str
|
Connection status. |
manager |
VeSync
|
Manager object for API calls. |
device_name |
str
|
Name of device. |
device_image |
str
|
URL for device image. |
cid |
str
|
Device ID. |
connection_type |
str
|
Connection type of device. |
device_type |
str
|
Type of device. |
type |
str
|
Type of device. |
uuid |
str
|
UUID of device, not always present. |
config_module |
str
|
Configuration module of device. |
mac_id |
str
|
MAC ID of device. |
current_firm_version |
str
|
Current firmware version of device. |
device_region |
str
|
Region of device. (US, EU, etc.) |
pid |
str
|
Product ID of device, pulled by some devices on update. |
sub_device_no |
int
|
Sub-device number of device. |
product_type |
str
|
Product type of device. |
features |
dict
|
Features of device. |
Source code in src\pyvesync\devices\vesyncoutlet.py
565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 |
|
Attributes↲
config_module
instance-attribute
↲
Inherited From VeSyncBaseDevice
connection_type
instance-attribute
↲
Inherited From VeSyncBaseDevice
current_firm_version
instance-attribute
↲
Inherited From VeSyncBaseDevice
device_image
instance-attribute
↲
Inherited From VeSyncBaseDevice
device_region
instance-attribute
↲
Inherited From VeSyncBaseDevice
firmware_update
property
↲
Inherited From VeSyncBaseDevice
Return True if firmware update available.
This is going to be updated.
last_response
instance-attribute
↲
last_response: ResponseInfo | None = None
Inherited From VeSyncBaseDevice
nightlight_modes
instance-attribute
↲
Inherited From VeSyncOutlet
request_keys
class-attribute
↲
request_keys: list[str] = [
'acceptLanguage',
'appVersion',
'phoneBrand',
'phoneOS',
'accountID',
'cid',
'configModule',
'debugMode',
'traceId',
'timeZone',
'token',
'userCountryCode',
'uuid',
'configModel',
'deviceId',
]
Inherited From BypassV1Mixin
state
instance-attribute
↲
state: OutletState = OutletState(self, details, feature_map)
Inherited From VeSyncBaseDevice
sub_device_no
instance-attribute
↲
Inherited From VeSyncBaseDevice
supports_energy
property
↲
Inherited From VeSyncOutlet
Return True if device supports energy.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if device supports energy, False otherwise. |
supports_nightlight
property
↲
Inherited From VeSyncOutlet
Return True if device supports nightlight.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if device supports nightlight, False otherwise. |
Functions↲
call_bypassv1_api
async
↲
call_bypassv1_api(
request_model: type[RequestBypassV1],
update_dict: dict | None = None,
method: str = 'bypass',
endpoint: str = 'bypass',
) -> dict | None
Inherited From BypassV1Mixin
Send ByPass V1 API request.
This uses the _build_request
method to send API requests to the Bypass V1 API.
The endpoint can be overridden with the endpoint
argument.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request_model
|
type[RequestBypassV1]
|
The request model to use. |
required |
update_dict
|
dict
|
Additional keys to add on. |
None
|
method
|
str
|
The method to use in the outer body. |
'bypass'
|
endpoint
|
str | None
|
The last part of the url path, defaults to
|
'bypass'
|
Returns:
Name | Type | Description |
---|---|---|
bytes |
dict | None
|
The response from the API request. |
Source code in src\pyvesync\utils\device_mixins.py
clear_timer
async
↲
Inherited From VeSyncBaseDevice
Clear timer for device from API.
This may not be implemented for all devices. Please open an issue if there is an error.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if successful, False otherwise. |
Source code in src\pyvesync\devices\vesyncoutlet.py
display ↲
Inherited From VeSyncBaseDevice
Print formatted static device info to stdout.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
bool
|
If True, include state in display, defaults to True. |
True
|
Example:
Device Name:..................Living Room Lamp
Model:........................ESL100
Subdevice No:.................0
Type:.........................wifi
CID:..........................1234567890abcdef
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
displayJSON
deprecated
↲
Inherited From VeSyncBaseDevice
Deprecated
Use to_json() instead
Return JSON details for device. - Deprecated use to_json().
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
get_details
async
↲
Inherited From VeSyncBaseDevice
Get device details.
This method is defined in each device class to contain
the logic to pull the device state from the API and update
the device's state
attribute. The update()
method should
be called to update the device state.
Source code in src\pyvesync\devices\vesyncoutlet.py
get_monthly_energy
async
↲
Inherited From VeSyncOutlet
Build Monthly Energy History Dictionary.
The data is stored in the device.state.monthly_history
attribute
as a ResponseEnergyResult
object.
Source code in src\pyvesync\base_devices\outlet_base.py
get_state ↲
Inherited From VeSyncBaseDevice
Get device state attribute.
get_timer
async
↲
Inherited From VeSyncBaseDevice
Get timer for device from API and set the state.Timer
attribute.
This may not be implemented for all devices. Please open an issue if there is an error.
Note
This method may not be implemented for all devices. Please open an issue if there is an error.
Source code in src\pyvesync\devices\vesyncoutlet.py
get_weekly_energy
async
↲
Inherited From VeSyncOutlet
Build weekly energy history dictionary.
The data is stored in the device.state.weekly_history
attribute
as a ResponseEnergyResult
object.
Source code in src\pyvesync\base_devices\outlet_base.py
get_yearly_energy
async
↲
Inherited From VeSyncOutlet
Build Yearly Energy Dictionary.
The data is stored in the device.state.yearly_history
attribute
as a ResponseEnergyResult
object.
Source code in src\pyvesync\base_devices\outlet_base.py
set_nightlight_auto
async
↲
Inherited From VeSyncOutlet
Set nightlight to auto mode.
Source code in src\pyvesync\base_devices\outlet_base.py
set_nightlight_state
async
↲
Inherited From VeSyncOutlet
Set nightlight mode.
Available nightlight states are found in the device.nightlight_modes
attribute.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mode
|
str
|
Nightlight mode to set. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if nightlight mode set successfully, False otherwise. |
Source code in src\pyvesync\base_devices\outlet_base.py
set_state ↲
Inherited From VeSyncBaseDevice
Set device state attribute.
set_timer
async
↲
Inherited From VeSyncBaseDevice
Set timer for device.
This may not be implemented for all devices. Please open an issue if there is an error.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
duration
|
int
|
Duration in seconds. |
required |
action
|
str | None
|
Action to take when timer expires. |
None
|
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if successful, False otherwise. |
Source code in src\pyvesync\devices\vesyncoutlet.py
to_dict ↲
Inherited From VeSyncBaseDevice
Return device information as a dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
bool
|
If True, include state in dictionary, defaults to True. |
True
|
Returns:
Type | Description |
---|---|
dict[str, Any]
|
dict[str, Any]: Dictionary containing device information. |
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
to_json ↲
Inherited From VeSyncBaseDevice
Print JSON API string for device details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
bool
|
If True, include state in JSON output, defaults to True. |
True
|
indent
|
bool
|
If True, indent JSON output, defaults to True. |
True
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
JSON formatted string of device details. |
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
to_jsonb ↲
Inherited From VeSyncBaseDevice
JSON API bytes for device details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
bool
|
If True, include state in JSON output, defaults to True. |
True
|
indent
|
bool
|
If True, indent JSON output, defaults to True. |
True
|
Returns:
Name | Type | Description |
---|---|---|
bytes |
bytes
|
JSON formatted bytes of device details. |
Example
This is an example without state.
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
toggle
async
↲
Deprecated, use toggle_switch() instead.
Source code in src\pyvesync\devices\vesyncoutlet.py
toggle_switch
async
↲
Inherited From VeSyncBaseToggleDevice
Toggle device power on or off.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
toggle
|
bool | None
|
True to turn on, False to turn off, None to toggle. |
None
|
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if successful, False otherwise. |
Source code in src\pyvesync\devices\vesyncoutlet.py
turn_off
async
↲
Inherited From VeSyncBaseToggleDevice
Turn device off.
turn_off_nightlight
async
↲
Inherited From VeSyncOutlet
Turn off nightlight if supported.
Source code in src\pyvesync\base_devices\outlet_base.py
turn_on
async
↲
Inherited From VeSyncBaseToggleDevice
Turn device on.
turn_on_nightlight
async
↲
Inherited From VeSyncOutlet
Turn on nightlight if supported.
Source code in src\pyvesync\base_devices\outlet_base.py
update
async
↲
Inherited From VeSyncBaseDevice
Update device details.
update_energy
async
↲
Inherited From VeSyncOutlet
Build weekly, monthly and yearly dictionaries.
pyvesync.devices.vesyncoutlet.VeSyncESW10USA ↲
Bases: BypassV2Mixin
, VeSyncOutlet10A
VeSync ESW10 USA outlet.
Note that this device does not support energy monitoring.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
details
|
ResponseDeviceDetailsModel
|
The device details. |
required |
manager
|
VeSync
|
The VeSync manager. |
required |
feature_map
|
OutletMap
|
The feature map for the device. |
required |
Attributes:
Name | Type | Description |
---|---|---|
state |
OutletState
|
The state of the outlet. |
last_response |
ResponseInfo
|
Last response from API call. |
device_status |
str
|
Device status. |
connection_status |
str
|
Connection status. |
manager |
VeSync
|
Manager object for API calls. |
device_name |
str
|
Name of device. |
device_image |
str
|
URL for device image. |
cid |
str
|
Device ID. |
connection_type |
str
|
Connection type of device. |
device_type |
str
|
Type of device. |
type |
str
|
Type of device. |
uuid |
str
|
UUID of device, not always present. |
config_module |
str
|
Configuration module of device. |
mac_id |
str
|
MAC ID of device. |
current_firm_version |
str
|
Current firmware version of device. |
device_region |
str
|
Region of device. (US, EU, etc.) |
pid |
str
|
Product ID of device, pulled by some devices on update. |
sub_device_no |
int
|
Sub-device number of device. |
product_type |
str
|
Product type of device. |
features |
dict
|
Features of device. |
Source code in src\pyvesync\devices\vesyncoutlet.py
815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 |
|
Attributes↲
config_module
instance-attribute
↲
Inherited From VeSyncBaseDevice
connection_type
instance-attribute
↲
Inherited From VeSyncBaseDevice
current_firm_version
instance-attribute
↲
Inherited From VeSyncBaseDevice
device_image
instance-attribute
↲
Inherited From VeSyncBaseDevice
device_region
instance-attribute
↲
Inherited From VeSyncBaseDevice
firmware_update
property
↲
Inherited From VeSyncBaseDevice
Return True if firmware update available.
This is going to be updated.
last_response
instance-attribute
↲
last_response: ResponseInfo | None = None
Inherited From VeSyncBaseDevice
nightlight_modes
instance-attribute
↲
Inherited From VeSyncOutlet
request_keys
class-attribute
↲
request_keys: list[str] = [
'acceptLanguage',
'appVersion',
'phoneBrand',
'phoneOS',
'accountID',
'cid',
'configModule',
'debugMode',
'traceId',
'timeZone',
'token',
'userCountryCode',
'configModel',
'deviceId',
]
Inherited From BypassV2Mixin
state
instance-attribute
↲
state: OutletState = OutletState(self, details, feature_map)
Inherited From VeSyncBaseDevice
sub_device_no
instance-attribute
↲
Inherited From VeSyncBaseDevice
supports_energy
property
↲
Inherited From VeSyncOutlet
Return True if device supports energy.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if device supports energy, False otherwise. |
supports_nightlight
property
↲
Inherited From VeSyncOutlet
Return True if device supports nightlight.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if device supports nightlight, False otherwise. |
Functions↲
call_bypassv2_api
async
↲
call_bypassv2_api(
payload_method: str,
data: dict | None = None,
method: str = 'bypassV2',
endpoint: str = 'bypassV2',
) -> dict | None
Inherited From BypassV2Mixin
Send Bypass V2 API request.
This uses the _build_request
method to send API requests to the Bypass V2 API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
payload_method
|
str
|
The method to use in the payload dict. |
required |
data
|
dict | None
|
The data to send in the request. |
None
|
method
|
str
|
The method to use in the outer body. |
'bypassV2'
|
endpoint
|
str | None
|
The last part of the API url, defaults to
|
'bypassV2'
|
Returns:
Name | Type | Description |
---|---|---|
bytes |
dict | None
|
The response from the API request. |
Source code in src\pyvesync\utils\device_mixins.py
clear_timer
async
↲
Inherited From VeSyncBaseDevice
Clear timer for device from API.
This may not be implemented for all devices. Please open an issue if there is an error.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if successful, False otherwise. |
Source code in src\pyvesync\devices\vesyncoutlet.py
display ↲
Inherited From VeSyncBaseDevice
Print formatted static device info to stdout.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
bool
|
If True, include state in display, defaults to True. |
True
|
Example:
Device Name:..................Living Room Lamp
Model:........................ESL100
Subdevice No:.................0
Type:.........................wifi
CID:..........................1234567890abcdef
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
displayJSON
deprecated
↲
Inherited From VeSyncBaseDevice
Deprecated
Use to_json() instead
Return JSON details for device. - Deprecated use to_json().
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
get_details
async
↲
Inherited From VeSyncOutlet10A
Get device details.
This method is defined in each device class to contain
the logic to pull the device state from the API and update
the device's state
attribute. The update()
method should
be called to update the device state.
Source code in src\pyvesync\devices\vesyncoutlet.py
get_monthly_energy
async
↲
Inherited From VeSyncOutlet
Build Monthly Energy History Dictionary.
The data is stored in the device.state.monthly_history
attribute
as a ResponseEnergyResult
object.
Source code in src\pyvesync\base_devices\outlet_base.py
get_state ↲
Inherited From VeSyncBaseDevice
Get device state attribute.
get_timer
async
↲
get_timer() -> Timer | None
Inherited From VeSyncBaseDevice
Get timer for device from API and set the state.Timer
attribute.
This may not be implemented for all devices. Please open an issue if there is an error.
Note
This method may not be implemented for all devices. Please open an issue if there is an error.
Source code in src\pyvesync\devices\vesyncoutlet.py
get_weekly_energy
async
↲
Inherited From VeSyncOutlet
Build weekly energy history dictionary.
The data is stored in the device.state.weekly_history
attribute
as a ResponseEnergyResult
object.
Source code in src\pyvesync\base_devices\outlet_base.py
get_yearly_energy
async
↲
Inherited From VeSyncOutlet
Build Yearly Energy Dictionary.
The data is stored in the device.state.yearly_history
attribute
as a ResponseEnergyResult
object.
Source code in src\pyvesync\base_devices\outlet_base.py
set_nightlight_auto
async
↲
Inherited From VeSyncOutlet
Set nightlight to auto mode.
Source code in src\pyvesync\base_devices\outlet_base.py
set_nightlight_state
async
↲
Inherited From VeSyncOutlet
Set nightlight mode.
Available nightlight states are found in the device.nightlight_modes
attribute.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mode
|
str
|
Nightlight mode to set. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if nightlight mode set successfully, False otherwise. |
Source code in src\pyvesync\base_devices\outlet_base.py
set_state ↲
Inherited From VeSyncBaseDevice
Set device state attribute.
set_timer
async
↲
Inherited From VeSyncBaseDevice
Set timer for device.
This may not be implemented for all devices. Please open an issue if there is an error.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
duration
|
int
|
Duration in seconds. |
required |
action
|
str | None
|
Action to take when timer expires. |
None
|
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if successful, False otherwise. |
Source code in src\pyvesync\devices\vesyncoutlet.py
to_dict ↲
Inherited From VeSyncBaseDevice
Return device information as a dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
bool
|
If True, include state in dictionary, defaults to True. |
True
|
Returns:
Type | Description |
---|---|
dict[str, Any]
|
dict[str, Any]: Dictionary containing device information. |
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
to_json ↲
Inherited From VeSyncBaseDevice
Print JSON API string for device details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
bool
|
If True, include state in JSON output, defaults to True. |
True
|
indent
|
bool
|
If True, indent JSON output, defaults to True. |
True
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
JSON formatted string of device details. |
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
to_jsonb ↲
Inherited From VeSyncBaseDevice
JSON API bytes for device details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
bool
|
If True, include state in JSON output, defaults to True. |
True
|
indent
|
bool
|
If True, indent JSON output, defaults to True. |
True
|
Returns:
Name | Type | Description |
---|---|---|
bytes |
bytes
|
JSON formatted bytes of device details. |
Example
This is an example without state.
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
toggle_switch
async
↲
Inherited From VeSyncOutlet10A
Toggle device power on or off.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
toggle
|
bool | None
|
True to turn on, False to turn off, None to toggle. |
None
|
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if successful, False otherwise. |
Source code in src\pyvesync\devices\vesyncoutlet.py
turn_off
async
↲
Inherited From VeSyncBaseToggleDevice
Turn device off.
turn_off_nightlight
async
↲
Inherited From VeSyncOutlet
Turn off nightlight if supported.
Source code in src\pyvesync\base_devices\outlet_base.py
turn_on
async
↲
Inherited From VeSyncBaseToggleDevice
Turn device on.
turn_on_nightlight
async
↲
Inherited From VeSyncOutlet
Turn on nightlight if supported.
Source code in src\pyvesync\base_devices\outlet_base.py
update
async
↲
Inherited From VeSyncBaseDevice
Update device details.
update_energy
async
↲
Inherited From VeSyncOutlet
Build weekly, monthly and yearly dictionaries.
pyvesync.devices.vesyncoutlet.VeSyncOutletBSDGO1 ↲
Bases: BypassV2Mixin
, VeSyncOutlet
VeSync BSDGO1 smart plug.
Note that this device does not support energy monitoring.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
details
|
ResponseDeviceDetailsModel
|
The device details. |
required |
manager
|
VeSync
|
The VeSync manager. |
required |
feature_map
|
OutletMap
|
The feature map for the device. |
required |
Attributes:
Name | Type | Description |
---|---|---|
state |
OutletState
|
The state of the outlet. |
last_response |
ResponseInfo
|
Last response from API call. |
device_status |
str
|
Device status. |
connection_status |
str
|
Connection status. |
manager |
VeSync
|
Manager object for API calls. |
device_name |
str
|
Name of device. |
device_image |
str
|
URL for device image. |
cid |
str
|
Device ID. |
connection_type |
str
|
Connection type of device. |
device_type |
str
|
Type of device. |
type |
str
|
Type of device. |
uuid |
str
|
UUID of device, not always present. |
config_module |
str
|
Configuration module of device. |
mac_id |
str
|
MAC ID of device. |
current_firm_version |
str
|
Current firmware version of device. |
device_region |
str
|
Region of device. (US, EU, etc.) |
pid |
str
|
Product ID of device, pulled by some devices on update. |
sub_device_no |
int
|
Sub-device number of device. |
product_type |
str
|
Product type of device. |
features |
dict
|
Features of device. |
Source code in src\pyvesync\devices\vesyncoutlet.py
Attributes↲
config_module
instance-attribute
↲
Inherited From VeSyncBaseDevice
connection_type
instance-attribute
↲
Inherited From VeSyncBaseDevice
current_firm_version
instance-attribute
↲
Inherited From VeSyncBaseDevice
device_image
instance-attribute
↲
Inherited From VeSyncBaseDevice
device_region
instance-attribute
↲
Inherited From VeSyncBaseDevice
firmware_update
property
↲
Inherited From VeSyncBaseDevice
Return True if firmware update available.
This is going to be updated.
last_response
instance-attribute
↲
last_response: ResponseInfo | None = None
Inherited From VeSyncBaseDevice
nightlight_modes
instance-attribute
↲
Inherited From VeSyncOutlet
request_keys
class-attribute
↲
request_keys: list[str] = [
'acceptLanguage',
'appVersion',
'phoneBrand',
'phoneOS',
'accountID',
'cid',
'configModule',
'debugMode',
'traceId',
'timeZone',
'token',
'userCountryCode',
'configModel',
'deviceId',
]
Inherited From BypassV2Mixin
state
instance-attribute
↲
state: OutletState = OutletState(self, details, feature_map)
Inherited From VeSyncBaseDevice
sub_device_no
instance-attribute
↲
Inherited From VeSyncBaseDevice
supports_energy
property
↲
Inherited From VeSyncOutlet
Return True if device supports energy.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if device supports energy, False otherwise. |
supports_nightlight
property
↲
Inherited From VeSyncOutlet
Return True if device supports nightlight.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if device supports nightlight, False otherwise. |
Functions↲
call_bypassv2_api
async
↲
call_bypassv2_api(
payload_method: str,
data: dict | None = None,
method: str = 'bypassV2',
endpoint: str = 'bypassV2',
) -> dict | None
Inherited From BypassV2Mixin
Send Bypass V2 API request.
This uses the _build_request
method to send API requests to the Bypass V2 API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
payload_method
|
str
|
The method to use in the payload dict. |
required |
data
|
dict | None
|
The data to send in the request. |
None
|
method
|
str
|
The method to use in the outer body. |
'bypassV2'
|
endpoint
|
str | None
|
The last part of the API url, defaults to
|
'bypassV2'
|
Returns:
Name | Type | Description |
---|---|---|
bytes |
dict | None
|
The response from the API request. |
Source code in src\pyvesync\utils\device_mixins.py
clear_timer
async
↲
Inherited From VeSyncBaseDevice
Clear timer for device from API.
This may not be implemented for all devices. Please open an issue if there is an error.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if successful, False otherwise. |
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
display ↲
Inherited From VeSyncBaseDevice
Print formatted static device info to stdout.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
bool
|
If True, include state in display, defaults to True. |
True
|
Example:
Device Name:..................Living Room Lamp
Model:........................ESL100
Subdevice No:.................0
Type:.........................wifi
CID:..........................1234567890abcdef
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
displayJSON
deprecated
↲
Inherited From VeSyncBaseDevice
Deprecated
Use to_json() instead
Return JSON details for device. - Deprecated use to_json().
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
get_details
async
↲
Inherited From VeSyncBaseDevice
Get device details.
This method is defined in each device class to contain
the logic to pull the device state from the API and update
the device's state
attribute. The update()
method should
be called to update the device state.
Source code in src\pyvesync\devices\vesyncoutlet.py
get_monthly_energy
async
↲
Inherited From VeSyncOutlet
Build Monthly Energy History Dictionary.
The data is stored in the device.state.monthly_history
attribute
as a ResponseEnergyResult
object.
Source code in src\pyvesync\base_devices\outlet_base.py
get_state ↲
Inherited From VeSyncBaseDevice
Get device state attribute.
get_timer
async
↲
get_timer() -> Timer | None
Inherited From VeSyncBaseDevice
Get timer for device from API and set the state.Timer
attribute.
This may not be implemented for all devices. Please open an issue if there is an error.
Note
This method may not be implemented for all devices. Please open an issue if there is an error.
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
get_weekly_energy
async
↲
Inherited From VeSyncOutlet
Build weekly energy history dictionary.
The data is stored in the device.state.weekly_history
attribute
as a ResponseEnergyResult
object.
Source code in src\pyvesync\base_devices\outlet_base.py
get_yearly_energy
async
↲
Inherited From VeSyncOutlet
Build Yearly Energy Dictionary.
The data is stored in the device.state.yearly_history
attribute
as a ResponseEnergyResult
object.
Source code in src\pyvesync\base_devices\outlet_base.py
set_nightlight_auto
async
↲
Inherited From VeSyncOutlet
Set nightlight to auto mode.
Source code in src\pyvesync\base_devices\outlet_base.py
set_nightlight_state
async
↲
Inherited From VeSyncOutlet
Set nightlight mode.
Available nightlight states are found in the device.nightlight_modes
attribute.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mode
|
str
|
Nightlight mode to set. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if nightlight mode set successfully, False otherwise. |
Source code in src\pyvesync\base_devices\outlet_base.py
set_state ↲
Inherited From VeSyncBaseDevice
Set device state attribute.
set_timer
async
↲
Inherited From VeSyncBaseDevice
Set timer for device.
This may not be implemented for all devices. Please open an issue if there is an error.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
duration
|
int
|
Duration in seconds. |
required |
action
|
str | None
|
Action to take when timer expires. |
None
|
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if successful, False otherwise. |
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
to_dict ↲
Inherited From VeSyncBaseDevice
Return device information as a dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
bool
|
If True, include state in dictionary, defaults to True. |
True
|
Returns:
Type | Description |
---|---|
dict[str, Any]
|
dict[str, Any]: Dictionary containing device information. |
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
to_json ↲
Inherited From VeSyncBaseDevice
Print JSON API string for device details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
bool
|
If True, include state in JSON output, defaults to True. |
True
|
indent
|
bool
|
If True, indent JSON output, defaults to True. |
True
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
JSON formatted string of device details. |
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
to_jsonb ↲
Inherited From VeSyncBaseDevice
JSON API bytes for device details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
bool
|
If True, include state in JSON output, defaults to True. |
True
|
indent
|
bool
|
If True, indent JSON output, defaults to True. |
True
|
Returns:
Name | Type | Description |
---|---|---|
bytes |
bytes
|
JSON formatted bytes of device details. |
Example
This is an example without state.
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
toggle_switch
async
↲
Inherited From VeSyncBaseToggleDevice
Toggle device power on or off.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
toggle
|
bool | None
|
True to turn on, False to turn off, None to toggle. |
None
|
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if successful, False otherwise. |
Source code in src\pyvesync\devices\vesyncoutlet.py
turn_off
async
↲
Inherited From VeSyncBaseToggleDevice
Turn device off.
turn_off_nightlight
async
↲
Inherited From VeSyncOutlet
Turn off nightlight if supported.
Source code in src\pyvesync\base_devices\outlet_base.py
turn_on
async
↲
Inherited From VeSyncBaseToggleDevice
Turn device on.
turn_on_nightlight
async
↲
Inherited From VeSyncOutlet
Turn on nightlight if supported.
Source code in src\pyvesync\base_devices\outlet_base.py
update
async
↲
Inherited From VeSyncBaseDevice
Update device details.
update_energy
async
↲
Inherited From VeSyncOutlet
Build weekly, monthly and yearly dictionaries.
pyvesync.base_devices.outlet_base.VeSyncOutlet ↲
Bases: VeSyncBaseToggleDevice
Base class for Etekcity Outlets.
State is stored in the state
attribute of the device.
This is only for holding state information and does not
contain any methods for controlling the device or retrieving
information from the API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
details
|
ResponseDeviceDetailsModel
|
The device details. |
required |
manager
|
VeSync
|
The VeSync manager. |
required |
feature_map
|
OutletMap
|
The feature map for the device. |
required |
Attributes:
Name | Type | Description |
---|---|---|
state |
OutletState
|
The state of the outlet. |
last_response |
ResponseInfo
|
Last response from API call. |
manager |
VeSync
|
Manager object for API calls. |
device_name |
str
|
Name of device. |
device_image |
str
|
URL for device image. |
cid |
str
|
Device ID. |
connection_type |
str
|
Connection type of device. |
device_type |
str
|
Type of device. |
type |
str
|
Type of device. |
uuid |
str
|
UUID of device, not always present. |
config_module |
str
|
Configuration module of device. |
mac_id |
str
|
MAC ID of device. |
current_firm_version |
str
|
Current firmware version of device. |
device_region |
str
|
Region of device. (US, EU, etc.) |
pid |
str
|
Product ID of device, pulled by some devices on update. |
sub_device_no |
int
|
Sub-device number of device. |
product_type |
str
|
Product type of device. |
features |
dict
|
Features of device. |
Source code in src\pyvesync\base_devices\outlet_base.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
|
Attributes↲
config_module
instance-attribute
↲
Inherited From VeSyncBaseDevice
connection_type
instance-attribute
↲
Inherited From VeSyncBaseDevice
current_firm_version
instance-attribute
↲
Inherited From VeSyncBaseDevice
device_image
instance-attribute
↲
Inherited From VeSyncBaseDevice
device_region
instance-attribute
↲
Inherited From VeSyncBaseDevice
firmware_update
property
↲
Inherited From VeSyncBaseDevice
Return True if firmware update available.
This is going to be updated.
last_response
instance-attribute
↲
last_response: ResponseInfo | None = None
Inherited From VeSyncBaseDevice
nightlight_modes
instance-attribute
↲
Inherited From VeSyncOutlet
state
instance-attribute
↲
state: OutletState = OutletState(self, details, feature_map)
Inherited From VeSyncBaseDevice
sub_device_no
instance-attribute
↲
Inherited From VeSyncBaseDevice
supports_energy
property
↲
Inherited From VeSyncOutlet
Return True if device supports energy.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if device supports energy, False otherwise. |
supports_nightlight
property
↲
Inherited From VeSyncOutlet
Return True if device supports nightlight.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if device supports nightlight, False otherwise. |
Functions↲
clear_timer
async
↲
Inherited From VeSyncBaseDevice
Clear timer for device from API.
This may not be implemented for all devices. Please open an issue if there is an error.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if successful, False otherwise. |
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
display ↲
Inherited From VeSyncBaseDevice
Print formatted static device info to stdout.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
bool
|
If True, include state in display, defaults to True. |
True
|
Example:
Device Name:..................Living Room Lamp
Model:........................ESL100
Subdevice No:.................0
Type:.........................wifi
CID:..........................1234567890abcdef
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
displayJSON
deprecated
↲
Inherited From VeSyncBaseDevice
Deprecated
Use to_json() instead
Return JSON details for device. - Deprecated use to_json().
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
get_details
abstractmethod
async
↲
Inherited From VeSyncBaseDevice
Get device details.
This method is defined in each device class to contain
the logic to pull the device state from the API and update
the device's state
attribute. The update()
method should
be called to update the device state.
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
get_monthly_energy
async
↲
Inherited From VeSyncOutlet
Build Monthly Energy History Dictionary.
The data is stored in the device.state.monthly_history
attribute
as a ResponseEnergyResult
object.
Source code in src\pyvesync\base_devices\outlet_base.py
get_state ↲
Inherited From VeSyncBaseDevice
Get device state attribute.
get_timer
async
↲
get_timer() -> Timer | None
Inherited From VeSyncBaseDevice
Get timer for device from API and set the state.Timer
attribute.
This may not be implemented for all devices. Please open an issue if there is an error.
Note
This method may not be implemented for all devices. Please open an issue if there is an error.
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
get_weekly_energy
async
↲
Inherited From VeSyncOutlet
Build weekly energy history dictionary.
The data is stored in the device.state.weekly_history
attribute
as a ResponseEnergyResult
object.
Source code in src\pyvesync\base_devices\outlet_base.py
get_yearly_energy
async
↲
Inherited From VeSyncOutlet
Build Yearly Energy Dictionary.
The data is stored in the device.state.yearly_history
attribute
as a ResponseEnergyResult
object.
Source code in src\pyvesync\base_devices\outlet_base.py
set_nightlight_auto
async
↲
Inherited From VeSyncOutlet
Set nightlight to auto mode.
Source code in src\pyvesync\base_devices\outlet_base.py
set_nightlight_state
async
↲
Inherited From VeSyncOutlet
Set nightlight mode.
Available nightlight states are found in the device.nightlight_modes
attribute.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mode
|
str
|
Nightlight mode to set. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if nightlight mode set successfully, False otherwise. |
Source code in src\pyvesync\base_devices\outlet_base.py
set_state ↲
Inherited From VeSyncBaseDevice
Set device state attribute.
set_timer
async
↲
Inherited From VeSyncBaseDevice
Set timer for device.
This may not be implemented for all devices. Please open an issue if there is an error.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
duration
|
int
|
Duration in seconds. |
required |
action
|
str | None
|
Action to take when timer expires. |
None
|
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if successful, False otherwise. |
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
to_dict ↲
Inherited From VeSyncBaseDevice
Return device information as a dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
bool
|
If True, include state in dictionary, defaults to True. |
True
|
Returns:
Type | Description |
---|---|
dict[str, Any]
|
dict[str, Any]: Dictionary containing device information. |
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
to_json ↲
Inherited From VeSyncBaseDevice
Print JSON API string for device details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
bool
|
If True, include state in JSON output, defaults to True. |
True
|
indent
|
bool
|
If True, indent JSON output, defaults to True. |
True
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
JSON formatted string of device details. |
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
to_jsonb ↲
Inherited From VeSyncBaseDevice
JSON API bytes for device details.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
bool
|
If True, include state in JSON output, defaults to True. |
True
|
indent
|
bool
|
If True, indent JSON output, defaults to True. |
True
|
Returns:
Name | Type | Description |
---|---|---|
bytes |
bytes
|
JSON formatted bytes of device details. |
Example
This is an example without state.
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
toggle_switch
abstractmethod
async
↲
Inherited From VeSyncBaseToggleDevice
Toggle device power on or off.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
toggle
|
bool | None
|
True to turn on, False to turn off, None to toggle. |
None
|
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if successful, False otherwise. |
Source code in src\pyvesync\base_devices\vesyncbasedevice.py
turn_off
async
↲
Inherited From VeSyncBaseToggleDevice
Turn device off.
turn_off_nightlight
async
↲
Inherited From VeSyncOutlet
Turn off nightlight if supported.
Source code in src\pyvesync\base_devices\outlet_base.py
turn_on
async
↲
Inherited From VeSyncBaseToggleDevice
Turn device on.
turn_on_nightlight
async
↲
Inherited From VeSyncOutlet
Turn on nightlight if supported.
Source code in src\pyvesync\base_devices\outlet_base.py
update
async
↲
Inherited From VeSyncBaseDevice
Update device details.
update_energy
async
↲
Inherited From VeSyncOutlet
Build weekly, monthly and yearly dictionaries.