Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve guarding #164

Merged
merged 5 commits into from
Mar 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

# v0.16.9a0 - Smile: bugfix
- Fix for https://github.com/plugwise/plugwise-beta/issues/250

# v0.16.8 - Smile: bugfixes, continued
- Fix for https://github.com/home-assistant/core/issues/68003
- Refix solution for #158
Expand Down
2 changes: 1 addition & 1 deletion plugwise/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Plugwise module."""

__version__ = "0.16.8"
__version__ = "0.16.9a0"

from plugwise.smile import Smile
from plugwise.stick import Stick
5 changes: 3 additions & 2 deletions plugwise/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,9 +875,10 @@ def _get_appliance_data(self, d_id: str) -> dict[str, Any]:
data = self._appliance_measurements(appliance, data, measurements)
data.update(self._get_lock_state(appliance))

# Elga doesn't use intended_cental_heating_state to show the generic heating state
# Remove c_heating_state from the output
# Also, Elga doesn't use intended_cental_heating_state to show the generic heating state
if "c_heating_state" in data:
if "heating_state" in data:
if self._anna_cooling_present and "heating_state" in data:
if data.get("c_heating_state") and not data.get("heating_state"):
data["heating_state"] = True
data.pop("c_heating_state")
Expand Down
96 changes: 96 additions & 0 deletions tests/test_smile.py
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,102 @@ async def test_connect_anna_v4(self):
await smile.close_connection()
await self.disconnect(server, client)

@pytest.mark.asyncio
async def test_connect_anna_v4_dhw(self):
"""Test an Anna firmware 4 setup without a boiler."""
testdata = {
# Anna
"01b85360fdd243d0aaad4d6ac2a5ba7e": {
"class": "thermostat",
"fw": "2018-02-08T11:15:53+01:00",
"location": "eb5309212bf5407bb143e5bfa3b18aee",
"model": "Anna",
"name": "Anna",
"vendor": "Plugwise",
"preset_modes": ["vacation", "no_frost", "away", "asleep", "home"],
"active_preset": "home",
"presets": {
"vacation": [15.0, 28.0],
"no_frost": [10.0, 30.0],
"away": [17.5, 25.0],
"asleep": [17.0, 24.0],
"home": [20.5, 22.0],
},
"available_schedules": ["Standaard", "Thuiswerken"],
"selected_schedule": "None",
"schedule_temperature": 20.5,
"last_used": "Standaard",
"mode": "heat",
"sensors": {"temperature": 20.5, "setpoint": 20.5, "illuminance": 40.5},
},
# Central
"cd0e6156b1f04d5f952349ffbe397481": {
"class": "heater_central",
"fw": None,
"location": "94c107dc6ac84ed98e9f68c0dd06bf71",
"model": "2.32",
"name": "OpenTherm",
"vendor": "Bosch Thermotechniek B.V.",
"binary_sensors": {
"dhw_state": True,
"flame_state": True,
"heating_state": False,
},
"sensors": {
"water_temperature": 52.0,
"intended_boiler_temperature": 48.6,
"modulation_level": 0.0,
"return_temperature": 42.0,
"water_pressure": 2.1,
},
"switches": {"dhw_cm_switch": False},
},
# Gateway
"0466eae8520144c78afb29628384edeb": {
"class": "gateway",
"fw": "4.0.15",
"location": "94c107dc6ac84ed98e9f68c0dd06bf71",
"model": "Anna",
"name": "Anna",
"vendor": "Plugwise B.V.",
"binary_sensors": {"plugwise_notification": False},
"sensors": {"outdoor_temperature": 7.44},
},
}

self.smile_setup = "anna_v4_dhw"
server, smile, client = await self.connect_wrapper()
assert smile.smile_hostname == "smile000000"

_LOGGER.info("Basics:")
_LOGGER.info(" # Assert type = thermostat")
assert smile.smile_type == "thermostat"
_LOGGER.info(" # Assert version")
assert smile.smile_version[0] == "4.0.15"
_LOGGER.info(" # Assert no legacy")
assert not smile._smile_legacy

await self.device_test(smile, testdata)
assert not self.notifications

await self.tinker_thermostat(
smile,
"eb5309212bf5407bb143e5bfa3b18aee",
good_schemas=["Standaard", "Thuiswerken"],
)
await smile.close_connection()
await self.disconnect(server, client)

server, smile, client = await self.connect_wrapper(raise_timeout=True)
await self.tinker_thermostat(
smile,
"eb5309212bf5407bb143e5bfa3b18aee",
good_schemas=["Standaard", "Thuiswerken"],
unhappy=True,
)
await smile.close_connection()
await self.disconnect(server, client)

@pytest.mark.asyncio
async def test_connect_anna_v4_no_tag(self):
"""Test an Anna firmware 4 setup without a boiler - no presets."""
Expand Down
Loading