Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
blocks:app-note:flic [2024-03-22 13:23] mattias [Use Flic2 wireless buttons as a triggers in Blocks] |
blocks:app-note:flic [2024-03-22 14:03] (current) mattias [Configure the button action] |
||
---|---|---|---|
Line 1: | Line 1: | ||
=====Use Flic2 wireless buttons as a triggers in Blocks===== | =====Use Flic2 wireless buttons as a triggers in Blocks===== | ||
- | This application note is technical but gives anexample | + | This application note is technical but gives an example |
- | | ||
+ | ====Requirements==== | ||
+ | Flic2 button is the only hardware required. | ||
+ | |||
+ | {{: | ||
+ | |||
+ | Flic Hub LR with a ehternet connection is recommended for any real application but optional for testing. | ||
+ | |||
+ | {{: | ||
====The devices==== | ====The devices==== | ||
- | The Flic2 buttons is communication | + | |
- | A button can trigger three different commands depending | + | |
+ | The Flic2 buttons is a Swedish crowdfunded project by [[https:// | ||
+ | The buttons communicate | ||
+ | A button can trigger three different commands depending | ||
Line 16: | Line 26: | ||
Copy the example script SimpleHttpInput.js file from / | Copy the example script SimpleHttpInput.js file from / | ||
- | ====Configure the Flic buttons | + | ====Configure the button |
Follow the vendors documentation to find how to add hub actions to the button in the Flic application. | Follow the vendors documentation to find how to add hub actions to the button in the Flic application. | ||
Select the Internet Request action. | Select the Internet Request action. | ||
Set the method to GET. | Set the method to GET. | ||
- | Enter your server details in the URL like in the exampel below: | + | Enter your server details in the URL in this format: |
< | < | ||
- | http://< | + | http(s)://< |
</ | </ | ||
Example: | Example: | ||
Line 37: | Line 47: | ||
=====Trigger a task==== | =====Trigger a task==== | ||
- | The user script exposes the lastMessage in blocks. If a message is received the property' | + | The user script exposes the //lastMessage// property |
Add a task and use the lastMessage property as a trigger like in the example screen shot. | Add a task and use the lastMessage property as a trigger like in the example screen shot. | ||
- | We can also use some if statement to perform different actions depending on what message was recieved. | + | We can also use some if statement to perform different actions depending on what message was received. |
{{: | {{: |