|
9 | 9 | from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, Platform |
10 | 10 | from homeassistant.core import HomeAssistant, callback |
11 | 11 | from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady |
12 | | -from homeassistant.helpers.aiohttp_client import ( |
13 | | - async_create_clientsession, |
14 | | - async_get_clientsession, |
15 | | -) |
16 | | - |
17 | | -from .const import ( |
18 | | - _LOGGER, |
19 | | - CONF_COOL_AWAY_TEMPERATURE, |
20 | | - CONF_HEAT_AWAY_TEMPERATURE, |
21 | | - DOMAIN, |
22 | | -) |
| 12 | +from homeassistant.helpers.aiohttp_client import async_create_clientsession |
| 13 | + |
| 14 | +from .const import _LOGGER, CONF_COOL_AWAY_TEMPERATURE, CONF_HEAT_AWAY_TEMPERATURE |
23 | 15 |
|
24 | 16 | UPDATE_LOOP_SLEEP_TIME = 5 |
25 | 17 | PLATFORMS = [Platform.CLIMATE, Platform.HUMIDIFIER, Platform.SENSOR, Platform.SWITCH] |
@@ -56,11 +48,11 @@ async def async_setup_entry( |
56 | 48 | username = config_entry.data[CONF_USERNAME] |
57 | 49 | password = config_entry.data[CONF_PASSWORD] |
58 | 50 |
|
59 | | - if len(hass.config_entries.async_entries(DOMAIN)) > 1: |
60 | | - session = async_create_clientsession(hass) |
61 | | - else: |
62 | | - session = async_get_clientsession(hass) |
63 | | - |
| 51 | + # Always create a new session for Honeywell to prevent cookie injection |
| 52 | + # issues. Even with response_url handling in aiosomecomfort 0.0.33+, |
| 53 | + # cookies can still leak into other integrations when using the shared |
| 54 | + # session. See issue #147395. |
| 55 | + session = async_create_clientsession(hass) |
64 | 56 | client = aiosomecomfort.AIOSomeComfort(username, password, session=session) |
65 | 57 | try: |
66 | 58 | await client.login() |
|
0 commit comments