Resolves more code review comments
This commit is contained in:
@@ -122,7 +122,7 @@ class HCDevice:
|
||||
|
||||
# check if selected list with values is allowed
|
||||
if 'values' in feature:
|
||||
if isinstance(data['value'], int) == False:
|
||||
if isinstance(data['value'], int) is False:
|
||||
raise Exception(f"Unable to configure appliance. The value {data['value']} must be an integer. Allowed values are {feature['values']}.")
|
||||
value = str(data['value']) # values are strings in the feature list, but always seem to be an integer. An integer must be provided
|
||||
if value not in feature['values']:
|
||||
@@ -131,7 +131,7 @@ class HCDevice:
|
||||
if 'min' in feature:
|
||||
min = int(feature['min'])
|
||||
max = int(feature['max'])
|
||||
if isinstance(data['value'], int) == False or data['value'] < min or data['value'] > max:
|
||||
if isinstance(data['value'], int) is False or data['value'] < min or data['value'] > max:
|
||||
raise Exception(f"{self.name}. Unable to configure appliance. Value {data['value']} is not a valid value. The value must be an integer in the range {min} and {max}.")
|
||||
|
||||
return True
|
||||
@@ -174,7 +174,7 @@ class HCDevice:
|
||||
|
||||
if data is not None:
|
||||
if action == "POST":
|
||||
if self.test_feature(data) != True:
|
||||
if self.test_feature(data) is False:
|
||||
return
|
||||
msg["data"] = [data]
|
||||
else:
|
||||
|
||||
@@ -363,7 +363,7 @@ Example message published to `homeconnect/coffeemaker`:
|
||||
|
||||
## Posting to the appliance
|
||||
|
||||
Whereas the reading of de status is very beta, this is very very alpha. There is some basic error handling, but don't expect that everything will work.
|
||||
Whereas the reading of the status is very beta, this is very very alpha. There is some basic error handling, but don't expect that everything will work.
|
||||
|
||||
In your config file you can find items that contain `readWrite` or `writeOnly`, some of them contain values so you know what to provide, ie:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user