mirror of
https://github.com/home-assistant/core.git
synced 2025-11-08 18:39:30 +00:00
Push State (#2365)
* Add ability to push state changes * Add tests for push state changes * Fix style issues * Use better name to force an update
This commit is contained in:
committed by
Paulus Schoutsen
parent
446f998759
commit
d13cc227cc
@@ -204,11 +204,12 @@ class APIEntityStateView(HomeAssistantView):
|
||||
return self.json_message('No state specified', HTTP_BAD_REQUEST)
|
||||
|
||||
attributes = request.json.get('attributes')
|
||||
force_update = request.json.get('force_update', False)
|
||||
|
||||
is_new_state = self.hass.states.get(entity_id) is None
|
||||
|
||||
# Write state
|
||||
self.hass.states.set(entity_id, new_state, attributes)
|
||||
self.hass.states.set(entity_id, new_state, attributes, force_update)
|
||||
|
||||
# Read the state back for our response
|
||||
resp = self.json(self.hass.states.get(entity_id))
|
||||
|
||||
Reference in New Issue
Block a user