I’m having trouble setting up an RGBW2 Shelly with MQTT into HASSIO. The main issue is the Shelly RGBW2 doesn’t seem to send or receive any MQTT messages, despite being connect to my MQTT broker on HASSIO, and being set to do so in developer settings. I have copied instructions from Rob at the Hookup. He has a github with the HASSIO setting. Like so:
- platform: mqtt
schema: template
name: "Comms Lighting"
command_topic: "shellies/shellyrgbw2-661bb0/color/0/set"
state_topic: "shellies/shellyrgbw2-661bb0/color/0/status"
effect_list:
- 0
- 1
- 2
- 3
- 4
- 5
- 6
command_on_template: >
{"turn": "on"
{%- if brightness is defined -%}
, "gain": {{brightness | float | multiply(0.3922) | round(0)}}
{%- endif -%}
{%- if red is defined and green is defined and blue is defined -%}
, "red": {{ red }}, "green": {{ green }}, "blue": {{ blue }}
{%- endif -%}
{%- if white_value is defined -%}
, "white": {{ white_value }}
{%- endif -%}
{%- if effect is defined -%}
, "effect": {{ effect }}
{%- endif -%}
}
command_off_template: '{"turn":"off"}'
state_template: "{% if value_json.ison %}on{% else %}off{% endif %}"
brightness_template: "{{ value_json.gain | float | multiply(2.55) | round(0) }}"
red_template: '{{ value_json.red }}'
green_template: '{{ value_json.green }}'
blue_template: '{{ value_json.blue }}'
white_value_template: '{{ value_json.white }}'
effect_template: '{{ value_json.effect }}'
qos: 2
I set up and turn on MQTT in the shelly device and have triple checked the user and passwords, and mqtt host and port are all correct.
Mosquitto broker shows the device is connected ok.
1564464528: New client connected from 192.168.1.247 as shellyrgbw2-661BB0 (p2, c1, k30, u'mqttusername').
My Mosquitto settings are as follow:
{
"logins": [],
"anonymous": false,
"customize": {
"active": true,
"folder": "mosquitto"
},
"certfile": "fullchain.pem",
"keyfile": "privkey.pem"
}
I have an ACL.conf file setup with an access control list that incluses this HASSIO user to publish to all topics. topics #
When I operate the light in Hassio MQTTlens shows the message being sent to the topic defined in the light setup.
The problem is the shelly device doesn’t seem to receive or send any MQTT messages. I’ve had a similar problem the the shelly 2.5 and shelly 1 and just kept changing setting and they seemed to just sudden start working, so there must be some random setting that I’m not getting quite right.