-
Notifications
You must be signed in to change notification settings - Fork 41
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
Add ConfigFlow and DeviceInfo #174
Conversation
@@ -113,6 +114,8 @@ async def RunDocker(hass: HomeAssistant, entry: ConfigType) -> None: | |||
try: | |||
hass.data[DOMAIN][entry[CONF_NAME]][API] = DockerAPI(hass, entry) | |||
await hass.data[DOMAIN][entry[CONF_NAME]][API].init(startCount) | |||
await hass.data[DOMAIN][entry[CONF_NAME]][API].run() | |||
await hass.data[DOMAIN][entry[CONF_NAME]][API].load() |
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.
Maybe "load_entities"?
The split is done so that:
- init: creates the connection to docker host and retrieves the data, once (only want the list of containers to select from during set-up)
- run: start the continuous monitoring (don't want this during configuration)
- load: setups the entities (config_entry have to create entities a slightly different way)
I just created a new branch config_flow, can you create a pull request against this one? I like to keep the master without config_flow, and test config_flow a bit more - before releasing it to the public. |
DOCKER_SCHEMA = vol.Schema( | ||
{ | ||
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, | ||
vol.Optional(CONF_PREFIX, default=""): cv.string, | ||
vol.Optional(CONF_URL, default=None): vol.Any(cv.string, None), | ||
vol.Optional(CONF_SCAN_INTERVAL, default=DEFAULT_SCAN_INTERVAL): cv.time_period, |
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.
timedelta is not natively serializable and can only store serialized data in config_entry.
could create a a de-serializer on reading entry but is still used as int in API
Could be a good idea, I swapped target-branch in this PR. |
# @property | ||
# def entity_id(self) -> str: | ||
# """Return the entity id of the sensor.""" | ||
# return self._entity_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.
With removal of this and the change to set _attr_unique_id instead of _entity_id I would fear that the config-parameter rename_entity
becomes obsolete, but was necessary since the device_registry seem to need controll over the entity naming. Could be solved by setting self_entity_id (instead of self._entity_id) and hence making it a public read/write property.
At current state it is ready enough to start trying it. |
Ok, i have merged it into the new branch. I will also do some testing in the weekend :-) thanks 👍 |
Fixing #173 and #172