mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 22:57:17 +00:00
Merge pull request #42624 from home-assistant/rc
This commit is contained in:
commit
e902cfcbf0
@ -320,6 +320,16 @@ class DerivativeDSMREntity(DSMREntity):
|
|||||||
"""Return the calculated current hourly rate."""
|
"""Return the calculated current hourly rate."""
|
||||||
return self._state
|
return self._state
|
||||||
|
|
||||||
|
@property
|
||||||
|
def force_update(self):
|
||||||
|
"""Disable force update."""
|
||||||
|
return False
|
||||||
|
|
||||||
|
@property
|
||||||
|
def should_poll(self):
|
||||||
|
"""Enable polling."""
|
||||||
|
return True
|
||||||
|
|
||||||
async def async_update(self):
|
async def async_update(self):
|
||||||
"""Recalculate hourly rate if timestamp has changed.
|
"""Recalculate hourly rate if timestamp has changed.
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"domain": "frontend",
|
"domain": "frontend",
|
||||||
"name": "Home Assistant Frontend",
|
"name": "Home Assistant Frontend",
|
||||||
"documentation": "https://www.home-assistant.io/integrations/frontend",
|
"documentation": "https://www.home-assistant.io/integrations/frontend",
|
||||||
"requirements": ["home-assistant-frontend==20201021.3"],
|
"requirements": ["home-assistant-frontend==20201021.4"],
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"api",
|
"api",
|
||||||
"auth",
|
"auth",
|
||||||
|
@ -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.0"],
|
"requirements": ["greeclimate==0.9.2"],
|
||||||
"codeowners": ["@cmroche"]
|
"codeowners": ["@cmroche"]
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/homekit_controller",
|
"documentation": "https://www.home-assistant.io/integrations/homekit_controller",
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"aiohomekit==0.2.53"
|
"aiohomekit==0.2.54"
|
||||||
],
|
],
|
||||||
"zeroconf": [
|
"zeroconf": [
|
||||||
"_hap._tcp.local."
|
"_hap._tcp.local."
|
||||||
|
@ -252,7 +252,7 @@ class MqttLightTemplate(
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
_LOGGER.warning("Invalid color value received")
|
_LOGGER.warning("Invalid color value received")
|
||||||
|
|
||||||
if self._templates[CONF_COLOR_TEMP_TEMPLATE] is not None:
|
if self._templates[CONF_WHITE_VALUE_TEMPLATE] is not None:
|
||||||
try:
|
try:
|
||||||
self._white_value = int(
|
self._white_value = int(
|
||||||
self._templates[
|
self._templates[
|
||||||
|
@ -263,10 +263,10 @@ class RMVDepartureData:
|
|||||||
if not dest_found:
|
if not dest_found:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
elif self._lines and journey["number"] not in self._lines:
|
if self._lines and journey["number"] not in self._lines:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
elif journey["minutes"] < self._time_offset:
|
if journey["minutes"] < self._time_offset:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
for attr in ["direction", "departure_time", "product", "minutes"]:
|
for attr in ["direction", "departure_time", "product", "minutes"]:
|
||||||
|
@ -275,7 +275,6 @@ def _login_and_fetch_syno_info(api, otp_code):
|
|||||||
if (
|
if (
|
||||||
not api.information.serial
|
not api.information.serial
|
||||||
or api.utilisation.cpu_user_load is None
|
or api.utilisation.cpu_user_load is None
|
||||||
or not api.storage.disks_ids
|
|
||||||
or not api.storage.volumes_ids
|
or not api.storage.volumes_ids
|
||||||
or not api.network.macs
|
or not api.network.macs
|
||||||
):
|
):
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"name": "Tasmota (beta)",
|
"name": "Tasmota (beta)",
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/tasmota",
|
"documentation": "https://www.home-assistant.io/integrations/tasmota",
|
||||||
"requirements": ["hatasmota==0.0.24"],
|
"requirements": ["hatasmota==0.0.25"],
|
||||||
"dependencies": ["mqtt"],
|
"dependencies": ["mqtt"],
|
||||||
"mqtt": ["tasmota/discovery/#"],
|
"mqtt": ["tasmota/discovery/#"],
|
||||||
"codeowners": ["@emontnemery"]
|
"codeowners": ["@emontnemery"]
|
||||||
|
@ -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 = "0"
|
PATCH_VERSION = "1"
|
||||||
__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)
|
||||||
|
@ -13,7 +13,7 @@ defusedxml==0.6.0
|
|||||||
distro==1.5.0
|
distro==1.5.0
|
||||||
emoji==0.5.4
|
emoji==0.5.4
|
||||||
hass-nabucasa==0.37.1
|
hass-nabucasa==0.37.1
|
||||||
home-assistant-frontend==20201021.3
|
home-assistant-frontend==20201021.4
|
||||||
httpx==0.16.1
|
httpx==0.16.1
|
||||||
importlib-metadata==1.6.0;python_version<'3.8'
|
importlib-metadata==1.6.0;python_version<'3.8'
|
||||||
jinja2>=2.11.2
|
jinja2>=2.11.2
|
||||||
|
@ -178,7 +178,7 @@ aioguardian==1.0.1
|
|||||||
aioharmony==0.2.6
|
aioharmony==0.2.6
|
||||||
|
|
||||||
# homeassistant.components.homekit_controller
|
# homeassistant.components.homekit_controller
|
||||||
aiohomekit==0.2.53
|
aiohomekit==0.2.54
|
||||||
|
|
||||||
# homeassistant.components.emulated_hue
|
# homeassistant.components.emulated_hue
|
||||||
# homeassistant.components.http
|
# homeassistant.components.http
|
||||||
@ -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.0
|
greeclimate==0.9.2
|
||||||
|
|
||||||
# homeassistant.components.greeneye_monitor
|
# homeassistant.components.greeneye_monitor
|
||||||
greeneye_monitor==2.1
|
greeneye_monitor==2.1
|
||||||
@ -732,7 +732,7 @@ hass-nabucasa==0.37.1
|
|||||||
hass_splunk==0.1.1
|
hass_splunk==0.1.1
|
||||||
|
|
||||||
# homeassistant.components.tasmota
|
# homeassistant.components.tasmota
|
||||||
hatasmota==0.0.24
|
hatasmota==0.0.25
|
||||||
|
|
||||||
# homeassistant.components.jewish_calendar
|
# homeassistant.components.jewish_calendar
|
||||||
hdate==0.9.12
|
hdate==0.9.12
|
||||||
@ -759,7 +759,7 @@ hole==0.5.1
|
|||||||
holidays==0.10.3
|
holidays==0.10.3
|
||||||
|
|
||||||
# homeassistant.components.frontend
|
# homeassistant.components.frontend
|
||||||
home-assistant-frontend==20201021.3
|
home-assistant-frontend==20201021.4
|
||||||
|
|
||||||
# homeassistant.components.zwave
|
# homeassistant.components.zwave
|
||||||
homeassistant-pyozw==0.1.10
|
homeassistant-pyozw==0.1.10
|
||||||
|
@ -109,7 +109,7 @@ aioguardian==1.0.1
|
|||||||
aioharmony==0.2.6
|
aioharmony==0.2.6
|
||||||
|
|
||||||
# homeassistant.components.homekit_controller
|
# homeassistant.components.homekit_controller
|
||||||
aiohomekit==0.2.53
|
aiohomekit==0.2.54
|
||||||
|
|
||||||
# homeassistant.components.emulated_hue
|
# homeassistant.components.emulated_hue
|
||||||
# homeassistant.components.http
|
# homeassistant.components.http
|
||||||
@ -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.0
|
greeclimate==0.9.2
|
||||||
|
|
||||||
# homeassistant.components.griddy
|
# homeassistant.components.griddy
|
||||||
griddypower==0.1.0
|
griddypower==0.1.0
|
||||||
@ -367,7 +367,7 @@ hangups==0.4.11
|
|||||||
hass-nabucasa==0.37.1
|
hass-nabucasa==0.37.1
|
||||||
|
|
||||||
# homeassistant.components.tasmota
|
# homeassistant.components.tasmota
|
||||||
hatasmota==0.0.24
|
hatasmota==0.0.25
|
||||||
|
|
||||||
# homeassistant.components.jewish_calendar
|
# homeassistant.components.jewish_calendar
|
||||||
hdate==0.9.12
|
hdate==0.9.12
|
||||||
@ -385,7 +385,7 @@ hole==0.5.1
|
|||||||
holidays==0.10.3
|
holidays==0.10.3
|
||||||
|
|
||||||
# homeassistant.components.frontend
|
# homeassistant.components.frontend
|
||||||
home-assistant-frontend==20201021.3
|
home-assistant-frontend==20201021.4
|
||||||
|
|
||||||
# homeassistant.components.zwave
|
# homeassistant.components.zwave
|
||||||
homeassistant-pyozw==0.1.10
|
homeassistant-pyozw==0.1.10
|
||||||
|
@ -61,22 +61,23 @@ async def test_websocket_core_update(hass, client):
|
|||||||
assert hass.config.external_url != "https://www.example.com"
|
assert hass.config.external_url != "https://www.example.com"
|
||||||
assert hass.config.internal_url != "http://example.com"
|
assert hass.config.internal_url != "http://example.com"
|
||||||
|
|
||||||
await client.send_json(
|
with patch("homeassistant.util.dt.set_default_time_zone") as mock_set_tz:
|
||||||
{
|
await client.send_json(
|
||||||
"id": 5,
|
{
|
||||||
"type": "config/core/update",
|
"id": 5,
|
||||||
"latitude": 60,
|
"type": "config/core/update",
|
||||||
"longitude": 50,
|
"latitude": 60,
|
||||||
"elevation": 25,
|
"longitude": 50,
|
||||||
"location_name": "Huis",
|
"elevation": 25,
|
||||||
CONF_UNIT_SYSTEM: CONF_UNIT_SYSTEM_IMPERIAL,
|
"location_name": "Huis",
|
||||||
"time_zone": "America/New_York",
|
CONF_UNIT_SYSTEM: CONF_UNIT_SYSTEM_IMPERIAL,
|
||||||
"external_url": "https://www.example.com",
|
"time_zone": "America/New_York",
|
||||||
"internal_url": "http://example.local",
|
"external_url": "https://www.example.com",
|
||||||
}
|
"internal_url": "http://example.local",
|
||||||
)
|
}
|
||||||
|
)
|
||||||
|
|
||||||
msg = await client.receive_json()
|
msg = await client.receive_json()
|
||||||
|
|
||||||
assert msg["id"] == 5
|
assert msg["id"] == 5
|
||||||
assert msg["type"] == TYPE_RESULT
|
assert msg["type"] == TYPE_RESULT
|
||||||
@ -86,11 +87,11 @@ async def test_websocket_core_update(hass, client):
|
|||||||
assert hass.config.elevation == 25
|
assert hass.config.elevation == 25
|
||||||
assert hass.config.location_name == "Huis"
|
assert hass.config.location_name == "Huis"
|
||||||
assert hass.config.units.name == CONF_UNIT_SYSTEM_IMPERIAL
|
assert hass.config.units.name == CONF_UNIT_SYSTEM_IMPERIAL
|
||||||
assert hass.config.time_zone.zone == "America/New_York"
|
|
||||||
assert hass.config.external_url == "https://www.example.com"
|
assert hass.config.external_url == "https://www.example.com"
|
||||||
assert hass.config.internal_url == "http://example.local"
|
assert hass.config.internal_url == "http://example.local"
|
||||||
|
|
||||||
dt_util.set_default_time_zone(ORIG_TIME_ZONE)
|
assert len(mock_set_tz.mock_calls) == 1
|
||||||
|
assert mock_set_tz.mock_calls[0][1][0].zone == "America/New_York"
|
||||||
|
|
||||||
|
|
||||||
async def test_websocket_core_update_not_admin(hass, hass_ws_client, hass_admin_user):
|
async def test_websocket_core_update_not_admin(hass, hass_ws_client, hass_admin_user):
|
||||||
|
@ -186,7 +186,8 @@ async def test_setup_core_push_timezone(hass, aioclient_mock):
|
|||||||
assert aioclient_mock.call_count == 7
|
assert aioclient_mock.call_count == 7
|
||||||
assert aioclient_mock.mock_calls[2][2]["timezone"] == "testzone"
|
assert aioclient_mock.mock_calls[2][2]["timezone"] == "testzone"
|
||||||
|
|
||||||
await hass.config.async_update(time_zone="America/New_York")
|
with patch("homeassistant.util.dt.set_default_time_zone"):
|
||||||
|
await hass.config.async_update(time_zone="America/New_York")
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
assert aioclient_mock.mock_calls[-1][2]["timezone"] == "America/New_York"
|
assert aioclient_mock.mock_calls[-1][2]["timezone"] == "America/New_York"
|
||||||
|
|
||||||
|
@ -74,7 +74,6 @@ async def test_if_fires_using_at_input_datetime(hass, calls, has_date, has_time)
|
|||||||
"input_datetime",
|
"input_datetime",
|
||||||
{"input_datetime": {"trigger": {"has_date": has_date, "has_time": has_time}}},
|
{"input_datetime": {"trigger": {"has_date": has_date, "has_time": has_time}}},
|
||||||
)
|
)
|
||||||
|
|
||||||
now = dt_util.now()
|
now = dt_util.now()
|
||||||
|
|
||||||
trigger_dt = now.replace(
|
trigger_dt = now.replace(
|
||||||
|
@ -81,6 +81,20 @@ def mock_controller_service_2sa():
|
|||||||
yield service_mock
|
yield service_mock
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(name="service_vdsm")
|
||||||
|
def mock_controller_service_vdsm():
|
||||||
|
"""Mock a successful service."""
|
||||||
|
with patch(
|
||||||
|
"homeassistant.components.synology_dsm.config_flow.SynologyDSM"
|
||||||
|
) as service_mock:
|
||||||
|
service_mock.return_value.information.serial = SERIAL
|
||||||
|
service_mock.return_value.utilisation.cpu_user_load = 1
|
||||||
|
service_mock.return_value.storage.disks_ids = []
|
||||||
|
service_mock.return_value.storage.volumes_ids = ["volume_1"]
|
||||||
|
service_mock.return_value.network.macs = MACS
|
||||||
|
yield service_mock
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(name="service_failed")
|
@pytest.fixture(name="service_failed")
|
||||||
def mock_controller_service_failed():
|
def mock_controller_service_failed():
|
||||||
"""Mock a failed service."""
|
"""Mock a failed service."""
|
||||||
@ -196,6 +210,40 @@ async def test_user_2sa(hass: HomeAssistantType, service_2sa: MagicMock):
|
|||||||
assert result["data"].get(CONF_VOLUMES) is None
|
assert result["data"].get(CONF_VOLUMES) is None
|
||||||
|
|
||||||
|
|
||||||
|
async def test_user_vdsm(hass: HomeAssistantType, service_vdsm: MagicMock):
|
||||||
|
"""Test user config."""
|
||||||
|
result = await hass.config_entries.flow.async_init(
|
||||||
|
DOMAIN, context={"source": SOURCE_USER}, data=None
|
||||||
|
)
|
||||||
|
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||||
|
assert result["step_id"] == "user"
|
||||||
|
|
||||||
|
# test with all provided
|
||||||
|
result = await hass.config_entries.flow.async_init(
|
||||||
|
DOMAIN,
|
||||||
|
context={"source": SOURCE_USER},
|
||||||
|
data={
|
||||||
|
CONF_HOST: HOST,
|
||||||
|
CONF_PORT: PORT,
|
||||||
|
CONF_SSL: SSL,
|
||||||
|
CONF_USERNAME: USERNAME,
|
||||||
|
CONF_PASSWORD: PASSWORD,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||||
|
assert result["result"].unique_id == SERIAL
|
||||||
|
assert result["title"] == HOST
|
||||||
|
assert result["data"][CONF_HOST] == HOST
|
||||||
|
assert result["data"][CONF_PORT] == PORT
|
||||||
|
assert result["data"][CONF_SSL] == SSL
|
||||||
|
assert result["data"][CONF_USERNAME] == USERNAME
|
||||||
|
assert result["data"][CONF_PASSWORD] == PASSWORD
|
||||||
|
assert result["data"][CONF_MAC] == MACS
|
||||||
|
assert result["data"].get("device_token") is None
|
||||||
|
assert result["data"].get(CONF_DISKS) is None
|
||||||
|
assert result["data"].get(CONF_VOLUMES) is None
|
||||||
|
|
||||||
|
|
||||||
async def test_import(hass: HomeAssistantType, service: MagicMock):
|
async def test_import(hass: HomeAssistantType, service: MagicMock):
|
||||||
"""Test import step."""
|
"""Test import step."""
|
||||||
# import with minimum setup
|
# import with minimum setup
|
||||||
|
@ -105,12 +105,12 @@ async def test_controlling_state_via_mqtt(hass, mqtt_mock, setup_tasmota):
|
|||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
state = hass.states.get("sensor.dht11_temperature")
|
state = hass.states.get("sensor.tasmota_dht11_temperature")
|
||||||
assert state.state == "unavailable"
|
assert state.state == "unavailable"
|
||||||
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
||||||
|
|
||||||
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/LWT", "Online")
|
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/LWT", "Online")
|
||||||
state = hass.states.get("sensor.dht11_temperature")
|
state = hass.states.get("sensor.tasmota_dht11_temperature")
|
||||||
assert state.state == STATE_UNKNOWN
|
assert state.state == STATE_UNKNOWN
|
||||||
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ async def test_controlling_state_via_mqtt(hass, mqtt_mock, setup_tasmota):
|
|||||||
async_fire_mqtt_message(
|
async_fire_mqtt_message(
|
||||||
hass, "tasmota_49A3BC/tele/SENSOR", '{"DHT11":{"Temperature":20.5}}'
|
hass, "tasmota_49A3BC/tele/SENSOR", '{"DHT11":{"Temperature":20.5}}'
|
||||||
)
|
)
|
||||||
state = hass.states.get("sensor.dht11_temperature")
|
state = hass.states.get("sensor.tasmota_dht11_temperature")
|
||||||
assert state.state == "20.5"
|
assert state.state == "20.5"
|
||||||
|
|
||||||
# Test polled state update
|
# Test polled state update
|
||||||
@ -127,7 +127,7 @@ async def test_controlling_state_via_mqtt(hass, mqtt_mock, setup_tasmota):
|
|||||||
"tasmota_49A3BC/stat/STATUS8",
|
"tasmota_49A3BC/stat/STATUS8",
|
||||||
'{"StatusSNS":{"DHT11":{"Temperature":20.0}}}',
|
'{"StatusSNS":{"DHT11":{"Temperature":20.0}}}',
|
||||||
)
|
)
|
||||||
state = hass.states.get("sensor.dht11_temperature")
|
state = hass.states.get("sensor.tasmota_dht11_temperature")
|
||||||
assert state.state == "20.0"
|
assert state.state == "20.0"
|
||||||
|
|
||||||
|
|
||||||
@ -150,12 +150,12 @@ async def test_nested_sensor_state_via_mqtt(hass, mqtt_mock, setup_tasmota):
|
|||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
state = hass.states.get("sensor.tx23_speed_act")
|
state = hass.states.get("sensor.tasmota_tx23_speed_act")
|
||||||
assert state.state == "unavailable"
|
assert state.state == "unavailable"
|
||||||
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
||||||
|
|
||||||
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/LWT", "Online")
|
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/LWT", "Online")
|
||||||
state = hass.states.get("sensor.tx23_speed_act")
|
state = hass.states.get("sensor.tasmota_tx23_speed_act")
|
||||||
assert state.state == STATE_UNKNOWN
|
assert state.state == STATE_UNKNOWN
|
||||||
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ async def test_nested_sensor_state_via_mqtt(hass, mqtt_mock, setup_tasmota):
|
|||||||
async_fire_mqtt_message(
|
async_fire_mqtt_message(
|
||||||
hass, "tasmota_49A3BC/tele/SENSOR", '{"TX23":{"Speed":{"Act":"12.3"}}}'
|
hass, "tasmota_49A3BC/tele/SENSOR", '{"TX23":{"Speed":{"Act":"12.3"}}}'
|
||||||
)
|
)
|
||||||
state = hass.states.get("sensor.tx23_speed_act")
|
state = hass.states.get("sensor.tasmota_tx23_speed_act")
|
||||||
assert state.state == "12.3"
|
assert state.state == "12.3"
|
||||||
|
|
||||||
# Test polled state update
|
# Test polled state update
|
||||||
@ -172,7 +172,7 @@ async def test_nested_sensor_state_via_mqtt(hass, mqtt_mock, setup_tasmota):
|
|||||||
"tasmota_49A3BC/stat/STATUS8",
|
"tasmota_49A3BC/stat/STATUS8",
|
||||||
'{"StatusSNS":{"TX23":{"Speed":{"Act":"23.4"}}}}',
|
'{"StatusSNS":{"TX23":{"Speed":{"Act":"23.4"}}}}',
|
||||||
)
|
)
|
||||||
state = hass.states.get("sensor.tx23_speed_act")
|
state = hass.states.get("sensor.tasmota_tx23_speed_act")
|
||||||
assert state.state == "23.4"
|
assert state.state == "23.4"
|
||||||
|
|
||||||
|
|
||||||
@ -195,12 +195,12 @@ async def test_indexed_sensor_state_via_mqtt(hass, mqtt_mock, setup_tasmota):
|
|||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
state = hass.states.get("sensor.energy_totaltariff_1")
|
state = hass.states.get("sensor.tasmota_energy_totaltariff_1")
|
||||||
assert state.state == "unavailable"
|
assert state.state == "unavailable"
|
||||||
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
||||||
|
|
||||||
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/LWT", "Online")
|
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/LWT", "Online")
|
||||||
state = hass.states.get("sensor.energy_totaltariff_1")
|
state = hass.states.get("sensor.tasmota_energy_totaltariff_1")
|
||||||
assert state.state == STATE_UNKNOWN
|
assert state.state == STATE_UNKNOWN
|
||||||
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
||||||
|
|
||||||
@ -208,7 +208,7 @@ async def test_indexed_sensor_state_via_mqtt(hass, mqtt_mock, setup_tasmota):
|
|||||||
async_fire_mqtt_message(
|
async_fire_mqtt_message(
|
||||||
hass, "tasmota_49A3BC/tele/SENSOR", '{"ENERGY":{"TotalTariff":[1.2,3.4]}}'
|
hass, "tasmota_49A3BC/tele/SENSOR", '{"ENERGY":{"TotalTariff":[1.2,3.4]}}'
|
||||||
)
|
)
|
||||||
state = hass.states.get("sensor.energy_totaltariff_1")
|
state = hass.states.get("sensor.tasmota_energy_totaltariff_1")
|
||||||
assert state.state == "3.4"
|
assert state.state == "3.4"
|
||||||
|
|
||||||
# Test polled state update
|
# Test polled state update
|
||||||
@ -217,7 +217,7 @@ async def test_indexed_sensor_state_via_mqtt(hass, mqtt_mock, setup_tasmota):
|
|||||||
"tasmota_49A3BC/stat/STATUS8",
|
"tasmota_49A3BC/stat/STATUS8",
|
||||||
'{"StatusSNS":{"ENERGY":{"TotalTariff":[5.6,7.8]}}}',
|
'{"StatusSNS":{"ENERGY":{"TotalTariff":[5.6,7.8]}}}',
|
||||||
)
|
)
|
||||||
state = hass.states.get("sensor.energy_totaltariff_1")
|
state = hass.states.get("sensor.tasmota_energy_totaltariff_1")
|
||||||
assert state.state == "7.8"
|
assert state.state == "7.8"
|
||||||
|
|
||||||
|
|
||||||
@ -297,15 +297,15 @@ async def test_attributes(hass, mqtt_mock, setup_tasmota):
|
|||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
state = hass.states.get("sensor.dht11_temperature")
|
state = hass.states.get("sensor.tasmota_dht11_temperature")
|
||||||
assert state.attributes.get("device_class") == "temperature"
|
assert state.attributes.get("device_class") == "temperature"
|
||||||
assert state.attributes.get("friendly_name") == "DHT11 Temperature"
|
assert state.attributes.get("friendly_name") == "Tasmota DHT11 Temperature"
|
||||||
assert state.attributes.get("icon") is None
|
assert state.attributes.get("icon") is None
|
||||||
assert state.attributes.get("unit_of_measurement") == "C"
|
assert state.attributes.get("unit_of_measurement") == "C"
|
||||||
|
|
||||||
state = hass.states.get("sensor.beer_CarbonDioxide")
|
state = hass.states.get("sensor.tasmota_beer_CarbonDioxide")
|
||||||
assert state.attributes.get("device_class") is None
|
assert state.attributes.get("device_class") is None
|
||||||
assert state.attributes.get("friendly_name") == "Beer CarbonDioxide"
|
assert state.attributes.get("friendly_name") == "Tasmota Beer CarbonDioxide"
|
||||||
assert state.attributes.get("icon") == "mdi:molecule-co2"
|
assert state.attributes.get("icon") == "mdi:molecule-co2"
|
||||||
assert state.attributes.get("unit_of_measurement") == "ppm"
|
assert state.attributes.get("unit_of_measurement") == "ppm"
|
||||||
|
|
||||||
@ -329,15 +329,15 @@ async def test_nested_sensor_attributes(hass, mqtt_mock, setup_tasmota):
|
|||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
state = hass.states.get("sensor.tx23_speed_act")
|
state = hass.states.get("sensor.tasmota_tx23_speed_act")
|
||||||
assert state.attributes.get("device_class") is None
|
assert state.attributes.get("device_class") is None
|
||||||
assert state.attributes.get("friendly_name") == "TX23 Speed Act"
|
assert state.attributes.get("friendly_name") == "Tasmota TX23 Speed Act"
|
||||||
assert state.attributes.get("icon") is None
|
assert state.attributes.get("icon") is None
|
||||||
assert state.attributes.get("unit_of_measurement") == "km/h"
|
assert state.attributes.get("unit_of_measurement") == "km/h"
|
||||||
|
|
||||||
state = hass.states.get("sensor.tx23_dir_avg")
|
state = hass.states.get("sensor.tasmota_tx23_dir_avg")
|
||||||
assert state.attributes.get("device_class") is None
|
assert state.attributes.get("device_class") is None
|
||||||
assert state.attributes.get("friendly_name") == "TX23 Dir Avg"
|
assert state.attributes.get("friendly_name") == "Tasmota TX23 Dir Avg"
|
||||||
assert state.attributes.get("icon") is None
|
assert state.attributes.get("icon") is None
|
||||||
assert state.attributes.get("unit_of_measurement") == " "
|
assert state.attributes.get("unit_of_measurement") == " "
|
||||||
|
|
||||||
@ -367,15 +367,15 @@ async def test_indexed_sensor_attributes(hass, mqtt_mock, setup_tasmota):
|
|||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
state = hass.states.get("sensor.dummy1_temperature_0")
|
state = hass.states.get("sensor.tasmota_dummy1_temperature_0")
|
||||||
assert state.attributes.get("device_class") == "temperature"
|
assert state.attributes.get("device_class") == "temperature"
|
||||||
assert state.attributes.get("friendly_name") == "Dummy1 Temperature 0"
|
assert state.attributes.get("friendly_name") == "Tasmota Dummy1 Temperature 0"
|
||||||
assert state.attributes.get("icon") is None
|
assert state.attributes.get("icon") is None
|
||||||
assert state.attributes.get("unit_of_measurement") == "C"
|
assert state.attributes.get("unit_of_measurement") == "C"
|
||||||
|
|
||||||
state = hass.states.get("sensor.dummy2_carbondioxide_1")
|
state = hass.states.get("sensor.tasmota_dummy2_carbondioxide_1")
|
||||||
assert state.attributes.get("device_class") is None
|
assert state.attributes.get("device_class") is None
|
||||||
assert state.attributes.get("friendly_name") == "Dummy2 CarbonDioxide 1"
|
assert state.attributes.get("friendly_name") == "Tasmota Dummy2 CarbonDioxide 1"
|
||||||
assert state.attributes.get("icon") == "mdi:molecule-co2"
|
assert state.attributes.get("icon") == "mdi:molecule-co2"
|
||||||
assert state.attributes.get("unit_of_measurement") == "ppm"
|
assert state.attributes.get("unit_of_measurement") == "ppm"
|
||||||
|
|
||||||
@ -396,15 +396,15 @@ async def test_enable_status_sensor(hass, mqtt_mock, setup_tasmota):
|
|||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
state = hass.states.get("sensor.tasmota_status")
|
state = hass.states.get("sensor.tasmota_signal")
|
||||||
assert state is None
|
assert state is None
|
||||||
entry = entity_reg.async_get("sensor.tasmota_status")
|
entry = entity_reg.async_get("sensor.tasmota_signal")
|
||||||
assert entry.disabled
|
assert entry.disabled
|
||||||
assert entry.disabled_by == "integration"
|
assert entry.disabled_by == "integration"
|
||||||
|
|
||||||
# Enable the status sensor
|
# Enable the status sensor
|
||||||
updated_entry = entity_reg.async_update_entity(
|
updated_entry = entity_reg.async_update_entity(
|
||||||
"sensor.tasmota_status", disabled_by=None
|
"sensor.tasmota_signal", disabled_by=None
|
||||||
)
|
)
|
||||||
assert updated_entry != entry
|
assert updated_entry != entry
|
||||||
assert updated_entry.disabled is False
|
assert updated_entry.disabled is False
|
||||||
@ -428,12 +428,12 @@ async def test_enable_status_sensor(hass, mqtt_mock, setup_tasmota):
|
|||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
state = hass.states.get("sensor.tasmota_status")
|
state = hass.states.get("sensor.tasmota_signal")
|
||||||
assert state.state == "unavailable"
|
assert state.state == "unavailable"
|
||||||
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
||||||
|
|
||||||
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/LWT", "Online")
|
async_fire_mqtt_message(hass, "tasmota_49A3BC/tele/LWT", "Online")
|
||||||
state = hass.states.get("sensor.tasmota_status")
|
state = hass.states.get("sensor.tasmota_signal")
|
||||||
assert state.state == STATE_UNKNOWN
|
assert state.state == STATE_UNKNOWN
|
||||||
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
assert not state.attributes.get(ATTR_ASSUMED_STATE)
|
||||||
|
|
||||||
@ -451,7 +451,7 @@ async def test_availability_when_connection_lost(
|
|||||||
sensor.DOMAIN,
|
sensor.DOMAIN,
|
||||||
config,
|
config,
|
||||||
sensor_config,
|
sensor_config,
|
||||||
"dht11_temperature",
|
"tasmota_dht11_temperature",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -460,7 +460,12 @@ async def test_availability(hass, mqtt_mock, setup_tasmota):
|
|||||||
config = copy.deepcopy(DEFAULT_CONFIG)
|
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||||
sensor_config = copy.deepcopy(DEFAULT_SENSOR_CONFIG)
|
sensor_config = copy.deepcopy(DEFAULT_SENSOR_CONFIG)
|
||||||
await help_test_availability(
|
await help_test_availability(
|
||||||
hass, mqtt_mock, sensor.DOMAIN, config, sensor_config, "dht11_temperature"
|
hass,
|
||||||
|
mqtt_mock,
|
||||||
|
sensor.DOMAIN,
|
||||||
|
config,
|
||||||
|
sensor_config,
|
||||||
|
"tasmota_dht11_temperature",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -469,7 +474,12 @@ async def test_availability_discovery_update(hass, mqtt_mock, setup_tasmota):
|
|||||||
config = copy.deepcopy(DEFAULT_CONFIG)
|
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||||
sensor_config = copy.deepcopy(DEFAULT_SENSOR_CONFIG)
|
sensor_config = copy.deepcopy(DEFAULT_SENSOR_CONFIG)
|
||||||
await help_test_availability_discovery_update(
|
await help_test_availability_discovery_update(
|
||||||
hass, mqtt_mock, sensor.DOMAIN, config, sensor_config, "dht11_temperature"
|
hass,
|
||||||
|
mqtt_mock,
|
||||||
|
sensor.DOMAIN,
|
||||||
|
config,
|
||||||
|
sensor_config,
|
||||||
|
"tasmota_dht11_temperature",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -506,8 +516,8 @@ async def test_discovery_removal_sensor(hass, mqtt_mock, caplog, setup_tasmota):
|
|||||||
config,
|
config,
|
||||||
sensor_config1,
|
sensor_config1,
|
||||||
{},
|
{},
|
||||||
"dht11_temperature",
|
"tasmota_dht11_temperature",
|
||||||
"DHT11 Temperature",
|
"Tasmota DHT11 Temperature",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -528,8 +538,8 @@ async def test_discovery_update_unchanged_sensor(
|
|||||||
config,
|
config,
|
||||||
discovery_update,
|
discovery_update,
|
||||||
sensor_config,
|
sensor_config,
|
||||||
"dht11_temperature",
|
"tasmota_dht11_temperature",
|
||||||
"DHT11 Temperature",
|
"Tasmota DHT11 Temperature",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -559,7 +569,7 @@ async def test_entity_id_update_subscriptions(hass, mqtt_mock, setup_tasmota):
|
|||||||
config,
|
config,
|
||||||
topics,
|
topics,
|
||||||
sensor_config,
|
sensor_config,
|
||||||
"dht11_temperature",
|
"tasmota_dht11_temperature",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -568,5 +578,10 @@ async def test_entity_id_update_discovery_update(hass, mqtt_mock, setup_tasmota)
|
|||||||
config = copy.deepcopy(DEFAULT_CONFIG)
|
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||||
sensor_config = copy.deepcopy(DEFAULT_SENSOR_CONFIG)
|
sensor_config = copy.deepcopy(DEFAULT_SENSOR_CONFIG)
|
||||||
await help_test_entity_id_update_discovery_update(
|
await help_test_entity_id_update_discovery_update(
|
||||||
hass, mqtt_mock, sensor.DOMAIN, config, sensor_config, "dht11_temperature"
|
hass,
|
||||||
|
mqtt_mock,
|
||||||
|
sensor.DOMAIN,
|
||||||
|
config,
|
||||||
|
sensor_config,
|
||||||
|
"tasmota_dht11_temperature",
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user