Thank you.... Changed as suggested by you. Working now as needed.
Please guide me on the following:-
I have set CH15 as the inching timer. Can I update this text field value from Home Assistant?
Kindly guide
Czy wolisz polską wersję strony elektroda?
Nie, dziękuję Przekieruj mnie tam
setChannelType 2 TimerSeconds
alias turn_off_after_time backlog setChannel 2 $CH15
alias on_turned_off setChannel 2 0
alias turn_off_relay setChannel 1 0
alias do_check if $CH2==0 then turn_off_relay
alias do_tick backlog addChannel 2 -1; do_check
addChangeHandler Channel1 == 1 turn_off_after_time
addChangeHandler Channel1 == 0 on_turned_off
again:
if $CH2!=0 then do_tick
delay_s 1
goto again
ciknururko wrote:
1. In addition to my current autoexec.bat, how can I set a time function so that at a specified time the switch gets TURN ON or TURN OFF?
e.g. if current_time == 17:00, turn off switch.
ciknururko wrote:
2. How to make the switch turn on after 5 seconds when the main power to the switch is turned on?
// your current autoexec.bat here
// now delay
delay_s 5
// now power ON
POWER ON
// your current autoexec.bat here
// now delay
delay_s 5
// now power ON
setChannel 1 1
// This command will turn on relay on CH1 after 10 seconds
// addRepeatingEvent [IntervalSeconds][RepeatsOr-1][CommandToRun]
addRepeatingEvent 10 1 setChannel 1 1
p.kaczmarek2 wrote:// your current autoexec.bat here
// now delay
delay_s 5
// now power ON
POWER ON
p.kaczmarek2 wrote:This can be done with addClockEvent function.
setChannelType 2 TimerSeconds
alias turn_off_after_time backlog setChannel 2 $CH15
alias on_turned_off setChannel 2 0
alias turn_off_relay setChannel 1 0
alias do_check if $CH2==0 then turn_off_relay
alias do_tick backlog addChannel 2 -1; do_check
addChangeHandler Channel1 == 1 turn_off_after_time
addChangeHandler Channel1 == 0 on_turned_off
startDriver ntp
ntp_timeZoneOfs +05:30
alias plug_on backlog POWER ON
waitFor NTPState 1
if $hour>=14&&$hour<21 then plug_on
again:
if $CH2!=0 then do_tick
delay_s 1
goto again
//autoexec.bat
//some commands in autoexec.bat
function.bat
//function.bat (this is another file created)
startDriver ntp
ntp_timeZoneOfs +05:30
delay_s 5
POWER ON
alias plug_on backlog POWER ON
alias plug_on backlog setChannel 1 1
addChangeHandler Channel1 == 1 turn_off_after_time
startScript [FileName] [Label] [UniqueID]
startScript myBat.bat * 12345
p.kaczmarek2 wrote:startScript myBat.bat * 12345
p.kaczmarek2 wrote:alias plug_on backlog setChannel 1 1
setChannelType 2 TimerSeconds
alias turn_off_after_time backlog setChannel 2 $CH15
alias on_turned_off setChannel 2 0
alias turn_off_relay setChannel 1 0
alias do_check if $CH2==0 then turn_off_relay
alias do_tick backlog addChannel 2 -1; do_check
addChangeHandler Channel1 == 1 turn_off_after_time
addChangeHandler Channel1 == 0 on_turned_off
startDriver ntp
ntp_timeZoneOfs +05:30
alias plug_on backlog setChannel 1 1
waitFor NTPState 1
if $hour>=14&&$hour<21 then plug_on
again:
if $CH2!=0 then do_tick
delay_s 1
goto again
alias plug_on backlog setChannel 1 1
alias plug_on backlog setChannel 1 1; turn_off_after_time
// TODO: adjust second 15 here
setChannel 15 15
setChannelType 15 TextField
setChannelLabel 15 TurnOffTime
setChannelType 2 TimerSeconds
alias turn_off_after_time backlog setChannel 2 $CH15
alias on_turned_off setChannel 2 0
alias turn_off_relay setChannel 1 0
alias do_check if $CH2==0 then turn_off_relay
alias do_tick backlog addChannel 2 -1; do_check
addChangeHandler Channel1 == 1 turn_off_after_time
addChangeHandler Channel1 == 0 on_turned_off
startDriver ntp
ntp_timeZoneOfs 1
alias plug_on backlog setChannel 1 1
waitFor NTPState 1
if $hour>=14&&$hour<21 then plug_on
again:
if $CH2!=0 then do_tick
delay_s 1
goto again
setStartValue 5 -1
setChannelType 5 TextField
setChannelLabel 5 TurnOffTime
setChannelType 2 TimerSeconds
alias turn_off_after_time backlog setChannel 2 $CH5
alias on_turned_off setChannel 2 0
alias turn_off_relay setChannel 1 0
alias do_check if $CH2==0 then turn_off_relay
alias do_tick backlog addChannel 2 -1; do_check
addChangeHandler Channel1 == 1 turn_off_after_time
addChangeHandler Channel1 == 0 on_turned_off
startDriver ntp
ntp_timeZoneOfs 1
alias plug_on backlog setChannel 1 1
waitFor NTPState 1
if $hour>=14&&$hour<21 then plug_on
again:
if $CH2!=0 then do_tick
delay_s 1
goto again
ciknururko wrote:
No, nothing like that... I was just curious if it can be used in that manner.
ciknururko wrote:
Is there a way to check from HA if an update is available for the plug?
e.g. For Chipset: BK7231N Build: Build on Nov 13 2023 14:23:53 version 1.17.308 is the latest.
ciknururko wrote:
Secondly, I am having a very peculiar issue. If the plug is powered ON and is detected by HA. After some time, if I restart HA, after the restart the plug is shown as unavailable in HA until I manually toggle it. Any idea why this is happening?
p.kaczmarek2 wrote:It is a bit problematic because GitHub is now HTTPS-only and the current version of OBK can't make HTTPS requests, only HTTP. Still, why do you want to update that often?
p.kaczmarek2 wrote:I would fix it just by enabling "broadcast self state every N seconds" in flags
p.kaczmarek2 wrote:However, I don't think that we can run JavaScript in HA. I haven't tried doing that kind of thing yet. Do you know how we could do an HTTPS GET on the HA side?