Skip to content

Commit

Permalink
Add some integration tests
Browse files Browse the repository at this point in the history
Fix the cover state
  • Loading branch information
gicamm committed Aug 13, 2024
1 parent bddbf26 commit 1ce7d60
Show file tree
Hide file tree
Showing 13 changed files with 1,240 additions and 20 deletions.
2 changes: 2 additions & 0 deletions custom_components/comelit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def setup(hass, config):
hass.helpers.discovery.load_platform('scene', DOMAIN, {}, config)
hass.helpers.discovery.load_platform('switch', DOMAIN, {}, config)
hass.helpers.discovery.load_platform('climate', DOMAIN, {}, config)
hub.start()
_LOGGER.info("Comelit SimpleHome integration started")

# Comelit Vedo
Expand All @@ -80,6 +81,7 @@ def setup(hass, config):
hass.data[DOMAIN]['vedo'] = vedo
hass.helpers.discovery.load_platform('binary_sensor', DOMAIN, {}, config)
hass.helpers.discovery.load_platform('alarm_control_panel', DOMAIN, {}, config)
vedo.start()
_LOGGER.info("Comelit Vedo integration started")

return True
2 changes: 1 addition & 1 deletion custom_components/comelit/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def open_cover(self, stopping=False, **kwargs):
_LOGGER.debug(f"Trying to OPEN cover {self.name}! _state={self._state}")
self._hub.cover_up(self._id)
if not stopping:
self._state == STATE_OPENING
self._state = STATE_OPENING
self.schedule_update_ha_state()

def close_cover(self, stopping=False, **kwargs):
Expand Down
6 changes: 4 additions & 2 deletions custom_components/comelit/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,10 @@ def __init__(self, client_name, hub_serial, hub_host, mqtt_port, mqtt_user, mqtt
self.client.username_pw_set(mqtt_user, mqtt_password)
self.client.connect(hub_host, mqtt_port, 45)
self.client.subscribe(self.topic_tx)
thread1 = StatusUpdater("Thread#1", self._scan_interval, self)
thread1.start()
self.status_thread = StatusUpdater("Thread#1", self._scan_interval, self)

def start(self):
self.status_thread.start()
self.client.loop_start()

def dispatch(self, payload):
Expand Down
6 changes: 4 additions & 2 deletions custom_components/comelit/vedo.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ def __init__(self, host, port, password, scan_interval, expose_bin_sensors):
self.port = port
self.password = password
self.expose_bin_sensors = expose_bin_sensors
thread1 = SensorUpdater("Thread#BS", scan_interval, self)
thread1.start()
self.vedo_updater = SensorUpdater("Thread#BS", scan_interval, self)

def start(self):
self.vedo_updater.start()

# Build the HTTP request
def build_http(self, headers, uid, path):
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-r requirements.txt
pytest-homeassistant-custom-component==0.13.153
pytest-asyncio
ruff
7 changes: 0 additions & 7 deletions test.py

This file was deleted.

Loading

0 comments on commit 1ce7d60

Please sign in to comment.