Restart Switch

This platform allows you to restart your ESP8266/ESP32 with a simple MQTT message.

Example Usage

App.make_restart_switch("Livingroom Restart");

See Application::make_restart_switch().

API Reference

class RestartSwitch : public switch_::Switch

A simple switch that restarts the device when triggered.

Public Functions

RestartSwitch(const std::string &name)
std::string icon()

Override this to set the Home Assistant icon for this switch.

Return “” to disable this feature.

Return
The icon of this switch, for example “mdi:fan”.

Protected Functions

void write_state(bool state)

Write the given state to hardware.

You should implement this abstract method if you want to create your own switch.

In the implementation of this method, you should also call publish_state to acknowledge that the state was written to the hardware.

Parameters
  • state: The state to write. Inversion is already applied if user specified it.