Neato config flow (#26579)

* initial commit

* Minor changes

* add async setup entry

* Add translations and some other stuff

* add and remove entry

* use async_setup_entry

* Update config_flows.py

* dshokouhi's changes

* Improve workflow

* Add valid_vendors

* Add entity registry

* Add device registry

* Update entry from configuration.yaml

* Revert unneccesary changes

* Update .coveragerc

* Prepared tests

* Add dshokouhi and Santobert as codeowners

* Fix unload entry and abort when already_configured

* First tests

* Add test for abort cases

* Add test for invalid credentials on import

* Add one last test

* Add test_init.py with some tests

* Address reviews, part 1

* Update outdated entry

* await instead of add_job

* run IO inside an executor

* remove faulty test

* Fix pylint issues

* Move IO out of constructur

* Edit error translations

* Edit imports

* Minor changes

* Remove test for invalid vendor

* Async setup platform

* Edit login function

* Moved IO out if init

* Update switches after added to hass

* Revert update outdated entry

* try and update new entrys from config.yaml

* Add test invalid vendor

* Default to neato
This commit is contained in:
Santobert authored and Martin Hjelmare committed 2019-10-06 13:05:51 +02:00
1 parent 476f24e451
commit bd6bbcd5af
17 files changed
+691 -190

No files matched your search

+17 -3
View File
@@ -4,21 +4,30 @@ import logging
from homeassistant.components.camera import Camera
from . import NEATO_LOGIN, NEATO_MAP_DATA, NEATO_ROBOTS
from .const import NEATO_DOMAIN, NEATO_MAP_DATA, NEATO_ROBOTS, NEATO_LOGIN
_LOGGER = logging.getLogger(__name__)
SCAN_INTERVAL = timedelta(minutes=10)
def setup_platform(hass, config, add_entities, discovery_info=None):
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Neato Camera."""
pass
async def async_setup_entry(hass, entry, async_add_entities):
"""Set up Neato camera with config entry."""
dev = []
for robot in hass.data[NEATO_ROBOTS]:
if "maps" in robot.traits:
dev.append(NeatoCleaningMap(hass, robot))
if not dev:
return
_LOGGER.debug("Adding robots for cleaning maps %s", dev)
add_entities(dev, True)
async_add_entities(dev, True)
class NeatoCleaningMap(Camera):
@@ -61,3 +70,8 @@ class NeatoCleaningMap(Camera):
def unique_id(self):
"""Return unique ID."""
return self._robot_serial
@property
def device_info(self):
"""Device info for neato robot."""
return {"identifiers": {(NEATO_DOMAIN, self._robot_serial)}}