Timers on if wifi not connection

620 views
Skip to first unread message

Marcin Wachcinski

unread,
Oct 11, 2022, 7:38:11 PM10/11/22
to TasmotaUsers
Hello. What rule to set in Tasmota to activate the timers after no connection to wifi, and vice versa, if the connection to wifi is to turn off the timers?

Philip Knowles

unread,
Oct 12, 2022, 2:18:06 AM10/12/22
to Marcin Wachcinski, TasmotaUsers
Can you explain what you are trying to achieve? Tasmota needs a WiFi connection (actually a connection to an NTP server) for timers to work.


From: sonof...@googlegroups.com <sonof...@googlegroups.com> on behalf of Marcin Wachcinski <wach...@gmail.com>
Sent: Wednesday, October 12, 2022 12:38:11 AM
To: TasmotaUsers <sonof...@googlegroups.com>
Subject: Timers on if wifi not connection
 
Hello. What rule to set in Tasmota to activate the timers after no connection to wifi, and vice versa, if the connection to wifi is to turn off the timers?

--
You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/sonoffusers/6d4c5af7-2d17-46c9-89b7-6799050cc2e8n%40googlegroups.com.

Andrew L

unread,
Oct 12, 2022, 2:23:17 AM10/12/22
to TasmotaUsers
In theory, you could do a boot time rule to manually set the time to allow timers to work, but obviously that would give you wrong time, just the ability to use them. Other option is to custom build a firmware with RTC and DS3231 drivers, that way once the time is set in them (with a network connection or manually) the time will remain accurate if the unit is restarted without wifi. A RTC module only costs $2-3.

Philip Knowles

unread,
Oct 12, 2022, 2:48:21 AM10/12/22
to Andrew L, TasmotaUsers
Tasmota tries to connect to NTP every hour. Bear in mind that the original purpose of Tasmota was to use MQTT (the M in Tasmota) so it expects WiFi and tends to do things like reset if it can't find WiFi. It's probably better to use a different firmware (like Arduino) rather than try to work round fundamental parts of Tasmota.
From: sonof...@googlegroups.com <sonof...@googlegroups.com> on behalf of Andrew L <pkkr...@gmail.com>
Sent: Wednesday, October 12, 2022 7:23:17 AM
To: TasmotaUsers <sonof...@googlegroups.com>
Subject: Re: Timers on if wifi not connection
 
In theory, you could do a boot time rule to manually set the time to allow timers to work, but obviously that would give you wrong time, just the ability to use them. Other option is to custom build a firmware with RTC and DS3231 drivers, that way once the time is set in them (with a network connection or manually) the time will remain accurate if the unit is restarted without wifi. A RTC module only costs $2-3.

On Tuesday, October 11, 2022 at 11:38:11 PM UTC wach...@gmail.com wrote:
Hello. What rule to set in Tasmota to activate the timers after no connection to wifi, and vice versa, if the connection to wifi is to turn off the timers?

--
You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.

Andrew L

unread,
Oct 12, 2022, 3:19:14 AM10/12/22
to TasmotaUsers
I've had pretty good success turning off MQTT (Setoption3 0) and using a RTC chip along with setting time manually (which turns off the NTP requests). That seems to get rid of most of the failure modes and I get a pretty stable standalone system.

Marcin Wachcinski

unread,
Oct 12, 2022, 3:44:14 AM10/12/22
to TasmotaUsers
Tasmota controls my heating. I am from Poland and there is a cheap electricity tariff here at certain times. I also have solar panels. Normally Tasmota is controlled by the MQTT. It gives a signal whether there is a cheap electricity tariff and what is the production from photovoltaic panels. The device from Tasmota often loses the wifi signal and NodeRed cannot control it. In such a situation, I would like to activate Timers

benjam...@t-online.de

unread,
Oct 12, 2022, 4:30:51 AM10/12/22
to TasmotaUsers
Not trying to be smart, but wouldn't it be better to solve the underlying problem (poor WIFI), instead of wasting time on workarounds? Get the signal to the device. An directed antenna on the router side maybe, or a repeater, power line. I would start there.

Andrew L

unread,
Oct 12, 2022, 6:33:02 AM10/12/22
to TasmotaUsers
As long as it can connect intermittently, NTP should occasionally sync, so your time will be ok, and timers should work normally.  Try this:

on wifi#disconnected do timer1 1 endon

or on wifi#disconnected do timers 0 endon

if you need to evaluate time of day when wifi disconnects so you can activate relays, you can use events like so:

rule1
on wifi#disconnected do rule2 1 endon
on wifi#connected do rule2 0 endon

rule2
on time#minute do event t1=%value% endon 
on event#t1==630 do var2 3 (or power1 1, or whatever) endon
on event#t1==1233 do power3 0 endon

That way the triggers only activate when wifi is disconnected, so MQTT messages are no longer controlling your relays.
Reply all
Reply to author
Forward
0 new messages