#NEWLINE# def toggle( hass , entity_id = None ) : #NEWLINE# #INDENT# 'Toggle all or specified switch.' #NEWLINE# data = ( { #NEWLINE# #INDENT# ATTR_ENTITY_ID : entity_id , #NEWLINE# #UNINDENT# } if entity_id else None ) #NEWLINE# hass . services . call ( DOMAIN , SERVICE_TOGGLE , data )