Hya,
i have a working device, which sets state 0 or 1 (off and on) - switch.
I wish to extend it to be able to have another state for the following purpose:
0 - off - idle
1 - on - working
2 - done - notify
by rules, would boot with 0, when switched, to 1 - add 1 to counter, when 0 again and counter 1, set state to 2, send notifucation, wait 30 seconds, 0 to counter and 0 to state.
Any way?
Setting another state - how to?
Moderators: grovkillen, Stuntteam, TD-er
Re: Setting another state - how to?
Using a Dummy Device and the TaskValueSet command you should be able to achieve that, but it's not clear to me what/where you want to 'send notification' to.
/Ton (PayPal.me)
Re: Setting another state - how to?
what i try to archieve:
by boot, it's idle, so status is 0 - no messages
when started - status to 1, it's working - notify it's working.
when finished, status returns to 0, but first, i want to notify it's finnished and after that, set status to 0 again.
i tried another approach with rules, but also not working....
by boot, it's idle, so status is 0 - no messages
when started - status to 1, it's working - notify it's working.
when finished, status returns to 0, but first, i want to notify it's finnished and after that, set status to 0 again.
i tried another approach with rules, but also not working....
Code: Select all
On System#Boot do
Monitor GPIO,4 // D2
let,1,0
endon
on MQTT#Connected do
// Publish,%sysname%/status,First message!
// Publish,%sysname%/B58/status,0
// Publish,%sysname%/B24/status,0
// Publish,%sysname%/BOFF/status,0
event,publishstatus
endon
// loop
// B58 - gpio 14 - statusoff P3 D5
On B58 do
pulse,14,1,500
pulse,2,0,500
let,1,1
endon
// B24 - gpio 12 status24 P2 D6
On B24 do
pulse,12,1,500
pulse,2,0,500
let,1,1
endon
// BOFF - gpio 13 statusoff P1 D7
On BOFF do
pulse,13,1,500
pulse,2,0,500
endon
on GPIO#4=1 do
if %v1%=1
// Publish,%sysname%/status,Working!!
endif
endon
on GPIO#4=0 do
if %v1%=1
// if var 1 = 1 was working, and it's finnished, so, send notification, set var1 = 0
// notify
// Publish,%sysname%/status,Finnished!!
let,1,0
endif
endon
Who is online
Users browsing this forum: No registered users and 1 guest