-
Using Haspmota, I have the below function working for a relay:
Now I have a second function when I toggle the relay from UI or http:
But this isn't a timedpower command....it just catches the on and off.... Can this be done only with berry so when I push the UI button do all that the first function does? And if so how can it be done with http call too? It must be something obvious, too obvious that It confuses me. Thank you in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Not clear exactly how much you mean with "Can this be done only with berry", what function you wanted to happen, but doesn't, or if the main issue is to avoid repeating similar code. In the latter case, you could have something like this, called from both places.
Such a function could also be invoked via MQTT, http, command, or even the device groups feature. The last 3 (or 4) could be by executing a command. One way would be to define a command via |
Beta Was this translation helpful? Give feedback.
-
That's what I mean, If I can intercept the default on/off action from the UI button, so instead it effectively turns it in timedpower1.
Of course and I don't see any issues, I just want to know just the above, if I can intercept the default action through Berry...and how...and if it's right.... |
Beta Was this translation helpful? Give feedback.
-
Yes, both solutions seem right, either For one more time, a big Thank You. |
Beta Was this translation helpful? Give feedback.
Depends on what you mean by "intercept". What you get when triggering on power status changes is after the fact, not related to why the status changed. You cannot avoid the status already having changed, unless you instead do something to "take over" the "why". As power status may change for a number of reasons, you have no general way of avoiding the power status change. Closest is that the action could be on a virtual relay (not connected to anything physical), and then have triggers to get events about something happened there, and for you to decide what you want to do about that.
Still, if you use
PulseTime
, all that stuff about ensuring one hour of on-time can be handled by Tasmota i…