-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from maxgeilert/rework
reworked sensor
- Loading branch information
Showing
8 changed files
with
208 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from homeassistant import config_entries | ||
from .const import ( | ||
CONF_ACTIVE_STATES, | ||
CONF_ENTITIES_KEEP, | ||
CONF_ENTITIES_TOGGLE, | ||
CONF_TIMEOUT, | ||
DOMAIN, | ||
) | ||
import voluptuous as vol | ||
|
||
|
||
class RoomOccupancyBinarySensorOptionsFlow(config_entries.OptionsFlow): | ||
"""Options flow for RoomOccupancyBinarySensor.""" | ||
|
||
def __init__(self, config_entry): | ||
"""Initialize options flow.""" | ||
self.config_entry = config_entry | ||
|
||
async def async_step_init(self, user_input=None): | ||
"""Manage the options.""" | ||
if user_input is not None: | ||
return self.async_create_entry(title="", data=user_input) | ||
|
||
options = { | ||
vol.Optional( | ||
CONF_TIMEOUT, | ||
default=self.config_entry.options.get(CONF_TIMEOUT), | ||
): vol.All(vol.Coerce(int), vol.Range(min=1)) | ||
} | ||
|
||
return self.async_show_form(step_id="init", data_schema=vol.Schema(options)) | ||
|
||
async def async_step_user(self, user_input=None): | ||
"""Handle a flow initialized by the user.""" | ||
if user_input is not None: | ||
return self.async_create_entry(title="", data=user_input) | ||
|
||
return await self.async_step_init() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,40 @@ | ||
{ | ||
"config": { | ||
"abort": { | ||
"already_configured": "This sensor already exists!" | ||
}, | ||
"error": { | ||
"already_configured": "This sensor already exists!" | ||
}, | ||
"step": { | ||
"user": { | ||
"data": { | ||
"active_states": "states that are considered as true", | ||
"entities_keep": "these entitites can keep the sensor on", | ||
"entities_toggle": "these entities can toggle the sensor to on", | ||
"name": "Name of the sensor", | ||
"timeout": "Timeout in seconds" | ||
} | ||
} | ||
"step": { | ||
"user": { | ||
"data": { | ||
"name": "Name of the sensor", | ||
"timeout": "Timeout in seconds", | ||
"entities_toggle": "these entities can toggle the sensor to on", | ||
"entities_keep": "these entitites can keep the sensor on", | ||
"active_states": "states that are considered as true" | ||
} | ||
} | ||
}, | ||
"error": { | ||
"already_configured": "This sensor already exists!" | ||
}, | ||
"abort": { | ||
"already_configured": "This sensor already exists!" | ||
} | ||
}, | ||
"options": { | ||
"step": { | ||
"init": { | ||
"data": { | ||
"name": "Name of the sensor", | ||
"timeout": "Timeout in seconds", | ||
"entities_toggle": "these entities can toggle the sensor to on", | ||
"entities_keep": "these entitites can keep the sensor on", | ||
"active_states": "states that are considered as true" | ||
} | ||
} | ||
}, | ||
"error": { | ||
"already_configured": "This sensor already exists!" | ||
}, | ||
"abort": { | ||
"already_configured": "This sensor already exists!" | ||
} | ||
} | ||
} | ||
} |