15
Coding Console enables professional devel-
opers to program BKC services by JavaScript
syntax for Blocklychain-enabled devices
including Smart Button.
2
. Coding Console
Logic
IA Devices
Messages
Utils
Loops
Functions
Math
Text
if
do
Smart Button
Button 1
if
do
Pressed
Smart Plug
Plug 1
On
is
Push Notification by Message:
Power is turning off
Smart Plug
Plug 1
Off
is
Push Notification by Message:
Power is turning on
Smart Plug
Plug 1
On
is
else if
else
Smart Button
Button 1
Double Pressed
Push Notification by Message:
Power is turning off anyway
Smart Plug
Plug 1
Off
is
Speaker
Speaker
Play
Emergency
Alarm 1.mp3
Device Volume : 100%
Home
Devices
Service Gallery
Installed Services
SEM
Activity
Service Creator
My Home
**/
*Describe this function...
*/
function cron() {
Power1.SEND_COMMAND('TURN_OFF');}
if ((Shortcut1.PAYLOAD.state === 'pressed')) {
if ((Power1.PAYLOAD.state === 'ON' )) {
IAMessage.pushNotification({"message":"Power is turning off"});
Power1.SEND_COMMAND('TURN_OFF');} else {
IAMessage.pushNotification({"message":"Power is turning on"});
Power1.SEND_COMMAND('TURN_ON');}
} else if ((Shortcut1.PAYLOAD.state === 'double')) {
IAMessage.pushNotification({"message":"Power is turning off anyway"});
Power1.SEND_COMMAND('TURN_OFF');for (var count = 0; count < 2; count++) {
Speaker1.SEND_COMMAND('PLAY', {"file-name":"service:/Power Click","file-url":
"https://file/url/name.mp3","file-extension":"mp3","file-save":"SAVE"})};
}
//when service invoked at schedule time method "cron()" is called
Home
Devices
Service Gallery
Installed Services
SEM
Activity
Service Creator
My Home
Summary of Contents for SB-103
Page 1: ...SMART BUTTON SB 103 ...