Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User Timers #1091

Closed
wants to merge 16 commits into from
Closed

User Timers #1091

wants to merge 16 commits into from

Conversation

flexiti
Copy link

@flexiti flexiti commented Oct 29, 2017

I sent it from a temporary git repository that I have already removed (maybe too fast ), if there are any problems I can re-publish. 😉

#define USE_USERTIMERS //Local timers funcionality active
;;; if not defined, there is no user timers, only config memory is alocated for future compatibliity
;;; no extra code is generated if not defined

#define USE_USERTIMERSWEB // view user timers on WEB
;;; timer are programed via MQTT, if this define is active, also via WEB interface
;;; user timer code is generated , without web code

#define MAX_USERTIMERS 16 // fixed configuration memory max size , do not change it
;;; fixed max config size

#define USED_USERTIMERS 8 // realy used timers 1 to 16
;;; actualy used timers 8

13:09:54 MQT: main/sonoff/33/tele/STATE = {"Time":"2017-10-29T13:09:54", "Uptime":0, "POWER1":"OFF", "POWER2":"OFF", "Wifi":{"AP":1, "SSId":"T100", "RSSI":90, "APMac":"00:1E:8C:CE:F7:93"}, "UTimers":8}
;;; "UTimers":8 menas that we have used 8 timers ( info for other apk)

13:29:35 MQT: main/sonoff/33/tele/INFO1 = {"Module":"Witty Cloud", "Version":"5.8.0p", "FallbackTopic":"DVES_CD0211", "GroupTopic":"sonoffs", "UTimers":"8"}
;;; the same at startup module info

Command:
Topic: UTimer5
Payload: {"UTimer":{"UTrelay":2, "UTtime":"09:23","UTmode":1,"UTday":"21","UTonce":1}}
(Not all parameters must be specified)
;;; Command UTimer1 ... UTimer(USED_USERTIMERS)
;;; UTrealy = Relay no
;;; UTtime = action time
;;; UTmode = action type: 0 -nop, 1 -on, 2 -off
;;; UTday = day (2 digits Hex value, bit 0 - Mon, bit 1 Tue,...
;;; UTonce = one time action if 1, after that mode automaticly set to nop

Validation of the entry is weak, but it does not have bad affect to the sonoff.
You can add something here , For example, the time must only be in 06:30 format, not 6:30, but we use less memory 😉

13:10:03 CMD: UTimer1
;;; Timer status
13:10:03 MQT: main/sonoff/33/stat/RESULT = {"UTimer":{"No":1, "UTmode":"1", "UTtime":"12:11", "UTrelay":"1", "UTonce":"0", "UTday":"41"}}
;;; answer
User timer number 1, will on relay1 at 12:11 every monday and sunday

1
2
3

@zerog2k
Copy link

zerog2k commented Oct 30, 2017

+1 on this... was just looking through the codebase and issues to see if tasmota had schedule/timer feature support without explicit need for external command input

@lobradov
Copy link

lobradov commented Oct 30, 2017 via email

@roblad
Copy link

roblad commented Nov 28, 2017

Hi,

Do you plan to add timer for relays ?

@arendst
Copy link
Owner

arendst commented Nov 28, 2017

Nope. Not at this time.

@roblad
Copy link

roblad commented Nov 28, 2017

Hi,

Do you plan to add status of switch button state without relays set ?
see that
#1265

I discovered issue with Wemeos, that no commands button options not works at all either button or switch, I canot switch to AP reset to default etc.

@davidelang
Copy link
Collaborator

davidelang commented Nov 29, 2017 via email

@roblad
Copy link

roblad commented Nov 29, 2017

Hi,

It nice to have autonomus device, scheduler is always extent :-), BTW haw to use that timer set to relay start or stop after some period time i.e. 15 min after switch on, automaticaly switch off after that period time.

@davidelang
Copy link
Collaborator

davidelang commented Nov 29, 2017 via email

@roblad
Copy link

roblad commented Nov 29, 2017

Hi,

Haw to set for 15 min

112..64900 | Set PulseTime for relay with 1 seconds increment starting with 12 seconds (113 = 13 seconds etc.)

@davidelang
Copy link
Collaborator

davidelang commented Nov 29, 2017 via email

@roblad
Copy link

roblad commented Nov 29, 2017

Hi,

I did not think about it :-)
thanks

@ortegafernando
Copy link
Contributor

+1

@JPSINHA
Copy link

JPSINHA commented Feb 7, 2018

I am new user of Sonoff. I loaded the TASMOTA on my 4Ch Sonoff.
I want to use timer switching.
For it I tried to paste the code in i18n.h.
But at time of uploading some error message came .
How solve the problem?
What is actual way to configure timer.

@pvtien7
Copy link

pvtien7 commented Feb 23, 2018

@flexiti can you send me complete code for sonoff basic ??? i had changing code but error on arduino. thanks !!!

@ascillato
Copy link
Contributor

ascillato commented Feb 23, 2018

Hi @flexiti, I also would like the code. Thanks.

Edit: Tried the timers code on v5.12.0c but found that now there is a lot to update. Several internal variables from tasmota have changed. So should be needed a rework to adapt timers to new tasmota version.

@flexiti
Copy link
Author

flexiti commented Feb 24, 2018

The code was complete for the previous tasmota version, now there are some conflicts.
It works, I use it to control heating and lighting when energy is cheaper.
I could adopt it to this version, but the owner of Tasmot did not want it :)
roblad commented on 28 Nov 2017
hi,
Do you plan to add timer for relays?
arendst commented on 28 Nov 2017
Nope. Not at this time.

I suppose that new patterns for colored leds chains are more important ;)

If there is a demand, I can publish it in my fork

@pvtien7
Copy link

pvtien7 commented Feb 24, 2018

@flexiti if it's published in your fork, that wonderful

@flexiti flexiti mentioned this pull request Mar 1, 2018
@flexiti
Copy link
Author

flexiti commented Mar 9, 2018

It is published on:

https://github.com/flexiti/Sonoff-Tasmota branch usertimers
(It is forked from https://github.com/JacekDob/Sonoff-Tasmota)
Works on ESP8266 and ESP32
(ESP8266 compiled using Platformio, ESP32 compiled using Arduino)

Do not use //#define ONOFF_TEMPERATURE_LOWHIGH // timer on/off is temperature dependent
it is my use for heating ;)

@ascillato
Copy link
Contributor

Hi @arendst,

I have automated my patio watering for irrigation of my plants but there, my wifi is weak. So, using Home Assistant to tell Sonoff Tasmota to open valves is not an option. One solution can be using timers like the ones proposed by @flexiti. Timers are an alternative. Can be added this feature to the main version as an optional?

I tested that version and works but would be great to have that on the main tasmota 😄

@on-off-on
Copy link

on-off-on commented Mar 22, 2018

Is there relly no chance to force the implementation of a timer in the "original" repository a simple timer function based on a electronic timer? :-// It would be a great feature for users like me to have "one" firmware to switch with commands from a controller e.g. FHEM and a simple timer function within the unit for areas without WLAN or LAN-access. I would like to have a timer for security reason during my holiday.... without connection to FHEM-controller...
The forked timer doesn´t work and I´m unable to find the issue :-/

@arendst
Copy link
Owner

arendst commented Mar 22, 2018

Convinced.

I'll start working on timers keeping in mind the current @flexti implementation as documented in this PR but as a separate xdrv_09_timers.ino file.

Stay tuned...

@arendst arendst added the enhancement Type - Enhancement that will be worked on label Mar 22, 2018
@ascillato
Copy link
Contributor

ascillato commented Mar 22, 2018 via email

arendst added a commit that referenced this pull request Mar 23, 2018
5.12.0i
 * Add 16 timers using commands Timer and Timers (#1091)
@ionciubotaru
Copy link

Timers are great and useful. Please consider replacing Device with backlog., because it's great flexibility.
Instead of Timer1 {"Arm":1,"Time":"09:23","Days":"--TW--S","Repeat":1,"Device":1,"Power":1}
use: Timer1 {"Arm":1,"Time":"09:23","Days":"--TW--S","Repeat":1,"backlog":"power1 1;power2 0;power3 2"}

@arendst
Copy link
Owner

arendst commented Mar 24, 2018

@ionciubotaru Nice idea but would take too much storage as the backlog string will need to be cached. So for now you will have to setup three different timers. That's why you have sixteen of them :-)

@on-off-on
Copy link

on-off-on commented Mar 24, 2018

Many thanks!!! for the timerfunction -it works great 👍

At time I have two newbie questions:
-whats the correct way to delete an added timer entry?
-is in the GUI an entry for "config timer" planned -as listed in the first thread of /1091? that the timer is available for "everyone"?

@arendst
Copy link
Owner

arendst commented Mar 28, 2018

To "delete" a timer you could set Arm to disable (0) or in the next release use command Timer<x> 0 to clear all values of the timer. This release will also allow copying timers with command Timer<x> 1..16

I'm working on an optional "small" web config page. Have it functional but still too big for production (7k).

image

@ascillato
Copy link
Contributor

Works Great!!!

Thanks!! 👍

@arendst arendst closed this Mar 29, 2018
@Stevehans
Copy link

Stevehans commented Apr 6, 2018

Would be great to see this integrated with #481, have a power option of auto which would then allow entry of upper and lower limits

@curzon01 curzon01 mentioned this pull request Apr 9, 2018
@apastuszak
Copy link

apastuszak commented Apr 10, 2018

Is this implemented in the current 5.12 release? I'm not seeing a timer option in the menu?

@Jason2866 Jason2866 mentioned this pull request Apr 17, 2018
curzon01 pushed a commit to curzon01/Tasmota that referenced this pull request Sep 6, 2018
5.12.0i
 * Add 16 timers using commands Timer and Timers (arendst#1091)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Type - Enhancement that will be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.