Skip to content

Commit

Permalink
Fix settings acess validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Author Name authored and Eran Kutner committed Mar 23, 2023
1 parent 4a64fcc commit 893331a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions custom_components/home_connect_alt/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"homekit": {},
"iot_class": "cloud_push",
"issue_tracker": "https://github.com/ekutner/home-connect-hass/issues",
"requirements": ["home-connect-async==0.7.7"],
"requirements": ["home-connect-async==0.7.8"],
"ssdp": [],
"version": "0.6.1-b3",
"version": "0.6.1-b4",
"zeroconf": []
}
4 changes: 2 additions & 2 deletions custom_components/home_connect_alt/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def add_appliance(appliance:Appliance) -> None:
if appliance.settings:
for setting in appliance.settings.values():
if ((not conf.has_entity_setting(setting.key, "type") and setting.type in number_types) or conf.has_entity_setting(setting.key, "type") in number_types) \
and "writ" in setting.access :
and setting.access != "read" :
device = SettingsNumber(appliance, setting.key, hc_obj=setting)
entity_manager.add(device)

Expand All @@ -42,7 +42,7 @@ def add_appliance(appliance:Appliance) -> None:
def remove_appliance(appliance:Appliance) -> None:
entity_manager.remove_appliance(appliance)

homeconnect.register_callback(add_appliance, [Events.PAIRED, Events.PROGRAM_SELECTED])
homeconnect.register_callback(add_appliance, [Events.PAIRED, Events.PROGRAM_SELECTED, Events.PROGRAM_STARTED ,Events.PROGRAM_FINISHED])
homeconnect.register_callback(remove_appliance, Events.DEPAIRED)
for appliance in homeconnect.appliances.values():
add_appliance(appliance)
Expand Down
4 changes: 2 additions & 2 deletions custom_components/home_connect_alt/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def add_appliance(appliance:Appliance) -> None:
if appliance.settings:
for setting in appliance.settings.values():
if (setting.allowedvalues and len(setting.allowedvalues)>1 and not is_boolean_enum(setting.allowedvalues)) \
and "writ" in setting.access :
and setting.access != "read" :
device = SettingsSelect(appliance, setting.key, conf)
entity_manager.add(device)

Expand All @@ -47,7 +47,7 @@ def add_appliance(appliance:Appliance) -> None:
def remove_appliance(appliance:Appliance) -> None:
entity_manager.remove_appliance(appliance)

homeconnect.register_callback(add_appliance, [Events.PAIRED, Events.PROGRAM_SELECTED])
homeconnect.register_callback(add_appliance, [Events.PAIRED, Events.PROGRAM_SELECTED, Events.PROGRAM_STARTED ,Events.PROGRAM_FINISHED])
homeconnect.register_callback(remove_appliance, Events.DEPAIRED)
for appliance in homeconnect.appliances.values():
add_appliance(appliance)
Expand Down
4 changes: 2 additions & 2 deletions custom_components/home_connect_alt/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def add_appliance(appliance:Appliance) -> None:
if ( (not conf.has_entity_setting(setting.key, "type")
and ( setting.type == "Boolean" or isinstance(setting.value, bool) or is_boolean_enum(setting.allowedvalues))) \
or conf.get_entity_setting(setting.key, "type") == "Boolean") \
and "writ" in setting.access :
and setting.access != "read" :
device = SettingsSwitch(appliance, setting.key, conf)
entity_manager.add(device)

Expand All @@ -47,7 +47,7 @@ def add_appliance(appliance:Appliance) -> None:
def remove_appliance(appliance:Appliance) -> None:
entity_manager.remove_appliance(appliance)

homeconnect.register_callback(add_appliance, [Events.PAIRED, Events.PROGRAM_SELECTED])
homeconnect.register_callback(add_appliance, [Events.PAIRED, Events.PROGRAM_SELECTED, Events.PROGRAM_STARTED ,Events.PROGRAM_FINISHED])
homeconnect.register_callback(remove_appliance, Events.DEPAIRED)
for appliance in homeconnect.appliances.values():
add_appliance(appliance)
Expand Down

0 comments on commit 893331a

Please sign in to comment.