Update pytechnove to 1.2.2 (#110074)

This commit is contained in:
Christophe Gagnier 2024-02-09 02:41:48 -05:00 committed by GitHub
parent a0abc27612
commit 720fb7da59
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 68 additions and 6 deletions

View File

@ -6,6 +6,6 @@
"documentation": "https://www.home-assistant.io/integrations/technove", "documentation": "https://www.home-assistant.io/integrations/technove",
"integration_type": "device", "integration_type": "device",
"iot_class": "local_polling", "iot_class": "local_polling",
"requirements": ["python-technove==1.2.1"], "requirements": ["python-technove==1.2.2"],
"zeroconf": ["_technove-stations._tcp.local."] "zeroconf": ["_technove-stations._tcp.local."]
} }

View File

@ -63,7 +63,9 @@
"state": { "state": {
"unplugged": "Unplugged", "unplugged": "Unplugged",
"plugged_waiting": "Plugged, waiting", "plugged_waiting": "Plugged, waiting",
"plugged_charging": "Plugged, charging" "plugged_charging": "Plugged, charging",
"out_of_activation_period": "Out of activation period",
"high_charge_period": "High charge period"
} }
} }
} }

View File

@ -2290,7 +2290,7 @@ python-songpal==0.16.1
python-tado==0.17.4 python-tado==0.17.4
# homeassistant.components.technove # homeassistant.components.technove
python-technove==1.2.1 python-technove==1.2.2
# homeassistant.components.telegram_bot # homeassistant.components.telegram_bot
python-telegram-bot==13.1 python-telegram-bot==13.1

View File

@ -1757,7 +1757,7 @@ python-songpal==0.16.1
python-tado==0.17.4 python-tado==0.17.4
# homeassistant.components.technove # homeassistant.components.technove
python-technove==1.2.1 python-technove==1.2.2
# homeassistant.components.telegram_bot # homeassistant.components.telegram_bot
python-telegram-bot==13.1 python-telegram-bot==13.1

View File

@ -0,0 +1,27 @@
{
"voltageIn": 238,
"voltageOut": 238,
"maxStationCurrent": 32,
"maxCurrent": 24,
"current": 23.75,
"network_ssid": "Connecting...",
"id": "AA:AA:AA:AA:AA:BB",
"auto_charge": true,
"highChargePeriodActive": false,
"normalPeriodActive": false,
"maxChargePourcentage": 0.9,
"isBatteryProtected": false,
"inSharingMode": true,
"energySession": 12.34,
"energyTotal": 1234,
"version": "1.82",
"rssi": -82,
"name": "TechnoVE Station",
"lastCharge": "1701072080,0,17.39\n",
"time": 1701000000,
"isUpToDate": true,
"isSessionActive": true,
"conflictInSharingConfig": false,
"isStaticIp": false,
"status": 12345
}

View File

@ -297,6 +297,8 @@
'unplugged', 'unplugged',
'plugged_waiting', 'plugged_waiting',
'plugged_charging', 'plugged_charging',
'out_of_activation_period',
'high_charge_period',
]), ]),
}), }),
'config_entry_id': <ANY>, 'config_entry_id': <ANY>,
@ -333,6 +335,8 @@
'unplugged', 'unplugged',
'plugged_waiting', 'plugged_waiting',
'plugged_charging', 'plugged_charging',
'out_of_activation_period',
'high_charge_period',
]), ]),
}), }),
'context': <ANY>, 'context': <ANY>,

View File

@ -5,15 +5,20 @@ from unittest.mock import MagicMock
from freezegun.api import FrozenDateTimeFactory from freezegun.api import FrozenDateTimeFactory
import pytest import pytest
from syrupy import SnapshotAssertion from syrupy import SnapshotAssertion
from technove import Status, TechnoVEError from technove import Station, Status, TechnoVEError
from homeassistant.components.technove.const import DOMAIN
from homeassistant.const import STATE_UNAVAILABLE, STATE_UNKNOWN, Platform from homeassistant.const import STATE_UNAVAILABLE, STATE_UNKNOWN, Platform
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er from homeassistant.helpers import entity_registry as er
from . import setup_with_selected_platforms from . import setup_with_selected_platforms
from tests.common import MockConfigEntry, async_fire_time_changed from tests.common import (
MockConfigEntry,
async_fire_time_changed,
load_json_object_fixture,
)
@pytest.mark.usefixtures("entity_registry_enabled_by_default", "mock_technove") @pytest.mark.usefixtures("entity_registry_enabled_by_default", "mock_technove")
@ -93,3 +98,27 @@ async def test_sensor_update_failure(
await hass.async_block_till_done() await hass.async_block_till_done()
assert hass.states.get(entity_id).state == STATE_UNAVAILABLE assert hass.states.get(entity_id).state == STATE_UNAVAILABLE
@pytest.mark.usefixtures("init_integration")
async def test_sensor_unknown_status(
hass: HomeAssistant,
mock_technove: MagicMock,
freezer: FrozenDateTimeFactory,
) -> None:
"""Test coordinator update failure."""
entity_id = "sensor.technove_station_status"
assert hass.states.get(entity_id).state == Status.PLUGGED_CHARGING.value
mock_technove.update.return_value = Station(
load_json_object_fixture("station_bad_status.json", DOMAIN)
)
freezer.tick(timedelta(minutes=5, seconds=1))
async_fire_time_changed(hass)
await hass.async_block_till_done()
assert hass.states.get(entity_id).state == STATE_UNKNOWN
# Other sensors should still be available
assert hass.states.get("sensor.technove_station_total_energy_usage").state == "1234"