Skip to content
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
30 changes: 29 additions & 1 deletion homeassistant/components/emoncms/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@
from homeassistant.const import CONF_API_KEY, CONF_URL
from homeassistant.core import callback
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.selector import selector
from homeassistant.helpers.selector import (
SelectSelector,
SelectSelectorConfig,
SelectSelectorMode,
selector,
)

from .const import (
CONF_MESSAGE,
Expand All @@ -26,6 +31,9 @@
FEED_ID,
FEED_NAME,
FEED_TAG,
SYNC_MODE,
SYNC_MODE_AUTO,
SYNC_MODE_MANUAL,
)


Expand Down Expand Up @@ -102,6 +110,17 @@ async def async_step_user(
"mode": "dropdown",
"multiple": True,
}
if user_input.get(SYNC_MODE) == SYNC_MODE_AUTO:
return self.async_create_entry(
title=sensor_name(self.url),
data={
CONF_URL: self.url,
CONF_API_KEY: self.api_key,
CONF_ONLY_INCLUDE_FEEDID: [
feed[FEED_ID] for feed in result[CONF_MESSAGE]
],
},
)
return await self.async_step_choose_feeds()
return self.async_show_form(
step_id="user",
Expand All @@ -110,6 +129,15 @@ async def async_step_user(
{
vol.Required(CONF_URL): str,
vol.Required(CONF_API_KEY): str,
vol.Required(
SYNC_MODE, default=SYNC_MODE_MANUAL
): SelectSelector(
SelectSelectorConfig(
options=[SYNC_MODE_MANUAL, SYNC_MODE_AUTO],
mode=SelectSelectorMode.DROPDOWN,
translation_key=SYNC_MODE,
)
),
}
),
user_input,
Expand Down
3 changes: 3 additions & 0 deletions homeassistant/components/emoncms/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
FEED_ID = "id"
FEED_NAME = "name"
FEED_TAG = "tag"
SYNC_MODE = "sync_mode"
SYNC_MODE_AUTO = "auto"
SYNC_MODE_MANUAL = "manual"


LOGGER = logging.getLogger(__package__)
11 changes: 10 additions & 1 deletion homeassistant/components/emoncms/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"user": {
"data": {
"url": "[%key:common::config_flow::data::url%]",
"api_key": "[%key:common::config_flow::data::api_key%]"
"api_key": "[%key:common::config_flow::data::api_key%]",
"sync_mode": "Synchronization mode"
},
"data_description": {
"url": "Server URL starting with the protocol (http or https)",
Expand All @@ -24,6 +25,14 @@
"already_configured": "This server is already configured"
}
},
"selector": {
"sync_mode": {
"options": {
"auto": "Synchronize all available Feeds",
"manual": "Select which Feeds to synchronize"
}
}
},
"entity": {
"sensor": {
"energy": {
Expand Down
4 changes: 4 additions & 0 deletions homeassistant/components/iron_os/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@
DISCOVERY_SVC_UUID = "9eae1000-9d0d-48c5-aa55-33e27f9bc533"

MAX_TEMP: int = 450
MAX_TEMP_F: int = 850
MIN_TEMP: int = 10
MIN_TEMP_F: int = 50
MIN_BOOST_TEMP: int = 250
MIN_BOOST_TEMP_F: int = 480
4 changes: 3 additions & 1 deletion homeassistant/components/iron_os/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ async def _async_update_data(self) -> SettingsDataResponse:

if self.device.is_connected and characteristics:
try:
return await self.device.get_settings(list(characteristics))
return await self.device.get_settings(
list(characteristics | {CharSetting.TEMP_UNIT})
)
except CommunicationError as e:
_LOGGER.debug("Failed to fetch settings", exc_info=e)

Expand Down
Loading
Loading