Rename [blueprint|Blueprint] -> [integration_blueprint|Integration blueprint] (#47)

This commit is contained in:
Joakim Sørensen
2020-11-15 00:30:14 +01:00
committed by GitHub
parent 668bd9d0bc
commit 8b3b9d380a
19 changed files with 309 additions and 307 deletions

View File

@ -0,0 +1,33 @@
"""BlueprintEntity class"""
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .const import DOMAIN, NAME, VERSION, ATTRIBUTION
class IntegrationBlueprintEntity(CoordinatorEntity):
def __init__(self, coordinator, config_entry):
super().__init__(coordinator)
self.config_entry = config_entry
@property
def unique_id(self):
"""Return a unique ID to use for this entity."""
return self.config_entry.entry_id
@property
def device_info(self):
return {
"identifiers": {(DOMAIN, self.unique_id)},
"name": NAME,
"model": VERSION,
"manufacturer": NAME,
}
@property
def device_state_attributes(self):
"""Return the state attributes."""
return {
"attribution": ATTRIBUTION,
"id": str(self.coordinator.data.get("id")),
"integration": DOMAIN,
}