ioBroker Forum


Nutzungsbedingungen |Datenschutzrichtlinie
Cloud |Dokumentation
Aktuelle Zeit: 19.11.2017, 09:29

Alle Zeiten sind UTC+01:00




Ein neues Thema erstellen  Auf das Thema antworten  [ 15 Beiträge ] 
Autor Nachricht
 Betreff des Beitrags: Timers, Events & Stuff
BeitragVerfasst: 23.10.2017, 19:50 
Offline
starter

Registriert: 06.06.2017, 20:10
Beiträge: 14
I was wondering if anyone ever made a timer in ioBroker.
Like switch on a lamp but switch it off after 5 minutes.

But there is more ...

Every time an specific event happens (like a Motion detector is set off) it resets back to 5 minutes.

Could I use the JS controller for that and fire it off for every specific timer ?

_________________
--
[ HA : ioBroker/node-red/Domoticz(moving away) ]
[ Devices : rflink/mi-light/rf433/mpd/kodi/mqtt/sonoff/nodemcu/mysensors ]
[ OS : Running on Debian Linux ]


Nach oben
   
 Betreff des Beitrags: Timers, Events & Stuff
BeitragVerfasst: 23.10.2017, 19:59 
Offline
guru
Benutzeravatar

Registriert: 07.01.2016, 23:42
Beiträge: 1639
Hat sich bedankt: 37 Mal
Danksagung erhalten: 124 Mal
IcaruS hat geschrieben:
I was wondering if anyone ever made a timer in ioBroker.
Like switch on a lamp but switch it off after 5 minutes.

But there is more ...

Every time an specific event happens (like a Motion detector is set off) it resets back to 5 minutes.

Could I use the JS controller for that and fire it off for every specific timer ?


Hi Icarus and welcome!,

Sure you can there are several options to archive you goal depending how much experience in scripting you have.

I guess for your scenario the most feasible way would be to use the JavaScript adapter.
Within that you can choose to create code yourself or the blockly way to do.

There are some examples in this forum unfortunately in German but if you need help give a shout and I/we can post an example by blockly.

When doing please ensure you also always reset timers, did you already have a look at our JavaScript documentation:

https://github.com/ioBroker/ioBroker.ja ... /README.md

Or the related blockly documentation:

https://github.com/ioBroker/ioBroker.ja ... ckly_en.md


-------------------------
Send from mobile device


Nach oben
   
 Betreff des Beitrags: Re: Timers, Events & Stuff
BeitragVerfasst: 23.10.2017, 20:12 
Offline
starter

Registriert: 06.06.2017, 20:10
Beiträge: 14
Dutchman hat geschrieben:
IcaruS hat geschrieben:
I was wondering if anyone ever made a timer in ioBroker.
Like switch on a lamp but switch it off after 5 minutes.

But there is more ...

Every time an specific event happens (like a Motion detector is set off) it resets back to 5 minutes.

Could I use the JS controller for that and fire it off for every specific timer ?



Sure you can there are several options to archive you goal depending how much experience in scripting you have.


I do have some scripting experience... And can read and understand most stuff

Dutchman hat geschrieben:
I guess for your scenario the most feasible way would be to use the JavaScript adapter.
Within that you can choose to create code yourself or the blockly way to do.


I think I might go for the JS route

Dutchman hat geschrieben:
There are some examples in this forum unfortunately in German but if you need help give a shout and I/we can post an example by blockly.


When I did a google search 2 posts popped up ...

Dutchman hat geschrieben:
When doing please ensure you also always reset timers, did you already have a look at our JavaScript documentation:

https://github.com/ioBroker/ioBroker.ja ... /README.md



Yeah I think I will go the JS route ... had some bad experiences with Blockly in Domoticz ... (shifting from domoticz to ioBroker at the moment)
Wish there was some more extensive docs with examples on the JS adapter ;-)

Thanks for replying Dutch...
(I'm back to tinkering with my HA at the moment again ... Had a few busy months at work... so work hard, but no play)

_________________
--
[ HA : ioBroker/node-red/Domoticz(moving away) ]
[ Devices : rflink/mi-light/rf433/mpd/kodi/mqtt/sonoff/nodemcu/mysensors ]
[ OS : Running on Debian Linux ]


Nach oben
   
 Betreff des Beitrags: Re: Timers, Events & Stuff
BeitragVerfasst: 23.10.2017, 20:23 
Offline
guru
Benutzeravatar

Registriert: 07.01.2016, 23:42
Beiträge: 1639
Hat sich bedankt: 37 Mal
Danksagung erhalten: 124 Mal
So finally time to play ;-)

If you need assistance give a shout we are willing to help :-)
I can imagine searching a German forum could be a little hard for you.

Btw: may I ask which country is your origin?


-------------------------
Send from mobile device


Nach oben
   
 Betreff des Beitrags: Re: Timers, Events & Stuff
BeitragVerfasst: 23.10.2017, 20:30 
Offline
starter

Registriert: 06.06.2017, 20:10
Beiträge: 14
Dutchman hat geschrieben:
So finally time to play ;-)
Btw: may I ask which country is your origin?

You have to ask ?
LOL... look a bit back in the English Forum (Yep ... ben helaas Nederlands, Wij zijn de reden dat er een Nederlands gedeelte is opgezet :-P ...)

Was wondering how many Dutch people are using ioBroker

BTW: Isn't this a nice thing to put in a adaptor? (Adaptor has a few timers, which can be configured in the config, and if the script or settings publish a state ater the timer runs out ...)

_________________
--
[ HA : ioBroker/node-red/Domoticz(moving away) ]
[ Devices : rflink/mi-light/rf433/mpd/kodi/mqtt/sonoff/nodemcu/mysensors ]
[ OS : Running on Debian Linux ]


Nach oben
   
 Betreff des Beitrags: Re: Timers, Events & Stuff
BeitragVerfasst: 23.10.2017, 20:44 
Offline
guru

Registriert: 04.11.2014, 17:49
Beiträge: 2358
Hat sich bedankt: 130 Mal
Danksagung erhalten: 253 Mal
Hi,

fortunately there is an adapter for that: scenes

Choose a trigger, let's say your front door light's datapoint STATE. If it switches to true the scene is started. Within the scene configuration you can check more datapoints to be set to specific status, even with delays. Let's stay with the front door lamp.
In case you turn it on it will start the scene. The scene is set to turn it off after 300s (or 5min). Voilà!

The real benefit comes from the scalability to more datapoints. If you turn your lamp on (maybe triggered through a motion detector or you chose the datapoint of the motion detector itself) you can define more datapoints to be set. Turn on the stairway lights, play favorite music, set heating...

So, before diving into the deep waters of scripting try out scenes :D

Gruß,
Pix

_________________
Mac mini (OS X 10.12.6, node v4.8.4, npm v5.0.3), Redis, InfluxDB, VIS via iOS; gesteuerte Systeme: Homematic CCU2, Homepilot, Roomba, Sonos, XEOMA auf Odroid XU4; Adapter: feiertage, tvspielfilm, rtv, solarwetter, tankerkoenig, homepilot, epson_stylus_px830


Nach oben
   
 Betreff des Beitrags: Re: Timers, Events & Stuff
BeitragVerfasst: 23.10.2017, 20:50 
Offline
starter

Registriert: 06.06.2017, 20:10
Beiträge: 14
pix hat geschrieben:
So, before diving into the deep waters of scripting try out scenes :D

Gruß,
Pix


Lol... I should have looked closer at that then :P

_________________
--
[ HA : ioBroker/node-red/Domoticz(moving away) ]
[ Devices : rflink/mi-light/rf433/mpd/kodi/mqtt/sonoff/nodemcu/mysensors ]
[ OS : Running on Debian Linux ]


Nach oben
   
 Betreff des Beitrags: Timers, Events & Stuff
BeitragVerfasst: 23.10.2017, 21:21 
Offline
guru
Benutzeravatar

Registriert: 07.01.2016, 23:42
Beiträge: 1639
Hat sich bedankt: 37 Mal
Danksagung erhalten: 124 Mal
Lol sorry i forgot so welcome back!

@pix

Related to scenes, not that familiar with it yet, can you also cancel a timer there?

Use case: motion sensor states on and you turn on a lamp + define timer to set it off after x minutes.
If the "on" state is triggers again your want to cancel the current timer


-------------------------
Send from mobile device


Nach oben
   
 Betreff des Beitrags: Re: Timers, Events & Stuff
BeitragVerfasst: 23.10.2017, 21:25 
Offline
guru

Registriert: 04.11.2014, 17:49
Beiträge: 2358
Hat sich bedankt: 130 Mal
Danksagung erhalten: 253 Mal
Hi,

that depends :lol:

If you are switching a Homematic Actuator you can also set its ON_TIME Datapoint and it will manage that issue for you.

To be honest: I haven't try out yet. :oops:

Pix

_________________
Mac mini (OS X 10.12.6, node v4.8.4, npm v5.0.3), Redis, InfluxDB, VIS via iOS; gesteuerte Systeme: Homematic CCU2, Homepilot, Roomba, Sonos, XEOMA auf Odroid XU4; Adapter: feiertage, tvspielfilm, rtv, solarwetter, tankerkoenig, homepilot, epson_stylus_px830


Nach oben
   
 Betreff des Beitrags: Re: Timers, Events & Stuff
BeitragVerfasst: 23.10.2017, 21:47 
Offline
guru
Benutzeravatar

Registriert: 07.01.2016, 23:42
Beiträge: 1639
Hat sich bedankt: 37 Mal
Danksagung erhalten: 124 Mal
pix hat geschrieben:
Hi,

that depends :lol:

If you are switching a Homematic Actuator you can also set its ON_TIME Datapoint and it will manage that issue for you.

To be honest: I haven't try out yet. :oops:

Pix


Ok than I will have a closer look at scenes too.
Was just wondering as in regular scripting, blockly but also on a ccu you need to reset the timer itself and haven't seen that function in the scene adapter (yet)


-------------------------
Send from mobile device


Nach oben
   
 Betreff des Beitrags: Re: Timers, Events & Stuff
BeitragVerfasst: 24.10.2017, 23:02 
Offline
starter

Registriert: 06.06.2017, 20:10
Beiträge: 14
Scenes is not exactly what I'm looking for as it is triggered every time it's set :(
Will see what I can do with a bit of scripting...

_________________
--
[ HA : ioBroker/node-red/Domoticz(moving away) ]
[ Devices : rflink/mi-light/rf433/mpd/kodi/mqtt/sonoff/nodemcu/mysensors ]
[ OS : Running on Debian Linux ]


Nach oben
   
 Betreff des Beitrags: Re: Timers, Events & Stuff
BeitragVerfasst: 25.10.2017, 06:14 
Offline
guru
Benutzeravatar

Registriert: 07.01.2016, 23:42
Beiträge: 1639
Hat sich bedankt: 37 Mal
Danksagung erhalten: 124 Mal
IcaruS hat geschrieben:
Scenes is not exactly what I'm looking for as it is triggered every time it's set :(
Will see what I can do with a bit of scripting...


If you are not used to handle things in JavaScript start with blockly, hit the button show code and see what script is created.

It will help you learning/understanding how it works with easy examples.
The trigger you are looking for in blockly will be the one were you can choose between updated (trigger at every value update even if it's the same) or changed (trigger only if value is changed)

~Dutch


-------------------------
Send from mobile device


Nach oben
   
 Betreff des Beitrags: Re: Timers, Events & Stuff
BeitragVerfasst: 26.10.2017, 00:05 
Offline
starter

Registriert: 06.06.2017, 20:10
Beiträge: 14
Created a timer script which can be triggered and sets an expire time every time it gets triggered.
The script checks it's own time against the expiretime ... and acts accordingly ....

Tried 3 times to upload the script for others .. but the forum won't let me post it as code :(
So i'll try to upload the Scripts & JSON.

Maybe someone has a use for it ... or can make the code better :)


Dateianhänge:
Dateikommentar: JSON File
delaytimer.json.txt [2.11 KiB]
6-mal heruntergeladen
Dateikommentar: JS Script
delaytimer.js.txt [15.38 KiB]
9-mal heruntergeladen

_________________
--
[ HA : ioBroker/node-red/Domoticz(moving away) ]
[ Devices : rflink/mi-light/rf433/mpd/kodi/mqtt/sonoff/nodemcu/mysensors ]
[ OS : Running on Debian Linux ]


Zuletzt geändert von IcaruS am 26.10.2017, 00:06, insgesamt 1-mal geändert.
Nach oben
   
 Betreff des Beitrags: Re: Timers, Events & Stuff
BeitragVerfasst: 26.10.2017, 00:20 
Offline
starter

Registriert: 06.06.2017, 20:10
Beiträge: 14
Would be great if this would be an adapter with configurable timers :P
Several named timer which you could add to you scripts (That are reset every time it gets an update)
Great for motion sensors :)

_________________
--
[ HA : ioBroker/node-red/Domoticz(moving away) ]
[ Devices : rflink/mi-light/rf433/mpd/kodi/mqtt/sonoff/nodemcu/mysensors ]
[ OS : Running on Debian Linux ]


Nach oben
   
 Betreff des Beitrags: Timers, Events & Stuff
BeitragVerfasst: 26.10.2017, 22:15 
Offline
guru
Benutzeravatar

Registriert: 07.01.2016, 23:42
Beiträge: 1639
Hat sich bedankt: 37 Mal
Danksagung erhalten: 124 Mal
IcaruS hat geschrieben:
Would be great if this would be an adapter with configurable timers
Several named timer which you could add to you scripts (That are reset every time it gets an update)
Great for motion sensors :)


Mja it depends...
Not sure if a separate adapter is the way to go as you can also quite easily archive the same goal with JavaScript (expert) or blockly (advanced)

Could your also post a screenshot of your created blockly.
(Easier to read on mobile device :-))

-------------------------
Send from mobile device


Nach oben
   
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen  Auf das Thema antworten  [ 15 Beiträge ] 

Alle Zeiten sind UTC+01:00


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Gehe zu Forum:  
Powered by phpBB® Forum Software © phpBB Limited
Deutsche Übersetzung durch phpBB.de