Adding Shelly Device (MQTT)
Home Assistant General
Start shelly device and connect to Wifi for device on phone/tablet.
Set Wifi Configuration and reconnect using main network
Configure to use MQTT in Internet Developer settings putting in IP user and password for Home Assistant
Make a note of the ID for the MQTT (to see it or change it click on Custom name.
In configuration.yaml add the device as a light via MQTT.
light:
- platform: mqtt
schema: template
name: "Bedroom 1 Light"
state_topic: "shellies/shellydimmer2-xxxxxxxxxxxx/light/0/status"
state_template: '{% if value_json.ison %} on {% else %} off {% endif %}'
command_topic: "shellies/shellydimmer2-xxxxxxxxxxxx/light/0/set"
command_on_template: '{"turn": "on"{% if brightness is defined %}, "brightness": {{(brightness | float * 0.3882 + 1) | round(0)}}{% endif %}}'
command_off_template: '{"turn": "off"}'
brightness_template: '{{ (value_json.brightness | float * 2.55) | round(0) }}'
qos: 2
Replace shellydimmer2-xxxxxxxxxxxx with the correct ID for the device.