Shelly 1 (mqtt) always unavailable after HA restart

I’m having the same issue but only for my roller shutters and shelly 2.5, the Shelly Plug S works without any trouble.

Usually if I restart Mosquitto after HA it works, but it is a bummer.

Cheers.

hi there,
i have the same problem, when restar HA, my shelly 2.5 roller shutter (mqtt) doesn’t works, i need to restart all shelly 2.5.
some one can help me? thanks

where i paste this?

You might want to try the Shelly integration which has superceded the old manual method for setup.

Search te forum for ‘Shellies discovery script’

if you are using mqtt, just send announce request to shelly topic a few secs after HA start. it’s the cleanest and most reliable way.
You can copy paste it from mentioned discovery script solution.

I cannot recomend discovery script as a whole because it forces you to use default sensor/entity names as well as mqtt topics making configuration limited. which is not its fault but mqtt intergration and its autodiscovery

I have question maybe you can answer me… do you have also installed Shelly behind the switch?

What i want is to install the Shelly behind the switch and use a smart bulb so i cen set the color. (That smart bulb is also connected via MQTT to HASS)

My target is always be able to use the switch turn on and turn on the bulb. But i will create a scene that when a sensor is triggered at night the color of the bulb should be go BLUE. (Also when the switch is turned off via)

-> Important think is can i do that, ok, i have turned off the light via the switch but shelly have all the time connection via MQTT, right?
-> Do i need to do something with Switch mode on the shelly app or something like that for that?

Hmmm… I think I can see what you are getting at. My Shelly 1 is actually installed in the ceiling, as I don’t have neutral to the switch here in the UK, but the principle would be the same.

You could probably achieve what you want with an automation and conditional service template - https://www.home-assistant.io/docs/automation/templating/

Use the trigger when the shelly tunrs on, condition depending on time of day, action to change the colour of your smart bulb.

Ah ok. On the ceiling. But are you now using the wall switch well? if the switch is down, you can’t turn on the light via the app right?

Another option what i am seeing is the Edge mode on Shelly. Should that be maybe possible or does this also cut off the electricitiy so i have then no more power on the bulb from HASS?

All of this modes, is that also possible on another firmware such as ESP or Tasmota?

Mine is wired like this:

But it doesn’t really matter whether it is in the ceiling or behind the switch. The shelly has a switch input, so you can turn it on/off either by the physical switch, or using the app/MQTT. If you turn off via the app, you would have to turn the physical switch off then on again to turn it back on.

Turning off the physical switch does not cut the power to the shelly - it just changes the switched state. The shelly also requires a permanent live.

Great idea, works like a charm :slight_smile:

Hi everyone, i hope that this thread is the right one to post my issue:

i have the following switch definition:

## switch 1pm condizionatore samsung camera Matilde
- name: "condizionatore_samsung"
  state_topic: "shellies/condizionatore_samsung/relay/0"
  command_topic: "shellies/condizionatore_samsung/relay/0/command"
  availability_topic: "shellies/condizionatore_samsung/online"
  qos: 2
  #value_template: "{% if value == 'on' %} on {% else %} off {% endif %}"
  payload_on: on
  payload_off: off
  payload_available: true
  payload_not_available: false
  optimistic: false
  retain: true

and the following automation:

- alias: "Periodic Shelly Announce Command"
  id: 'shelly_announce_command'
  trigger:
    platform: time
    at: "20:00:00"
  action:
  - delay: 00:00:20
  - service: mqtt.publish
    data:
      topic: shellies/command
      payload: announce

but the entity is unavailable (and all the other entities defined in pretty much the same way.
Does anyone know if am i missing something?
Thanks in advance,
Luca

download mqtt explorer, and use it to validate if mentioned shelly is connected (if expected topic is created and online subtopic is set to true

1 Like

I solved the problem, the issue was pretty easy: the boolean in the switch declaration are not matched as boolean, but they must be declared as string, so:

## switch 1pm condizionatore samsung camera Matilde
- name: "condizionatore_samsung"
  state_topic: "shellies/condizionatore_samsung/relay/0"
  command_topic: "shellies/condizionatore_samsung/relay/0/command"
  availability_topic: "shellies/condizionatore_samsung/online"
  qos: 2
  #value_template: "{% if value == 'on' %} on {% else %} off {% endif %}"
  payload_on: 'on'
  payload_off: 'off'
  payload_available: 'true'
  payload_not_available: 'false'
  optimistic: 'false'
  retain: 'true'