MQTT Cover: Payload is not integer within range (Shelly2)

Hi,
I am new to Home Assistant.

I have issues with my Shelly2 roller relais.

I cannot connect to any of my relais. I did set them up to use MQTT, added my MQTT broker URL, user & password but in Home Assistant they remain “Unavailable”

Here is my current config for 1 cover (I have my cover settings outsourced into cover.yaml

### Office Roller 02 ###
- platform: mqtt
  name: "Office Roller 02"
  command_topic: "shellies/shellyswitch-DEVICEID/roller/0/command"
  position_topic: "shellies/shellyswitch-DEVICEID/roller/0/pos"
  availability_topic: "shellies/shellyswitch-DEVICEID/online"
  set_position_topic: "shellies/shellyswitch-DEVICEID/roller/0/command/pos"
  qos: 0
  retain: false
  payload_open: "OPEN"
  payload_close: "CLOSE"
  payload_stop: "STOP"
  position_open: 100
  position_closed: 0
  payload_available: "online"
  payload_not_available: "offline"
  optimistic: false
  value_template: '{{ value.x }}'

DEVICEID is just a placeholder. Of course, I have the correct device ID set :slight_smile:

In home-assistant.log I have several entries with this message

WARNING (MainThread) [homeassistant.components.mqtt.cover] Payload is not integer within range:

I have two Sonoff devices (with Tasmota) connected as well through MQTT and they are working fine.

My Shelly2 interface settings:

What I think is quite weird - I can get the sensor information! Here my config for this device:

### Office Roller 02 ###
- platform: mqtt
  name: "Office Roller 02 Power"
  state_topic: "shellies/shellyswitch-DEVICEID/relay/power"
  unit_of_measurement: "Watts"
- platform: mqtt
  name: "Office Roller 02 Energy"
  state_topic: "shellies/shellyswitch-DEVICEID/relay/energy"
  unit_of_measurement: "kWh"

If I fire the status command in my terminal I receive the correct staus of the device (open / stop / close).

# status
mosquitto_sub -h 192.168.0.77 -p 1883 -u USERNAME -P PASSWORD -t shellies/shellyswitch-DEVICEID/roller/0

Try to activate “Retain” on your Shelly2 config. Had the same problem and solved this way.

Thanks @glitch! I will give it a try!

Hello, any updates? Did this solve your problem? I have the exact same problem, and also the error ‘payload is not integer within range’.
Retain in the shelly-settings did not solve the problem…

Same here.
Sometimes they work well but almost all the time they are unavailable by mqqt.
The retain solution didn’t work.
When I change the configuration in the shelly app, the devices start working by mqqt but some minutes later they back to unavailable by mqqt.
Any help?