def update(self):
        if self._command_state:
            payload = str(self._query_state())
            if self._value_template:
                payload = template.render_with_possible_json_value(
                    self._hass, self._value_template, payload)
            self._state = (payload.lower() == "true")
Update device state.
dataset/ETHPy150Open home-assistant/home-assistant/homeassistant/components/switch/command_line.py/CommandSwitch.update