-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
31 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,2 +1,32 @@ | ||
# hass_py_set_state | ||
# Set State | ||
Home Assistant Python Script to force set and entity state | ||
|
||
## How it works | ||
This script adds a service that lets you update the state and/or attributes of any entity, similar to the developer tools | ||
|
||
Requires `python_script:` to be enabled in you configuration | ||
|
||
## Installation | ||
Copy the Python script in to your `/config/python_scripts` directory or add this repository and install via HACS. | ||
|
||
## Service arguments | ||
key | required | type | description | ||
-- | -- | -- | -- | ||
`entity_id:` | True | string | The full entity id to update | ||
`state:` | False | any | The state value | ||
`allow_create:` | False | Boolean | Allow the entity to be created if it does not exists (Defaults to false so mis-typed entities do not accidentally get created.) | ||
`...:` | False | any | any additional name becomes or replaces and attribute on the entity | ||
|
||
## Usage | ||
Each call requires at least an entity_id and a state or attributes (otherwise it wont do anything) | ||
|
||
example: | ||
|
||
``` | ||
entity_id: sensor.random_sensor | ||
state: 0 | ||
allow_create: true | ||
``` | ||
|
||
(Thanks to [@rodpayne](https://community.home-assistant.io/u/rodpayne) for the initial script: | ||
(https://community.home-assistant.io/t/how-to-manually-set-state-value-of-sensor/43975) |