Run these codes to init, start and stop monitoring your ELIO IOT device.
Open ELIO Play and copy ‘mac’ and ‘key’ on the footer of your ELIO device panel
STEP 1: Init your ELIO
elio.init({ "mac": "80:65:99:DD:B0:1C", "key": "-NyPLcN9IqsvfZ7ZjCvv",});
STEP 2: Start monitoring
elio.show({ container: ".values", id: ["time", "tempC", "humidity", "altitude", "proximity", "wirelessCharging", "pressure", "SSID", "tempOutC", "cubePosition", "noise", "vol", "IP", "DRAM", "PSRAM", "heap", "sunDetected", "batteryVoltage", "light", "IRlight"], play: 1, every: 5, class: "div inline-flex items-center content-center rounded-full px-[10px] m-[3px] h-[40px] bg-[white] text-[#E58139] border-[#E58139] border-solid border-[1px] select-none" });
STEP 3: Stop monitoring
elio.show({ container: ".values", play: 0,});
elio.values({ success: function (response) {alert(JSON.stringify(response))}});
elio.irCodes({ success: function (response) {alert(JSON.stringify(response))}});
How to use
<!-- Add this code in your html page header --><script src="https://elioiot.com/app/web/elioiot-api.js"></script><!-- Add this code in the body of the page --><script>// Open ELIO Play web app and copy 'mac' and 'key' on the footer of your ELIO device panelelio.init({mac: ..., key: ...}); // sets mac and key of the ELIO device one timeelio.values({success: ...}); //gets values from ELIO and calls the 'success' callback function</script>
Lessons
Lesson 1: Actions
elio.run({ "app": { "do": [{"timer": { "do": [ { "if": { "else": [ { "light": { "brightness": 100, "color": 12, "duration": 1, "led": 0 } } ], "is": [ "cubePosition", "==", 2 ], "then": [ { "light": { "brightness": 100, "color": 1, "duration": 1, "led": 0 } } ] } } ], "every": 1, "id": 0, "play": -1 }}]}});
Lesson 2: Event
elio.run({ "app": { "do": [ { "on": { "do": [ { "light": { "brightness": 100, "color": 1, "duration": 1, "led": 0 } } ], "event": "cubicPositionChanged" } } ] }});
Lesson 3: Timer
elio.run({ "app": { "do": [ { "timer": { "after": 5, "do": [ { "light": { "color": 1, "duration": 1, "led": 0 } } ], "every": 2, "id": 0, "play": 3 } } ] }});
Lesson 4: Say
elio.run({ "app": { "do": [ { "say": { "text": "I'm going to read the minutes", "voice": "Salli" } }, { "timer": { "do": [ { "say": { "text": "It's", "voice": "Salli" } }, { "say": { "text": "minute", "voice": "Salli" } } ], "every": 5, "id": 0, "play": -1 } } ] }});
Lesson 5: Radio
elio.run({ "app": { "do": [ { "on": { "do": [ { "radio": { "play": 1, "url": "http://icestreaming.rai.it/1.mp3" } } ], "event": "touchSquare" } }, { "on": { "do": [ { "radio": { "play": 0 } } ], "event": "touchCircle" } } ] }});
Lesson 6: If
elio.run({ "app": { "do": [ { "timer": { "do": [ { "if": { "else": [ { "light": { "brightness": 100, "color": 0, "duration": 1, "led": 0 } } ], "is": [ "cubePosition", "==", 2 ], "then": [ { "light": { "brightness": 100, "color": 1, "duration": 1, "led": 0 } } ] } } ], "every": 1, "id": 0, "play": -1 } } ] }});
Lesson 7: If
elio.run({"app": { "do": [ { "set": [ "a", "=", 500 ] }, { "timer": { "do": [ { "set": [ "a", "+=", 10 ] }, { "buzzer": { "frequency": "a", "volume": 2 } } ], "every": 1, "id": 0, "play": 1 } } ]}});
Lesson 8: Webock
elio.run({"app": { "do": [ { "timer": { "do": [ { "webhook": { "url": "https://webhook.site/f0c1602e-2535-4367-9d8e-439520dbc8d6", "values": true } }, { "light": { "color": 1, "duration": 1, "led": 0 } } ], "every": 60, "id": 0, "play": -1 } } ]}});
Lesson 9: Webock
elio.run({"app": { "do": [ { "on": { "do": [ { "ir": { "command": "record", "key": 0, "recordTime": 5, "success": [ { "light": { "color": 5, "duration": 1, "led": 0 } } ] } }, { "light": { "color": 12, "duration": 5, "led": 0 } } ], "event": "touchCircle" } }, { "on": { "do": [ { "ir": { "command": "send", "key": 0 } }, { "light": { "color": 8, "duration": 1, "led": 0 } } ], "event": "touch1" } } ]}});
Lesson 10: Thresholds
elio.run({"app": { "do": [ { "thresholds": { "bright": 200, "dark": 50 } }, { "on": { "do": [ { "light": { "color": 0, "duration": 1, "led": 0 } } ], "event": "bright" } }, { "on": { "do": [ { "light": { "color": 1, "duration": 1, "led": 0 } } ], "event": "dark" } } ]}});
Examples
White light for 1 second
elio.run({ "app": { "do": [ { "light": { "led": 0, "color": 1, "duration": 1 } } ] }});
Make a sound
elio.run({ "app": { "do": [ { "buzzer": { "frequency": 440, "volume": 2 } } ] }});
Darkness sensor
elio.run({ "app": { "do": [ { "on": { "do": [ { "say": { "text": "it is dark", "voice": "Salli" } } ], "event": "dark" } } ]}});
Say hello
elio.run({"app": { "do": [ { "say": { "text": "Hello", "voice": "Salli" } } ]}});
Power the radio
elio.run({"app": { "do": [ { "say": { "text": "Power the radio", "voice": "Salli" } }, { "radio": { "play": 1, "url": "http://icestreaming.rai.it/1.mp3" } }, ]}});
Temperature what does
elio.run({ "app": { "do": [ { "if": { "is": [ "tempC", ">=", 20 ], "then": [ { "say": { "text": "it's more than 20 degrees", "voice": "Salli" } } ] } } ] }});