Skip to content

Commit

Permalink
More 'async_dispatcher_send'->'dispatcher_send', 'async_dispatcher_co…
Browse files Browse the repository at this point in the history
…nnect'->'dispatcher_connect'
  • Loading branch information
ClusterM committed Jun 9, 2024
1 parent 00f4507 commit 36d6735
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions custom_components/skykettle/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from homeassistant.components.light import (ATTR_BRIGHTNESS, ATTR_RGB_COLOR,
ColorMode, LightEntity, LightEntityFeature)
from homeassistant.const import CONF_FRIENDLY_NAME, STATE_OFF
from homeassistant.helpers.dispatcher import (async_dispatcher_connect,
from homeassistant.helpers.dispatcher import (dispatcher_connect,
dispatcher_send)
from homeassistant.helpers.entity import EntityCategory

Expand Down Expand Up @@ -46,7 +46,7 @@ def __init__(self, hass, entry, light_type, n = 0):

async def async_added_to_hass(self):
self.update()
self.async_on_remove(async_dispatcher_connect(self.hass, DISPATCHER_UPDATE, self.update))
self.async_on_remove(dispatcher_connect(self.hass, DISPATCHER_UPDATE, self.update))

def update(self):
self.schedule_update_ha_state()
Expand Down
2 changes: 1 addition & 1 deletion custom_components/skykettle/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "SkyKettle",
"codeowners": ["@clusterm"],
"config_flow": true,
"dependencies": ["bluetooth_adapters"],
"dependencies": ["bluetooth"],
"documentation": "https://github.com/ClusterM/skykettle-ha/blob/master/README.md",
"iot_class": "local_polling",
"issue_tracker": "https://github.com/ClusterM/skykettle-ha/issues",
Expand Down
8 changes: 4 additions & 4 deletions custom_components/skykettle/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from homeassistant.components.number import NumberEntity, NumberMode
from homeassistant.const import (CONF_FRIENDLY_NAME, UnitOfTemperature,
UnitOfTime)
from homeassistant.helpers.dispatcher import (async_dispatcher_connect,
async_dispatcher_send)
from homeassistant.helpers.dispatcher import (dispatcher_connect,
dispatcher_send)
from homeassistant.helpers.entity import EntityCategory

from .const import *
Expand Down Expand Up @@ -47,7 +47,7 @@ def __init__(self, hass, entry, number_type):

async def async_added_to_hass(self):
self.update()
self.async_on_remove(async_dispatcher_connect(self.hass, DISPATCHER_UPDATE, self.update))
self.async_on_remove(dispatcher_connect(self.hass, DISPATCHER_UPDATE, self.update))

def update(self):
self.schedule_update_ha_state()
Expand Down Expand Up @@ -242,4 +242,4 @@ async def async_set_native_value(self, value):
await self.kettle.set_lamp_color_interval(value)
if self.number_type == NUMBER_LAMP_AUTO_OFF_HOURS:
await self.kettle.set_lamp_auto_off_hours(value)
self.hass.async_add_executor_job(async_dispatcher_send, self.hass, DISPATCHER_UPDATE)
self.hass.async_add_executor_job(dispatcher_send, self.hass, DISPATCHER_UPDATE)
4 changes: 2 additions & 2 deletions custom_components/skykettle/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
SensorStateClass)
from homeassistant.const import (CONF_FRIENDLY_NAME, PERCENTAGE, UnitOfEnergy,
UnitOfTime)
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.dispatcher import dispatcher_connect
from homeassistant.helpers.entity import EntityCategory

from .const import *
Expand Down Expand Up @@ -48,7 +48,7 @@ def __init__(self, hass, entry, sensor_type):

async def async_added_to_hass(self):
self.update()
self.async_on_remove(async_dispatcher_connect(self.hass, DISPATCHER_UPDATE, self.update))
self.async_on_remove(dispatcher_connect(self.hass, DISPATCHER_UPDATE, self.update))

def update(self):
self.schedule_update_ha_state()
Expand Down
10 changes: 5 additions & 5 deletions custom_components/skykettle/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

from homeassistant.components.switch import SwitchDeviceClass, SwitchEntity
from homeassistant.const import CONF_FRIENDLY_NAME
from homeassistant.helpers.dispatcher import (async_dispatcher_connect,
async_dispatcher_send)
from homeassistant.helpers.dispatcher import (dispatcher_connect,
dispatcher_send)
from homeassistant.helpers.entity import EntityCategory

from .const import *
Expand Down Expand Up @@ -44,7 +44,7 @@ def __init__(self, hass, entry, switch_type):

async def async_added_to_hass(self):
self.update()
self.async_on_remove(async_dispatcher_connect(self.hass, DISPATCHER_UPDATE, self.update))
self.async_on_remove(dispatcher_connect(self.hass, DISPATCHER_UPDATE, self.update))

def update(self):
self.schedule_update_ha_state()
Expand Down Expand Up @@ -140,7 +140,7 @@ async def async_turn_on(self, **kwargs):
await self.kettle.set_light_switch(SkyKettle.LIGHT_SYNC, True)
if self.switch_type == SWITCH_LIGHT_BOIL:
await self.kettle.set_light_switch(SkyKettle.LIGHT_BOIL, True)
self.hass.async_add_executor_job(async_dispatcher_send, self.hass, DISPATCHER_UPDATE)
self.hass.async_add_executor_job(dispatcher_send, self.hass, DISPATCHER_UPDATE)

async def async_turn_off(self, **kwargs):
"""Turn the switch off."""
Expand All @@ -152,4 +152,4 @@ async def async_turn_off(self, **kwargs):
await self.kettle.set_light_switch(SkyKettle.LIGHT_SYNC, False)
if self.switch_type == SWITCH_LIGHT_BOIL:
await self.kettle.set_light_switch(SkyKettle.LIGHT_BOIL, False)
self.hass.async_add_executor_job(async_dispatcher_send, self.hass, DISPATCHER_UPDATE)
self.hass.async_add_executor_job(dispatcher_send, self.hass, DISPATCHER_UPDATE)
10 changes: 5 additions & 5 deletions custom_components/skykettle/water_heater.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from homeassistant.const import (ATTR_SW_VERSION, ATTR_TEMPERATURE,
CONF_FRIENDLY_NAME, CONF_SCAN_INTERVAL,
STATE_OFF, UnitOfTemperature)
from homeassistant.helpers.dispatcher import (async_dispatcher_connect,
async_dispatcher_send)
from homeassistant.helpers.dispatcher import (dispatcher_connect,
dispatcher_send)

from .const import *
from .skykettle import SkyKettle
Expand All @@ -30,7 +30,7 @@ def __init__(self, hass, entry):

async def async_added_to_hass(self):
self.update()
self.async_on_remove(async_dispatcher_connect(self.hass, DISPATCHER_UPDATE, self.update))
self.async_on_remove(dispatcher_connect(self.hass, DISPATCHER_UPDATE, self.update))

def update(self):
self.schedule_update_ha_state()
Expand Down Expand Up @@ -175,9 +175,9 @@ async def async_set_temperature(self, **kwargs):
"""Set new target temperatures."""
target_temperature = kwargs.get(ATTR_TEMPERATURE)
await self.kettle.set_target_temp(target_temperature)
self.hass.async_add_executor_job(async_dispatcher_send, self.hass, DISPATCHER_UPDATE)
self.hass.async_add_executor_job(dispatcher_send, self.hass, DISPATCHER_UPDATE)

async def async_set_operation_mode(self, operation_mode):
"""Set new operation mode."""
await self.kettle.set_target_mode(operation_mode)
self.hass.async_add_executor_job(async_dispatcher_send, self.hass, DISPATCHER_UPDATE)
self.hass.async_add_executor_job(dispatcher_send, self.hass, DISPATCHER_UPDATE)

0 comments on commit 36d6735

Please sign in to comment.