Skip to content

Commit

Permalink
Fix: Fix setup of C100, no longer requires presets on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
JurajNyiri committed Oct 4, 2020
1 parent c6572b2 commit c63682b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion custom_components/tapo_control/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
AUTO_TRACK_MODE = "auto_track_mode"
DEFAULT_SCAN_INTERVAL = 10
ENTITY_CHAR_WHITELIST = set('abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_')
DEVICE_MODEL_C100 = "C100"
DEVICE_MODEL_C200 = "C200"
DEVICES_WITH_NO_PRESETS = [DEVICE_MODEL_C100]

CONFIG_SCHEMA = vol.Schema(
{
Expand Down Expand Up @@ -56,7 +59,8 @@ def update(event_time):
def manualUpdate(entity_id, tapoConnector):
basicInfo = tapoConnector.getBasicInfo()
attributes = basicInfo['device_info']['basic_info']
attributes['presets'] = tapoConnector.getPresets()
if(not basicInfo['device_info']['basic_info']['device_model'] in DEVICES_WITH_NO_PRESETS):
attributes['presets'] = tapoConnector.getPresets()
tapoData[entity_id] = {}
tapoData[entity_id]['state'] = "monitoring" # todo: better state
tapoData[entity_id]['attributes'] = attributes
Expand Down
2 changes: 1 addition & 1 deletion custom_components/tapo_control/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"dependencies": [],
"issue_tracker": "https://github.com/JurajNyiri/HomeAssistant-Tapo-Control/issues",
"codeowners": ["@JurajNyiri"],
"requirements": ["pytapo==0.8","unidecode"]
"requirements": ["pytapo==0.9","unidecode"]
}

0 comments on commit c63682b

Please sign in to comment.