1540bb12797d534eba347664d9c1586e55f06e0b,homeassistant/components/switch/template.py,SwitchTemplate,async_update,#SwitchTemplate#,128
Before Change
@asyncio.coroutine
def async_update(self):
Update the state from the template.
try:
state = self._template.async_render().lower()
if state in _VALID_STATES:
self._state = state in ("true", STATE_ON)
else:
_LOGGER.error(
"Received invalid switch is_on state: %s. Expected: %s",
state, ", ".join(_VALID_STATES))
self._state = None
except TemplateError as ex:
_LOGGER.error(ex)
self._state = None
After Change
self._off_script.run()
@asyncio.coroutine
def async_update(self ):
Update the state from the template.
self._async_render()
def _async_render(self):
Render the state from the template.
try:
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 10
Instances Project Name: home-assistant/home-assistant
Commit Name: 1540bb12797d534eba347664d9c1586e55f06e0b
Time: 2016-10-16
Author: pascal.vizeli@syshack.ch
File Name: homeassistant/components/switch/template.py
Class Name: SwitchTemplate
Method Name: async_update
Project Name: home-assistant/home-assistant
Commit Name: 1540bb12797d534eba347664d9c1586e55f06e0b
Time: 2016-10-16
Author: pascal.vizeli@syshack.ch
File Name: homeassistant/components/sensor/template.py
Class Name: SensorTemplate
Method Name: async_update
Project Name: home-assistant/home-assistant
Commit Name: 1540bb12797d534eba347664d9c1586e55f06e0b
Time: 2016-10-16
Author: pascal.vizeli@syshack.ch
File Name: homeassistant/components/binary_sensor/template.py
Class Name: BinarySensorTemplate
Method Name: async_update