Shelly 1 Auto Off

Hello,

I have a Shelly 1 Switch which I want to use to control my garagedoor.

I have flashed the Shelly 1 with Sonoff Firmware and configured MQTT.

So far it is working but I have to issues:

The switch should:

  1. Off after an Poweroutage
  2. AutoOff after 3 seconds after I have activated the switch

Is this somehow possible with Sonoff or would it be possible with the Tasmota Firmware or do I need to configure it manually on Home Assistant?

Br,
Johannes

Did not know you could flash sonoff firmware to Shelly. An astonishing accomplishment, as you can’t even flash sonoff firmware from one device to another and have it working. Good job !!!

About your other question : with tasmota firmware, look at poweronstate and pulsetime.

PowerOnState Control relay state after powering up the device.
0 / OFF = keep relay(s) OFF after power up

PulseTime Display the amount of PulseTime remaining on the corresponding Relay
<value> Set the duration to keep Relay ON when Power<x> ON command is issued. After this amount of time, the power will be turned OFF .
0 / OFF = disable use of PulseTime for Relay
1..111 = set PulseTime for Relay in 0.1 second increments
112..64900 = set PulseTime for Relay, offset by 100, in 1 second increments. Add 100 to desired interval in seconds, e.g., PulseTime 113 = 13 seconds and PulseTime 460 = 6 minutes (i.e., 360 seconds)
SwitchDebounce User control over switch debounce timing

Hi,

Forget my answer about “Sonoff”. My mistake - it was already a Tasmota Firmware, but called sonoff.bin

I followed the action you suggested and it looked like it worked, but there is still a little issue.

I have set

PowerOnState 0
PulseTime1 20

But If I remove power from the shelly and add again, then the Output goes to On for the defined PulseTime. But it shouldnt go on, after Power restored…

In the terminal I can see:

00:00:00 CFG: aus Flash geladen am F7, zählen 61
00:00:00 Projekt tasmota shelly1-2 Version 8.3.1(tasmota)-2_7_1
00:00:00 WIF: verbinden mit AP1 XYZ Channel 5 BSSId  in Modus 11N als shelly1-2-6507...
00:00:12 WIF: Verbindung fehlgeschlagen, da der AP nicht antwortet (timeout)
00:00:13 WIF: verbinden mit AP1 XYZ in Modus 11N als shelly1-2-6507...
00:00:22 WIF: verbunden
00:00:22 HTP: Web-Server aktiv bei shelly1-2-6507 mit IP-Adresse x.x.x.x
09:50:37 MQT: Verbindungsversuch...
09:50:37 MQT: verbunden
09:50:37 MQT: tele/shelly1-2/LWT = Online (beibehalten)
09:50:37 MQT: cmnd/shelly1-2/POWER = 
09:50:37 MQT: tele/shelly1-2/INFO1 = {"Module":"Shelly 1","Version":"8.3.1(tasmota)","FallbackTopic":"cmnd/DVES_77396B_fb/","GroupTopic":"cmnd/tasmotas/"}
09:50:37 MQT: tele/shelly1-2/INFO2 = {"WebServerMode":"Admin","Hostname":"shelly1-2-6507","IPAddress":"x.x.x.x"}
09:50:37 MQT: tele/shelly1-2/INFO3 = {"RestartReason":"Power On"}
09:50:37 MQT: stat/shelly1-2/RESULT = {"POWER":"OFF"}

Strange.

https://tasmota.github.io/docs/PowerOnState/

Your log shows :

09:50:37 MQT: stat/shelly1-2/RESULT = {"POWER":"OFF"}

You really did cut the power ?

PowerOnState Control relay state after powering up the device.
0 / OFF = keep relay(s) OFF after power up
1 / ON = turn relay(s) ON after power up
2 / TOGGLE = toggle relay(s) from last saved state
3 = switch relay(s) to their last saved state (default)
4 = turn relay(s) ON and disable further relay control
5 = after a PulseTime period turn relay(s) ON (acts as inverted PulseTime mode)

The PowerOnState device configuration parameter is applied when the device is initially powered up. It does not apply to device warm restarts .

Tasmota tracks the relays’ state in a masked variable. A set bit ( 1 ) means the corresponding relay is turned ON. The associated GPIO state will be high or low according to whether the relay is configured as Relay<x> or Relay<x>i . Every command for setting the relay state is “recorded” in the variable and saved to flash (depending on SetOption0 ). The setting of the relay GPIO is then executed.

I post more from the Log:

09:50:37 MQT: tele/shelly1-2/LWT = Online (beibehalten)
09:50:37 MQT: cmnd/shelly1-2/POWER = 
09:50:37 MQT: tele/shelly1-2/INFO1 = {"Module":"Shelly 1","Version":"8.3.1(tasmota)","FallbackTopic":"cmnd/DVES_77396B_fb/","GroupTopic":"cmnd/tasmotas/"}
09:50:37 MQT: tele/shelly1-2/INFO2 = {"WebServerMode":"Admin","Hostname":"shelly1-2-6507","IPAddress":"x.x.x.x"}
09:50:37 MQT: tele/shelly1-2/INFO3 = {"RestartReason":"Power On"}
09:50:37 MQT: stat/shelly1-2/RESULT = {"POWER":"OFF"}
09:50:37 MQT: stat/shelly1-2/POWER = OFF
09:50:37 MQT: stat/shelly1-2/RESULT = {"POWER":"ON"}
09:50:37 MQT: stat/shelly1-2/POWER = ON
09:50:39 MQT: stat/shelly1-2/RESULT = {"POWER":"OFF"}
09:50:39 MQT: stat/shelly1-2/POWER = OFF
09:50:41 MQT: tele/shelly1-2/STATE = {"Time":"2020-06-28T09:50:41","Uptime":"0T00:00:30","UptimeSec":30,"Heap":28,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"POWER":"OFF","Wifi":{"AP":1,"SSId":"XYZ","BSSId":"","Channel":5,"RSSI":32,"Signal":-84,"LinkCount":1,"Downtime":"0T00:00:24"}}
09:50:41 MQT: tele/shelly1-2/SENSOR = {"Time":"2020-06-28T09:50:41","Switch1":"OFF"}

I have really disconnected the power

That is unexpected behavior. Maybe post this question here :
https://groups.google.com/forum/#!forum/sonoffusers

There are some real tasmota experts there.

I guess I found the issue.

I configured the Switch on Home Assistant with MQTT and “Retain: true”.
As I am only setting “on” via HA I think this is the issue.

Br,
Johannes

MQTT and Retain. It always amazes me how many people use it while they don’t understand it.

Somewhere we have to step in :slight_smile:

But it seems it was not the issue. Changed to “false” but I still have the same behaviour

Br,
Johannes

That’s another problem with retain. Once you added the retain flag in homeassistant, it’s stuck in the mqtt database. Even if you remove ‘retain’ from homeassistant, your mqtt broker will still send retained messages.
The easiest way to get rid of it is to install mqtt explorer, and delete it there.

Thanks for that good hint!

Hello all
Although the title is my problem, I see here the conversation is more around mqtt.
n
Mi issue is: i have a shelly 1 as the plug for my IT rack. When mt truenas server powers off @ 23:30, the shelly 1 powers off too. I do not believe that these 2 occurrences are relate and IMHO it’s a mere coincidence.
I do not have any settings related to turning off the shelly 1 either in Home assistant or the shelly app
As part of the rack I have my network switch and this is turned off because of lack of power

when i the the plug on via the shelly app the plug remains on until the server is turned off the next evening
where could i look for the solution

Thank you in advance for reading this and for any response