I’m trying to configure two Shelly Dimmer 2 units to work using MQTT, but I’m having problems getting a YAML that works. I created a new file called shelly.yaml containing the below (this is just an example file) & included it in the configuration.yaml file with include: !shelly.yaml
- platform: mqtt
schema: template
name: “Any name you like”
state_topic: “shellies/shellydimmer2-/light/0/status”
state_template: ‘{% if value_json.ison %} on {% else %} off {% endif %}’
command_topic: “shellies/shellydimmer2-/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) }}’
However, on checking the configuration, I get the error
Invalid config for [shelly]: expected a dictionary for dictionary value @ data[‘shelly’]. Got [OrderedDict([(‘platform’, ‘mqtt’), (‘schema’, ‘template’), (‘name’, ‘Any name you like’), (‘state_topic’, ‘shellies/shellydimmer2-/light/0/status’), (‘state_template’, ‘{% if value_json.ison %} on {% else %} off {% endif %}’), (‘command_topic’, ‘shellies/shellydimmer2-/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”}… (See /config/configuration.yaml, line 12).
I’ve tried tweaking the file in various ways to no avail. Any help gratefully received !
Out of interest, why doesn’t Shelly just have a resource of yaml files for all their products or am I missing something here
Cheers