#NEWLINE# def set_away_mode( hass , away_mode , entity_id = None ) : #NEWLINE# #INDENT# 'Turn all or specified thermostat away mode on.' #NEWLINE# data = { #NEWLINE# #INDENT# ATTR_AWAY_MODE : away_mode , #NEWLINE# #UNINDENT# } #NEWLINE# if entity_id : #NEWLINE# #INDENT# data [ ATTR_ENTITY_ID ] = entity_id #NEWLINE# #UNINDENT# hass . services . call ( DOMAIN , SERVICE_SET_AWAY_MODE , data )