Conversation
| return self._mac | ||
|
|
||
| @property | ||
| def device_info(self): |
There was a problem hiding this comment.
This is only used when using a config entry. So remove it until that's added.
| def device_info(self): | ||
| """Return device specific attributes.""" | ||
| return { | ||
| "identifiers": {(DOMAIN, self.unique_id)}, |
There was a problem hiding this comment.
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, |
| "identifiers": {(DOMAIN, self.unique_id)}, | ||
| "name": self._name, | ||
| "manufacturer": DOMAIN, | ||
| "model": self.bulb_type, |
There was a problem hiding this comment.
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.
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() |
| raise PlatformNotReady() | ||
|
|
||
| add_entities([MyStromSwitch(name, host)]) | ||
| async_add_entities([MyStromSwitch(plug, name, plug.mac)]) |
There was a problem hiding this comment.
Why do we pass plug.mac to the class, if we also pass plug in?
There was a problem hiding this comment.
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.
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.
Remove this and re-introduce when a config flow is added.
|
|
||
| self._available = True | ||
| except MyStromConnectionError: | ||
| self.data = {"power": 0, "relay": False} |
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: