-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
Move myStrom light and switch to async #34079
Conversation
return self._mac | ||
|
||
@property | ||
def device_info(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only used when using a config entry. So remove it until that's added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed for now.
def device_info(self): | ||
"""Return device specific attributes.""" | ||
return { | ||
"identifiers": {(DOMAIN, self.unique_id)}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you add it back, change this one to "connections": {(CONNECTION_MAC, self._mac)},
return { | ||
"identifiers": {(DOMAIN, self.unique_id)}, | ||
"name": self._name, | ||
"manufacturer": DOMAIN, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proper capitalize.
"identifiers": {(DOMAIN, self.unique_id)}, | ||
"name": self._name, | ||
"manufacturer": DOMAIN, | ||
"model": self.bulb_type, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be rgblamp
. I doubt it's called like that on their site. Maybe RGB Lamp or even something completely else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's not but that's what the API is returning. I will change that.
except MyStromConnectionError: | ||
_LOGGER.error("No route to device: %s", host) | ||
_LOGGER.error("No route to myStrom plug: %s", host) | ||
raise PlatformNotReady() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was missing from light
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it was.
raise PlatformNotReady() | ||
|
||
add_entities([MyStromSwitch(name, host)]) | ||
async_add_entities([MyStromSwitch(plug, name, plug.mac)]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we pass plug.mac
to the class, if we also pass plug
in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I thought that it would be more clear what's happening. Switched to use plug
.
self.firmware = self.plug.firmware | ||
self.consumption = self.plug.consumption |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why store this as instance variables instead of just returning it as self.plug.firmware
when needed?
return self.mac | ||
|
||
@property | ||
def device_info(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this and re-introduce when a config flow is added.
self.firmware = self.plug.firmware | ||
self.consumption = self.plug.consumption | ||
self.relay = self.plug.relay | ||
|
||
self._available = True | ||
except MyStromConnectionError: | ||
self.data = {"power": 0, "relay": False} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.data is not used ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
Proposed change
Type of change
Example entry for
configuration.yaml
:Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale: