Mill local access (#59549)

* Mill local

Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net>

* Mill local

Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net>

* Mill local

Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net>

* Update homeassistant/components/mill/config_flow.py

Co-authored-by: Allen Porter <allen@thebends.org>

* Update homeassistant/components/mill/config_flow.py

Co-authored-by: Allen Porter <allen@thebends.org>

* Update homeassistant/components/mill/config_flow.py

Co-authored-by: Allen Porter <allen@thebends.org>

* Fix review comments

Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net>

* coveragerc

Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net>

* Fix review comments

Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net>

* Fix review comments

Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net>

* Fix review comments

Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net>

Co-authored-by: Allen Porter <allen@thebends.org>
This commit is contained in:
Daniel Hjelseth Høyer 2021-11-19 06:44:45 +01:00 committed by GitHub
parent 406cbcfe2d
commit a3d5aec778
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 511 additions and 63 deletions

View file

@ -17,6 +17,7 @@ from homeassistant.components.sensor import (
from homeassistant.const import (
CONCENTRATION_PARTS_PER_BILLION,
CONCENTRATION_PARTS_PER_MILLION,
CONF_USERNAME,
ENERGY_KILO_WATT_HOUR,
ENTITY_CATEGORY_DIAGNOSTIC,
PERCENTAGE,
@ -28,11 +29,14 @@ from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .const import (
BATTERY,
CLOUD,
CONNECTION_TYPE,
CONSUMPTION_TODAY,
CONSUMPTION_YEAR,
DOMAIN,
ECO2,
HUMIDITY,
LOCAL,
MANUFACTURER,
TEMPERATURE,
TVOC,
@ -95,8 +99,10 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
async def async_setup_entry(hass, entry, async_add_entities):
"""Set up the Mill sensor."""
if entry.data.get(CONNECTION_TYPE) == LOCAL:
return
mill_data_coordinator = hass.data[DOMAIN]
mill_data_coordinator = hass.data[DOMAIN][CLOUD][entry.data[CONF_USERNAME]]
entities = [
MillSensor(