Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tijsverkoyen committed Jan 27, 2023
1 parent f8bfe50 commit 122ac3a
Show file tree
Hide file tree
Showing 35 changed files with 156 additions and 496 deletions.
25 changes: 10 additions & 15 deletions custom_components/nhc2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@

from .config_flow import Nhc2FlowHandler # noqa pylint_disable=unused-import
from .const import DOMAIN, KEY_GATEWAY, CONF_SWITCHES_AS_LIGHTS, BRAND
from .helpers import extract_versions
from .nhccoco.helpers import extract_versions

_LOGGER = logging.getLogger(__name__)

DOMAIN = DOMAIN
KEY_GATEWAY = KEY_GATEWAY

CONFIG_SCHEMA = vol.Schema({
DOMAIN: vol.Schema({
vol.Required(CONF_HOST): cv.string,
Expand Down Expand Up @@ -62,14 +59,15 @@ async def async_setup(hass, config):
FORWARD_PLATFORMS = (
"alarm_control_panel",
"binary_sensor",
"button",
"camera",
"climate",
"switch",
"light",
"fan",
"cover",
"sensor",
"button",
"fan",
"light",
"lock",
"sensor",
"switch",
)


Expand All @@ -91,9 +89,8 @@ async def on_hass_stop(event):
def get_process_sysinfo(dev_reg):
def process_sysinfo(nhc2_sysinfo):
coco_image, nhc_version = extract_versions(nhc2_sysinfo)
_LOGGER.debug('Sysinfo: NhcVersion %s - CocoImage %s',
nhc_version,
coco_image)
_LOGGER.debug('systeminfo.published: NhcVersion: %s - CocoImage %s', nhc_version, coco_image)

dev_reg.async_get_or_create(
config_entry_id=entry.entry_id,
connections=set(),
Expand All @@ -116,9 +113,7 @@ def process_sysinfo(nhc2_sysinfo):
hass.data.setdefault(KEY_GATEWAY, {})[entry.entry_id] = coco
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, on_hass_stop)

_LOGGER.debug('Connecting to %s with %s',
entry.data[CONF_HOST], entry.data[CONF_USERNAME]
)
_LOGGER.debug('Connecting to %s with %s', entry.data[CONF_HOST], entry.data[CONF_USERNAME])
coco.connect()
dev_reg = hass.helpers.device_registry.async_get(hass)
coco.get_systeminfo(get_process_sysinfo(dev_reg))
Expand Down
1 change: 0 additions & 1 deletion custom_components/nhc2/alarm_control_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from .const import DOMAIN, KEY_GATEWAY

KEY_GATEWAY = KEY_GATEWAY
KEY_ENTITY = 'nhc2_alarm_control_panels'

_LOGGER = logging.getLogger(__name__)
Expand Down
1 change: 0 additions & 1 deletion custom_components/nhc2/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

from .const import DOMAIN, KEY_GATEWAY

KEY_GATEWAY = KEY_GATEWAY
KEY_ENTITY = 'nhc2_binary_sensors'

_LOGGER = logging.getLogger(__name__)
Expand Down
1 change: 0 additions & 1 deletion custom_components/nhc2/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from .const import DOMAIN, KEY_GATEWAY

KEY_GATEWAY = KEY_GATEWAY
KEY_ENTITY = 'nhc2_buttons'

_LOGGER = logging.getLogger(__name__)
Expand Down
1 change: 0 additions & 1 deletion custom_components/nhc2/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from .const import DOMAIN, KEY_GATEWAY

KEY_GATEWAY = KEY_GATEWAY
KEY_ENTITY = 'nhc2_cameras'

_LOGGER = logging.getLogger(__name__)
Expand Down
1 change: 0 additions & 1 deletion custom_components/nhc2/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

from .const import DOMAIN, KEY_GATEWAY

KEY_GATEWAY = KEY_GATEWAY
KEY_ENTITY = 'nhc2_thermostats'

_LOGGER = logging.getLogger(__name__)
Expand Down
16 changes: 0 additions & 16 deletions custom_components/nhc2/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,8 @@
DOMAIN = 'nhc2'
KEY_GATEWAY = 'nhc2_gateway'
BRAND = 'Niko'
LIGHT = 'Light'
SWITCH = 'Switch'
COVER = 'Cover'
FAN = 'Fan'
CLIMATE = 'Thermostat'
ENERGY = 'CentralMeter'
BUTTON = 'Button'
SMARTPLUG = 'SmartPlug'
CONF_SWITCHES_AS_LIGHTS = 'switches_as_lights'
DEFAULT_PORT = 8883
KEY_MANUAL = 'MANUAL_IP_HOST'

ROLL_DOWN_SHUTTER = 'rolldownshutter'
SUN_BLIND = 'sunblind'
GATE = 'gate'
VENETIAN_BLIND = 'venetianblind'
GARAGE_DOOR = 'garagedoor'

SERVICE_SET_LIGHT_BRIGHTNESS = 'set_light_brightness'

ATTR_LIGHT_BRIGHTNESS = 'light_brightness'
1 change: 0 additions & 1 deletion custom_components/nhc2/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

from .const import DOMAIN, KEY_GATEWAY

KEY_GATEWAY = KEY_GATEWAY
KEY_ENTITY = 'nhc2_covers'

_LOGGER = logging.getLogger(__name__)
Expand Down
1 change: 0 additions & 1 deletion custom_components/nhc2/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from .const import DOMAIN, KEY_GATEWAY

KEY_GATEWAY = KEY_GATEWAY
KEY_ENTITY = 'nhc2_fans'

_LOGGER = logging.getLogger(__name__)
Expand Down
87 changes: 0 additions & 87 deletions custom_components/nhc2/helpers.py

This file was deleted.

1 change: 0 additions & 1 deletion custom_components/nhc2/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

from .const import DOMAIN, KEY_GATEWAY, SERVICE_SET_LIGHT_BRIGHTNESS, ATTR_LIGHT_BRIGHTNESS

KEY_GATEWAY = KEY_GATEWAY
KEY_ENTITY = 'nhc2_lights'

_LOGGER = logging.getLogger(__name__)
Expand Down
1 change: 0 additions & 1 deletion custom_components/nhc2/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from .const import DOMAIN, KEY_GATEWAY

KEY_GATEWAY = KEY_GATEWAY
KEY_ENTITY = 'nhc2_locks'

_LOGGER = logging.getLogger(__name__)
Expand Down
9 changes: 0 additions & 9 deletions custom_components/nhc2/nhccoco/__init__.py

This file was deleted.

Loading

0 comments on commit 122ac3a

Please sign in to comment.