A switch entity turns on or off something, for example a relay. Derive a platform entity from
To represent something which can be turned on or off but can't be controlled, for example a wall switch which transmits its state but can't be turned on or off from Home Assistant, a Binary Sensor is a better choice.
To represent something which doesn't have a state, for example a door bell push button, a custom event or a Device Trigger is a better choice.
Properties should always only return information from memory and not do I/O (like network requests). Implement
async_update() to fetch data.
|is_on||boolean||Required||If the switch is currently on or off.|
|current_power_w||float||The current power usage in W.|
|today_energy_kwh||float||Total energy usage in kWh.|
|is_standby||boolean||Indicate if the device connected to the switch is currently in standby.|
Turn the switch on.
Turn the switch off.
Optional. If not implemented will default to checking what method to call using the
Available device classes
Optional. What type of device this. It will possibly map to google device types.
|outlet||Device is an outlet for power.|
|switch||Device is switch for some type of entity.|