Skip to content

Commit

Permalink
add set_state
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelveldt committed Sep 2, 2020
1 parent d96a693 commit a9f90ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions hass_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,15 @@ async def async_call_service(self, domain: str, service: str, service_data: dict
msg["service_data"] = service_data
return await self.__async_send_ws(msg)

async def __async_set_state(
async def async_set_state(
self, entity_id: str, new_state: str, state_attributes: dict = None
):
"""Set state to hass entity."""
"""
Set state on a homeassistant entity.
:param entity_id: Entity id to set state for.
:param new_state: The new state.
:param state_attributes: Optional dict with parameters (e.g. { name: 'Cool entity' }).
"""
if state_attributes is None:
state_attributes = {}
data = {
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

PROJECT_DIR = Path(__file__).parent.resolve()
README_FILE = PROJECT_DIR / "README.md"
VERSION = "0.0.2"
VERSION = "0.0.3"

with open("requirements.txt") as f:
INSTALL_REQUIRES = f.read().splitlines()
Expand Down

0 comments on commit a9f90ce

Please sign in to comment.