11 | | - do i thirst run of your modified sketch to request parameters. Be prepared that you will receive an empty string because at this time we have just created empty variables at vera side. |
12 | | - refresh your vera and go to particular child into Advanced Tab. You should be able to see your new variables named Variable1...Variable5. Variable1 corresponds to V_VAR1 inside your sketch etc. |
13 | | - fill free to change empty field on vera side to the value your needed, Save changes. |
14 | | - check with you Arduino, it should receive correct data at this point |
| 13 | - do i thirst run of your modified sketch to request parameters. Be prepared that you will receive an empty string because at this time we have just created empty variables at vera side; |
| 14 | - refresh your vera and go to particular child into Advanced Tab. You should be able to see your new variables named Variable1...Variable5. Variable1 corresponds to V_VAR1 inside your sketch etc.; |
| 15 | - fill free to change empty field on vera side to the value your needed, Save changes; |
| 16 | - check with you Arduino, it should receive correct data at this point; |
| 17 | |
| 18 | '''Comments''' |
| 19 | |
| 20 | You free to use whatever design you want. You can pull data at each start of you node or you can pull each 30 minutes like many z-wave devices do if they operate from battery. |
| 21 | Other example can be if you need for your to nodes to communicate to each other and you need to tell a radio ID to one/both nodes to establish their communication. But for this one you probably want to use Push... |
| 22 | |
| 23 | ---- |
| 24 | |
| 25 | == Case # 2== |
| 26 | |
| 27 | '''Push data from vera''' |
| 28 | |
| 29 | '''Task:''' ''You need to push data from vera on event or using schedule and it should be initiated instantly by vera, not by node. For example you want your clock to show external temperature received by vera from the Weather plugin or from other sensor. '' |
| 30 | |
| 31 | '''Solution:''' |
| 32 | [[Image(forcase1.jpg, align=right, 300px)]] |
| 33 | - choose from V_VAR1, V_VAR2, V_VAR3, V_VAR4, V_VAR5 to be used for data push; |
| 34 | - design your sketch to listen for incoming messages with desired variable; |
| 35 | - create a new scene on vera side. The scene should be run according to your goal. For example each 10 minutes; |
| 36 | - use Lua tab while editing scene to provide data for the push. For example this Lua is taking current temperature from Weather (vera id = 61) plugin and pushing it to the node (vera id for root device = 372) using VAR_5: |
| 37 | |
| 38 | {{{ |
| 39 | local temp = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature", 61) |
| 40 | temp = temp*10.0 |
| 41 | luup.call_action("urn:upnp-arduino-cc:serviceId:arduino1", "SendCommand", {radioId="4;255", variableId="VAR_5", value=temp}, 372) |
| 42 | }}} |
| 43 | |
| 44 | '''Comments''' |
| 45 | |
| 46 | A good combination between Pull and Push can work for the best. |