From a9f90ce00fac8cbedfc775569f52d14d5690fd2d Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Wed, 2 Sep 2020 23:44:09 +0200 Subject: [PATCH] add set_state --- hass_client/__init__.py | 9 +++++++-- setup.py | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/hass_client/__init__.py b/hass_client/__init__.py index c07da55..750520c 100644 --- a/hass_client/__init__.py +++ b/hass_client/__init__.py @@ -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 = { diff --git a/setup.py b/setup.py index 2056dfb..1228154 100644 --- a/setup.py +++ b/setup.py @@ -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()