Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Update mode, time, rssi and report_interval feature names/units #995

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,5 @@
True
>>> for feat in dev.features.values():
>>> print(f"{feat.name}: {feat.value}")
Device ID: 0000000000000000000000000000000000000000\nState: True\nSignal Level: 2\nRSSI: -52\nSSID: #MASKED_SSID#\nOverheated: False\nBrightness: 50\nCloud connection: True\nHSV: HSV(hue=0, saturation=100, value=50)\nColor temperature: 2700\nAuto update enabled: True\nUpdate available: False\nCurrent firmware version: 1.1.6 Build 240130 Rel.173828\nAvailable firmware version: 1.1.6 Build 240130 Rel.173828\nLight effect: Party\nLight preset: Light preset 1\nSmooth transition on: 2\nSmooth transition off: 2\nTime: 2024-02-23 02:40:15+01:00
Device ID: 0000000000000000000000000000000000000000\nState: True\nSignal Level: 2\nRSSI: -52\nSSID: #MASKED_SSID#\nOverheated: False\nBrightness: 50\nCloud connection: True\nHSV: HSV(hue=0, saturation=100, value=50)\nColor temperature: 2700\nAuto update enabled: True\nUpdate available: False\nCurrent firmware version: 1.1.6 Build 240130 Rel.173828\nAvailable firmware version: 1.1.6 Build 240130 Rel.173828\nLight effect: Party\nLight preset: Light preset 1\nSmooth transition on: 2\nSmooth transition off: 2\nDevice time: 2024-02-23 02:40:15+01:00
"""
2 changes: 1 addition & 1 deletion kasa/feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
Light preset (light_preset): Not set
Smooth transition on (smooth_transition_on): 2
Smooth transition off (smooth_transition_off): 2
Time (time): 2024-02-23 02:40:15+01:00
Device time (device_time): 2024-02-23 02:40:15+01:00

To see whether a device supports a feature, check for the existence of it:

Expand Down
1 change: 1 addition & 0 deletions kasa/iot/iotdevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ async def _initialize_features(self):
name="On since",
attribute_getter="on_since",
icon="mdi:clock",
category=Feature.Category.Info,
)
)

Expand Down
1 change: 1 addition & 0 deletions kasa/iot/iotstrip.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ async def _initialize_features(self):
name="On since",
attribute_getter="on_since",
icon="mdi:clock",
category=Feature.Category.Info,
)
)
for module in self._supported_modules.values():
Expand Down
1 change: 1 addition & 0 deletions kasa/smart/modules/reportmode.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def __init__(self, device: SmartDevice, module: str):
name="Report interval",
container=self,
attribute_getter="report_interval",
unit="s",
category=Feature.Category.Debug,
)
)
Expand Down
4 changes: 2 additions & 2 deletions kasa/smart/modules/temperaturecontrol.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ def __init__(self, device: SmartDevice, module: str):
self._add_feature(
Feature(
device,
id="mode",
name="Mode",
id="thermostat_mode",
name="Thermostat mode",
container=self,
attribute_getter="mode",
category=Feature.Category.Primary,
Expand Down
6 changes: 3 additions & 3 deletions kasa/smart/modules/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ def __init__(self, device: SmartDevice, module: str):
self._add_feature(
Feature(
device=device,
id="time",
name="Time",
id="device_time",
name="Device time",
attribute_getter="time",
container=self,
category=Feature.Category.Debug,
category=Feature.Category.Info,
)
)

Expand Down
3 changes: 2 additions & 1 deletion kasa/smart/smartdevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ async def _initialize_features(self):
name="RSSI",
attribute_getter=lambda x: x._info["rssi"],
icon="mdi:signal",
unit="dBm",
category=Feature.Category.Debug,
)
)
Expand Down Expand Up @@ -316,7 +317,7 @@ async def _initialize_features(self):
name="On since",
attribute_getter="on_since",
icon="mdi:clock",
category=Feature.Category.Info,
category=Feature.Category.Debug,
)
)

Expand Down
Loading