A simple example to control a led connected to a NodeMCU board (ESP8266).
configuration.yaml :
light:
platform: mqtt
name: 'Office light'
state_topic: 'office/light1/status'
command_topic: 'office/light1/switch'
optimistic: false
- GND - LED - Resistor 220 Ohms - D1/GPIO5