Shelly Cloud - new Component? How to implement it? API is available

lights.yaml - For light switch

  - platform: mqtt
    name: "Light Sofa"
    state_topic: "shellies/shelly1-XXXXXX/relay/0"
    command_topic: "shellies/shelly1-XXXXXX/relay/0/command"
    qos: 2
    payload_on: "on"
    payload_off: "off"
    retain: false
    optimistic: false

The configuration for lights is with default firmware or tasmota?

1 Like

That config is for the shelley firmware.

Default firmware

Although mqtt is available I would love a component to be done. I want to keep Alexa functions and for that we need to have shelly with cloud access.

1 Like

Isn’t this it? https://gist.github.com/ispiropoulos/90a5f215e71f4dde635e3e3407fb5804 Custom component, but looks clean enough
my Shellys are in transit, so don’t know how well it works yet.

Hi
i have a shelly1, mqtt enable with the settings:
Clean Session on
Retain on
Max QoS 2

In Hass.io, in my config:
- platform: mqtt
name: “Shelly_Entrada_LuzPuerta”
state_topic: “shellies/shelly1-1CF901/relay/0”
command_topic: “shellies/shelly1-1CF901/relay/0/command”
qos: 1
payload_on: “on”
payload_off: “off”
retain: false
optimistic: false

the shelly is connected to a wall switch (to control a entry door light).

I see the switch in HA, but always off and if i try to turn on, it get back to off in a couple of seconds.

What could be wrong?

P.S. i had some sonoff, with espurna and tasmota, and full control with HA, the mqtt server is the hass.io default.

Thanks!

When that happens, it usually means that the Shelly is not available to HA.

Either off line or not configured correctly.

Get a copy of MQT Lens from the chrome app store and see if you can publish and subscribe to it using the topics in your config.

You can configure as many switches you like and they’ll show up and operate just how you are experiencing, without them physically existing. Chances are that’s what you’ve got going on.

Thanks @ashscott
I use MQTT.fx and i could subscribe to shellies/shelly1-1CF901/relay/0/command, but i’m new with mqtt and i doin’t know how to properly check (publish?) if the mqtt client of the shelly is working fine.

Will try with mqttlens when i get back home and post a screenshot :smiley:

@mrodrigues take a look here and here

1 Like

This is example of configuration with availibity for firmware 1.4.4:


You have to add autoaton rule to announce Shelies at HA start:

2 Likes

Ok, a little embarrasing, i just forgot to put the 1883 port to the ip in the shelly settings :smiley:
Works now!

Ok. thanks for that.

Just to clarify


Do I need to add the “shellies/shellyswitch-5B2604/online” to the “Will Topic” in the Shelly configuration WebUI? Obviously I would change the detail of the center section to my own details (in my case “shellies/shelly1-32CADF/online”).

What then do I put in the “Will Message” section?

Could you post a screenshot of your webui showing that section of the config?

You have to use default settings like this:

shellies/shellyswitch-XXXXXX/online for Shelly2

Thanks!

Working good now.

My shelly 1 default topics are in the form of “shellies/shelly1-32CADF/relay/0”, “shellies/shelly1-32CADF/relay/0/command” and “shellies/shelly1-32CADF/online”. I had that part correct so it was the proper “Will Message” that was tripping me up.

Hi @Bieniu

what is unique_id for? Is it mandatory ?

Do I need to have retain to true? I prefer to have it to false.

Thanks

unigue_id isn’t mandatory. It will give you entity_registry support.

This is the entity of my Shelly1 with the changed name using the entity registry.
image
image

1 Like

where did you find the documentation for that being an option?

it’s not listed in the options on the component page for the MQTT switch. I haven’t really looked anywhere else aside from an unfruitful quick google search


(and yes, I caught the mis-spelling and searched for “unique_id”)

I added this option and information about it to the documentation a few months ago. The documentation changed when the devices registry was added. You can use unique_id with all MQTT entities (switch/light/sensor/fan/binary_sensor/etc.)

do you have a link?

i looked in the docs for the mqtt switch and i didn’t see it there.