Merge pull request #42836 from home-assistant/rc
This commit is contained in:
commit
7a96f8a4eb
12 changed files with 38 additions and 29 deletions
|
@ -34,6 +34,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
await coordinator.async_refresh()
|
await coordinator.async_refresh()
|
||||||
|
|
||||||
if not coordinator.last_update_success:
|
if not coordinator.last_update_success:
|
||||||
|
coordinator.shutdown()
|
||||||
raise ConfigEntryNotReady
|
raise ConfigEntryNotReady
|
||||||
|
|
||||||
hass.data.setdefault(DOMAIN, {})
|
hass.data.setdefault(DOMAIN, {})
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
"name": "Gree Climate",
|
"name": "Gree Climate",
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/gree",
|
"documentation": "https://www.home-assistant.io/integrations/gree",
|
||||||
"requirements": ["greeclimate==0.9.2"],
|
"requirements": ["greeclimate==0.9.5"],
|
||||||
"codeowners": ["@cmroche"]
|
"codeowners": ["@cmroche"]
|
||||||
}
|
}
|
|
@ -49,6 +49,9 @@ from .const import (
|
||||||
CONF_OFF_DELAY,
|
CONF_OFF_DELAY,
|
||||||
CONF_REMOVE_DEVICE,
|
CONF_REMOVE_DEVICE,
|
||||||
CONF_SIGNAL_REPETITIONS,
|
CONF_SIGNAL_REPETITIONS,
|
||||||
|
DATA_CLEANUP_CALLBACKS,
|
||||||
|
DATA_LISTENER,
|
||||||
|
DATA_RFXOBJECT,
|
||||||
DEVICE_PACKET_TYPE_LIGHTING4,
|
DEVICE_PACKET_TYPE_LIGHTING4,
|
||||||
EVENT_RFXTRX_EVENT,
|
EVENT_RFXTRX_EVENT,
|
||||||
SERVICE_SEND,
|
SERVICE_SEND,
|
||||||
|
@ -93,8 +96,6 @@ DATA_TYPES = OrderedDict(
|
||||||
)
|
)
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
DATA_RFXOBJECT = "rfxobject"
|
|
||||||
DATA_LISTENER = "ha_stop"
|
|
||||||
|
|
||||||
|
|
||||||
def _bytearray_string(data):
|
def _bytearray_string(data):
|
||||||
|
@ -188,6 +189,8 @@ async def async_setup_entry(hass, entry: config_entries.ConfigEntry):
|
||||||
"""Set up the RFXtrx component."""
|
"""Set up the RFXtrx component."""
|
||||||
hass.data.setdefault(DOMAIN, {})
|
hass.data.setdefault(DOMAIN, {})
|
||||||
|
|
||||||
|
hass.data[DOMAIN][DATA_CLEANUP_CALLBACKS] = []
|
||||||
|
|
||||||
await async_setup_internal(hass, entry)
|
await async_setup_internal(hass, entry)
|
||||||
|
|
||||||
for domain in DOMAINS:
|
for domain in DOMAINS:
|
||||||
|
@ -212,12 +215,17 @@ async def async_unload_entry(hass, entry: config_entries.ConfigEntry):
|
||||||
|
|
||||||
hass.services.async_remove(DOMAIN, SERVICE_SEND)
|
hass.services.async_remove(DOMAIN, SERVICE_SEND)
|
||||||
|
|
||||||
|
for cleanup_callback in hass.data[DOMAIN][DATA_CLEANUP_CALLBACKS]:
|
||||||
|
cleanup_callback()
|
||||||
|
|
||||||
listener = hass.data[DOMAIN][DATA_LISTENER]
|
listener = hass.data[DOMAIN][DATA_LISTENER]
|
||||||
listener()
|
listener()
|
||||||
|
|
||||||
rfx_object = hass.data[DOMAIN][DATA_RFXOBJECT]
|
rfx_object = hass.data[DOMAIN][DATA_RFXOBJECT]
|
||||||
await hass.async_add_executor_job(rfx_object.close_connection)
|
await hass.async_add_executor_job(rfx_object.close_connection)
|
||||||
|
|
||||||
|
hass.data.pop(DOMAIN)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -428,6 +436,14 @@ def get_device_id(device, data_bits=None):
|
||||||
return (f"{device.packettype:x}", f"{device.subtype:x}", id_string)
|
return (f"{device.packettype:x}", f"{device.subtype:x}", id_string)
|
||||||
|
|
||||||
|
|
||||||
|
def connect_auto_add(hass, entry_data, callback_fun):
|
||||||
|
"""Connect to dispatcher for automatic add."""
|
||||||
|
if entry_data[CONF_AUTOMATIC_ADD]:
|
||||||
|
hass.data[DOMAIN][DATA_CLEANUP_CALLBACKS].append(
|
||||||
|
hass.helpers.dispatcher.async_dispatcher_connect(SIGNAL_EVENT, callback_fun)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class RfxtrxEntity(RestoreEntity):
|
class RfxtrxEntity(RestoreEntity):
|
||||||
"""Represents a Rfxtrx device.
|
"""Represents a Rfxtrx device.
|
||||||
|
|
||||||
|
|
|
@ -19,11 +19,10 @@ from homeassistant.core import callback
|
||||||
from homeassistant.helpers import event as evt
|
from homeassistant.helpers import event as evt
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
CONF_AUTOMATIC_ADD,
|
|
||||||
CONF_DATA_BITS,
|
CONF_DATA_BITS,
|
||||||
CONF_OFF_DELAY,
|
CONF_OFF_DELAY,
|
||||||
SIGNAL_EVENT,
|
|
||||||
RfxtrxEntity,
|
RfxtrxEntity,
|
||||||
|
connect_auto_add,
|
||||||
find_possible_pt2262_device,
|
find_possible_pt2262_device,
|
||||||
get_device_id,
|
get_device_id,
|
||||||
get_pt2262_cmd,
|
get_pt2262_cmd,
|
||||||
|
@ -147,10 +146,7 @@ async def async_setup_entry(
|
||||||
async_add_entities([sensor])
|
async_add_entities([sensor])
|
||||||
|
|
||||||
# Subscribe to main RFXtrx events
|
# Subscribe to main RFXtrx events
|
||||||
if discovery_info[CONF_AUTOMATIC_ADD]:
|
connect_auto_add(hass, discovery_info, binary_sensor_update)
|
||||||
hass.helpers.dispatcher.async_dispatcher_connect(
|
|
||||||
SIGNAL_EVENT, binary_sensor_update
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class RfxtrxBinarySensor(RfxtrxEntity, BinarySensorEntity):
|
class RfxtrxBinarySensor(RfxtrxEntity, BinarySensorEntity):
|
||||||
|
|
|
@ -33,3 +33,7 @@ SERVICE_SEND = "send"
|
||||||
DEVICE_PACKET_TYPE_LIGHTING4 = 0x13
|
DEVICE_PACKET_TYPE_LIGHTING4 = 0x13
|
||||||
|
|
||||||
EVENT_RFXTRX_EVENT = "rfxtrx_event"
|
EVENT_RFXTRX_EVENT = "rfxtrx_event"
|
||||||
|
|
||||||
|
DATA_RFXOBJECT = "rfxobject"
|
||||||
|
DATA_LISTENER = "ha_stop"
|
||||||
|
DATA_CLEANUP_CALLBACKS = "cleanup_callbacks"
|
||||||
|
|
|
@ -6,12 +6,11 @@ from homeassistant.const import CONF_DEVICES, STATE_OPEN
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
CONF_AUTOMATIC_ADD,
|
|
||||||
CONF_DATA_BITS,
|
CONF_DATA_BITS,
|
||||||
CONF_SIGNAL_REPETITIONS,
|
CONF_SIGNAL_REPETITIONS,
|
||||||
DEFAULT_SIGNAL_REPETITIONS,
|
DEFAULT_SIGNAL_REPETITIONS,
|
||||||
SIGNAL_EVENT,
|
|
||||||
RfxtrxCommandEntity,
|
RfxtrxCommandEntity,
|
||||||
|
connect_auto_add,
|
||||||
get_device_id,
|
get_device_id,
|
||||||
get_rfx_object,
|
get_rfx_object,
|
||||||
)
|
)
|
||||||
|
@ -81,8 +80,7 @@ async def async_setup_entry(
|
||||||
async_add_entities([entity])
|
async_add_entities([entity])
|
||||||
|
|
||||||
# Subscribe to main RFXtrx events
|
# Subscribe to main RFXtrx events
|
||||||
if discovery_info[CONF_AUTOMATIC_ADD]:
|
connect_auto_add(hass, discovery_info, cover_update)
|
||||||
hass.helpers.dispatcher.async_dispatcher_connect(SIGNAL_EVENT, cover_update)
|
|
||||||
|
|
||||||
|
|
||||||
class RfxtrxCover(RfxtrxCommandEntity, CoverEntity):
|
class RfxtrxCover(RfxtrxCommandEntity, CoverEntity):
|
||||||
|
|
|
@ -12,12 +12,11 @@ from homeassistant.const import CONF_DEVICES, STATE_ON
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
CONF_AUTOMATIC_ADD,
|
|
||||||
CONF_DATA_BITS,
|
CONF_DATA_BITS,
|
||||||
CONF_SIGNAL_REPETITIONS,
|
CONF_SIGNAL_REPETITIONS,
|
||||||
DEFAULT_SIGNAL_REPETITIONS,
|
DEFAULT_SIGNAL_REPETITIONS,
|
||||||
SIGNAL_EVENT,
|
|
||||||
RfxtrxCommandEntity,
|
RfxtrxCommandEntity,
|
||||||
|
connect_auto_add,
|
||||||
get_device_id,
|
get_device_id,
|
||||||
get_rfx_object,
|
get_rfx_object,
|
||||||
)
|
)
|
||||||
|
@ -95,8 +94,7 @@ async def async_setup_entry(
|
||||||
async_add_entities([entity])
|
async_add_entities([entity])
|
||||||
|
|
||||||
# Subscribe to main RFXtrx events
|
# Subscribe to main RFXtrx events
|
||||||
if discovery_info[CONF_AUTOMATIC_ADD]:
|
connect_auto_add(hass, discovery_info, light_update)
|
||||||
hass.helpers.dispatcher.async_dispatcher_connect(SIGNAL_EVENT, light_update)
|
|
||||||
|
|
||||||
|
|
||||||
class RfxtrxLight(RfxtrxCommandEntity, LightEntity):
|
class RfxtrxLight(RfxtrxCommandEntity, LightEntity):
|
||||||
|
|
|
@ -20,11 +20,10 @@ from homeassistant.const import (
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
CONF_AUTOMATIC_ADD,
|
|
||||||
CONF_DATA_BITS,
|
CONF_DATA_BITS,
|
||||||
DATA_TYPES,
|
DATA_TYPES,
|
||||||
SIGNAL_EVENT,
|
|
||||||
RfxtrxEntity,
|
RfxtrxEntity,
|
||||||
|
connect_auto_add,
|
||||||
get_device_id,
|
get_device_id,
|
||||||
get_rfx_object,
|
get_rfx_object,
|
||||||
)
|
)
|
||||||
|
@ -127,8 +126,7 @@ async def async_setup_entry(
|
||||||
async_add_entities([entity])
|
async_add_entities([entity])
|
||||||
|
|
||||||
# Subscribe to main RFXtrx events
|
# Subscribe to main RFXtrx events
|
||||||
if discovery_info[CONF_AUTOMATIC_ADD]:
|
connect_auto_add(hass, discovery_info, sensor_update)
|
||||||
hass.helpers.dispatcher.async_dispatcher_connect(SIGNAL_EVENT, sensor_update)
|
|
||||||
|
|
||||||
|
|
||||||
class RfxtrxSensor(RfxtrxEntity):
|
class RfxtrxSensor(RfxtrxEntity):
|
||||||
|
|
|
@ -8,13 +8,12 @@ from homeassistant.const import CONF_DEVICES, STATE_ON
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
CONF_AUTOMATIC_ADD,
|
|
||||||
CONF_DATA_BITS,
|
CONF_DATA_BITS,
|
||||||
CONF_SIGNAL_REPETITIONS,
|
CONF_SIGNAL_REPETITIONS,
|
||||||
DEFAULT_SIGNAL_REPETITIONS,
|
DEFAULT_SIGNAL_REPETITIONS,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
SIGNAL_EVENT,
|
|
||||||
RfxtrxCommandEntity,
|
RfxtrxCommandEntity,
|
||||||
|
connect_auto_add,
|
||||||
get_device_id,
|
get_device_id,
|
||||||
get_rfx_object,
|
get_rfx_object,
|
||||||
)
|
)
|
||||||
|
@ -92,8 +91,7 @@ async def async_setup_entry(
|
||||||
async_add_entities([entity])
|
async_add_entities([entity])
|
||||||
|
|
||||||
# Subscribe to main RFXtrx events
|
# Subscribe to main RFXtrx events
|
||||||
if discovery_info[CONF_AUTOMATIC_ADD]:
|
connect_auto_add(hass, discovery_info, switch_update)
|
||||||
hass.helpers.dispatcher.async_dispatcher_connect(SIGNAL_EVENT, switch_update)
|
|
||||||
|
|
||||||
|
|
||||||
class RfxtrxSwitch(RfxtrxCommandEntity, SwitchEntity):
|
class RfxtrxSwitch(RfxtrxCommandEntity, SwitchEntity):
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""Constants used by Home Assistant components."""
|
"""Constants used by Home Assistant components."""
|
||||||
MAJOR_VERSION = 0
|
MAJOR_VERSION = 0
|
||||||
MINOR_VERSION = 117
|
MINOR_VERSION = 117
|
||||||
PATCH_VERSION = "3"
|
PATCH_VERSION = "4"
|
||||||
__short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}"
|
__short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}"
|
||||||
__version__ = f"{__short_version__}.{PATCH_VERSION}"
|
__version__ = f"{__short_version__}.{PATCH_VERSION}"
|
||||||
REQUIRED_PYTHON_VER = (3, 7, 1)
|
REQUIRED_PYTHON_VER = (3, 7, 1)
|
||||||
|
|
|
@ -696,7 +696,7 @@ gpiozero==1.5.1
|
||||||
gps3==0.33.3
|
gps3==0.33.3
|
||||||
|
|
||||||
# homeassistant.components.gree
|
# homeassistant.components.gree
|
||||||
greeclimate==0.9.2
|
greeclimate==0.9.5
|
||||||
|
|
||||||
# homeassistant.components.greeneye_monitor
|
# homeassistant.components.greeneye_monitor
|
||||||
greeneye_monitor==2.1
|
greeneye_monitor==2.1
|
||||||
|
|
|
@ -352,7 +352,7 @@ google-cloud-pubsub==0.39.1
|
||||||
google-nest-sdm==0.1.6
|
google-nest-sdm==0.1.6
|
||||||
|
|
||||||
# homeassistant.components.gree
|
# homeassistant.components.gree
|
||||||
greeclimate==0.9.2
|
greeclimate==0.9.5
|
||||||
|
|
||||||
# homeassistant.components.griddy
|
# homeassistant.components.griddy
|
||||||
griddypower==0.1.0
|
griddypower==0.1.0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue