By the looks of the API docs both Shelly1 and 2 supports toggle. Have a look at the btn_type option http://shelly-api-docs.shelly.cloud/#shelly-switch-settings-relay-index.
This is my config running with a shelly1 as a light switch and a shelly2 as a roller shutter.
Enable MQTT on your shelly’s, and configure your mqtt broker (I’m using mosquitto in the same PI I’m running HA).
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
**covers.yaml ** - For roller shutter
- platform: mqtt
name: "Living Room roller"
state_topic: "shellies/shellyswitch-XXXXXX/roller/0" # Returns open,close while in motion, stop when not moving
command_topic: "shellies/shellyswitch-XXXXXX/roller/0/command" # Accepts open, close, stop
payload_open: "open"
payload_close: "close"
payload_stop: "stop"
state_open: "open"
state_closed: "close"
retain: false
optimistic: false
qos: 2
**sensors.yaml ** - For roller shutter power consumption
- platform: mqtt
state_topic : "shellies/shellyswitch-32BF3D/relay/power"
unit_of_measurement: "W"
name: "Living room shutter consumption"
Hope it helps
@ cinzas
**covers.yaml ** - For roller shutter do not work for me. commands will never come to the device.
Theese commands are working, but the buttons (up, stop, down) will not be updated.
platform: mqtt
state_topic: "shellies/shellyswitch-5B2502/roller/0"
command_topic: "shellies/shellyswitch-5B2502/roller/0/command"
name: "Rollladen Office"
qos: 2
retain: false
optimistic: false
payload_open: "open"
payload_close: "close"
payload_stop: "stop"
open_cover:
- service: mqtt.publish
data:
topic: 'shellies/shellyswitch-5B2446/roller/0/command'
payload: 'open'
close_cover:
- service: mqtt.publish
data:
topic: 'shellies/shellyswitch-5B2446/roller/0/command'
payload: 'close'
stop_cover:
- service: mqtt.publish
data:
topic: 'shellies/shellyswitch-5B2446/roller/0/command'
payload: 'stop'
availability_topic do also not work, allready saved as Will Topic / Will Message on the device shellyswitch-5B2446.
availability_topic: "shellies/shellyswitch-5B2446/LWT"
How can I fix this?
That’s strange.
I don’t need the close_cover and stop_cover.
Are you using mosquitto? Can you run
# mosquitto_sub -v -h 127.0.0.1 -p 1883 -t '#'
And listen to what is happening in the broker
My buttons work and they reflect what I manually do, because the shelly switch send to the broker what is happening in the switch
thanks cinzas, mosquitto_sub works well.
Use a lot of other devices and all works.
switches and covers
mqtt sensors
When I test the shellies/shellyswitch-XXXXXX/roller/0/command with node-red, the commands will work. Only when I use your covers.yaml nothing happens.
I use Home Assistant 0.82.0
I can see a lot of warning when I use the settings:
- platform: mqtt
state_topic: "shellies/shellyswitch-5B2502/roller/0"
command_topic: "shellies/shellyswitch-5B2502/roller/0/command"
name: "Rollladen Office"
qos: 2
retain: false
optimistic: true
payload_open: "open"
payload_close: "close"
payload_stop: "stop"
open_cover:
- service: mqtt.publish
data:
topic: 'shellies/shellyswitch-5B2446/roller/0/command'
payload: 'open'
close_cover:
- service: mqtt.publish
data:
topic: 'shellies/shellyswitch-5B2446/roller/0/command'
payload: 'close'
stop_cover:
- service: mqtt.publish
data:
topic: 'shellies/shellyswitch-5B2446/roller/0/command'
payload: 'stop'
Messages
Commands open, close, stop will work. But the buttons will not reflect when I manually do.
What I doing wrong ???
is it possible to add the ultrasound or magnetic sensor to the shelly 1 and use it as a garage door opener?
thanks
I used this and it works great - thank you.
Did you get it working?
@ ashscott
Negative.
The problem is that the Shelly2 always reports only the current status (close, open, stop). If the shutter is closed, then “close” is reported and at the end “stop”. Thereafter, always “stop” is reported.
With me it is so that when opening or closing the buttons are activated. The status “STOP” is not displayed.
I hope that the MQTT messages will be revised with a new firmware and more information will be provided. The way via REST is also limited, because there are not all status messages available.
Since I have no other firmware (Tasmota would be an alternative) to flash over OTA, I have to wait for the firmware to improve.
Maybe give the Shelly 2 beta a try. The link can be found on the Shelly Facebook support page.
Thanks. But I can not found any information for Shelly 2 Beta on Shelly support group (English Version). Is it possible to flash the Firmware over OTA ?
Thanks, OTA works and I have the beta version installed. Unfortunately, no changes, only that MQTT is not as stable as before.
I try also to flash the “tasmota” firmware over OTA, unfortunately it did not work
http://<deviceIP>/ota?url=http://sonoff.maddox.co.uk/tasmota/sonoff-minimal.bin
Hi @cinzas
I just “copied” your cover configuration for roller shutter in my configuration.yaml
and here it is
cover:
- platform: mqtt
name: "Tenda sala"
state_topic: "shellies/shellyswitch-xxxxxx/roller/0" # Returns open,close while in motion, stop when not moving
command_topic: "shellies/shellyswitch-xxxxxx/roller/0/command" # Accepts open, close, stop
payload_open: "open"
payload_close: "close"
payload_stop: "stop"
state_open: "open"
state_closed: "close"
retain: false
optimistic: false
qos: 2
but then I don’t see anything in Developer States looking for cover in the Entity field.
What am I doing wrong?
Thanks
EDIT:
Now it’s working!!!
But strange thing is this.
If I press Open or Close and then Stop, the Open or Close buttom remain greyed out and I can’t press it again.
I need to press the opposite, Close if I pressed Open and vice versa, to get again working.
For example if I press the Open button for 5 secs and then Stop, and I want to Open the shutter a little more, I can’t, unless I Close a bit, Stop and then Open.
Is it my configuration wrong or it works like this?
According to the description it should now support intermediate openings so that you can set it to say 47% open. It keeps a constant watch on time to achieve the extremes of open and closed and then opens it to the required percentage.
I can’t physically try that yet as I’ve not yet connected it my garage door.
F[quote=“cinzas, post:62, topic:54228”]
- 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
[/quote]
Can you share your settings on shelly mqtt settings? Did you define a topic there?
Because I installed a shelly one but cannot get it to appear in HA. Mosquito discovered the device on the device ip address but it won’t appear in my HA config. Any ideas?
Configuration yaml is the same as mentioned before (with own device id off course)
Thanks
Edit: got it to work, don’t know the problem
I’ve changed yesterday my config and now it’s working “correctly” or as I want to be.
- platform: mqtt
name: "Tenda sala"
state_topic: "shellies/shellyswitch-xxxxxx/roller/0" # Returns open,close while in motion, stop when not moving
command_topic: "shellies/shellyswitch-xxxxxx/roller/0/command" # Accepts open, close, stop
payload_open: "open"
payload_close: "close"
payload_stop: "stop"
state_open: "open"
state_closed: "close"
state_stop: "stop"
retain: false
optimistic: false
qos: 0
position_open: 100
position_closed: 0
value_template: '{{ value.x }}'
On the Shelly Facebook page.
Sorry for the delay replying
For me it was working perfect (still works)
I will try later using your config with the value template
Thanks