Setting variables

91 views
Skip to first unread message

edwin pang

unread,
Jul 4, 2015, 11:03:21 AM7/4/15
to android-s...@googlegroups.com
Hi there i could not seem to set my temperature and humidity values 

Expect: "(<tempvar>[0-9][0-9])
Going for : "{\"dth11\": [{ \"Temperature:\": \"31\", \"Humidity\": \"58\",}]}"

What am i doing wrong?

[
  {
    "timestamp": 0,
    "recordType": "Start",
    "recordData": "Tasker"
  },
  {
    "timestamp": 0,
    "recordType": "Version",
    "recordData": "2000030"
  },
  {
    "timestamp": 0,
    "recordType": "Send/Expect Data",
    "recordData": "Timeout seconds: 5\nSend (original): THL032100020090\\n\nSend (variables replaced): THL032100020090\\n\nExpect: \\\\(<tempvar>[0-9][0-9])\n"
  },
  {
    "timestamp": 19,
    "recordType": "Connection",
    "recordData": "192.168.1.76:9999"
  },
  {
    "timestamp": 19,
    "recordType": "Send",
    "recordData": "THL032100020090\\n"
  },
  {
    "timestamp": 20,
    "recordType": "Expect",
    "recordData": "\\\\(<tempvar>[0-9][0-9])"
  },
  {
    "timestamp": 20,
    "recordType": "Received Buffer Contains",
    "recordData": ""
  },
  {
    "timestamp": 87,
    "recordType": "Received Bytes",
    "recordData": "55"
  },
  {
    "timestamp": 88,
    "recordType": "Received Buffer Contains",
    "recordData": "{\"dth11\": [{ \"Temperature:\": \"31\", \"Humidity\": \"58\",}]}"
  },
  {
    "timestamp": 4999,
    "recordType": "Exception",
    "recordData": "timeout waiting for data"
  },
  {
    "timestamp": 5000,
    "recordType": "Disconnect",
    "recordData": null
  },
  {
    "timestamp": 5001,
    "recordType": "Set Tasker Variable",
    "recordData": "%sendexpectstatus = timeout waiting for data"
  },
  {
    "timestamp": 5001,
    "recordType": "Failed",
    "recordData": "timeout waiting for data"
  }
][
  {
    "timestamp": 0,
    "recordType": "Start",
    "recordData": "Tasker"
  },
  {
    "timestamp": 0,
    "recordType": "Version",
    "recordData": "2000030"
  },
  {
    "timestamp": 0,
    "recordType": "Send/Expect Data",
    "recordData": "Timeout seconds: 5\nSend (original): THL032100020090\\n\nSend (variables replaced): THL032100020090\\n\nExpect: \\\\(<tempvar>[0-9][0-9])\n"
  },
  {
    "timestamp": 19,
    "recordType": "Connection",
    "recordData": "192.168.1.76:9999"
  },
  {
    "timestamp": 19,
    "recordType": "Send",
    "recordData": "THL032100020090\\n"
  },
  {
    "timestamp": 20,
    "recordType": "Expect",
    "recordData": "\\\\(<tempvar>[0-9][0-9])"
  },
  {
    "timestamp": 20,
    "recordType": "Received Buffer Contains",
    "recordData": ""
  },
  {
    "timestamp": 87,
    "recordType": "Received Bytes",
    "recordData": "55"
  },
  {
    "timestamp": 88,
    "recordType": "Received Buffer Contains",
    "recordData": "{\"dth11\": [{ \"Temperature:\": \"31\", \"Humidity\": \"58\",}]}"
  },
  {
    "timestamp": 4999,
    "recordType": "Exception",
    "recordData": "timeout waiting for data"
  },
  {
    "timestamp": 5000,
    "recordType": "Disconnect",
    "recordData": null
  },
  {
    "timestamp": 5001,
    "recordType": "Set Tasker Variable",
    "recordData": "%sendexpectstatus = timeout waiting for data"
  },
  {
    "timestamp": 5001,
    "recordType": "Failed",
    "recordData": "timeout waiting for data"
  }
]

David

unread,
Jul 12, 2015, 9:36:23 PM7/12/15
to android-s...@googlegroups.com
Sorry for the late response.  For some reason Google Groups didn't send me your posting.

To set a Tasker variable, the syntax is:

(<?varname>regular_expression)

Your expect string is missing the ?

Also, when this is fixed, it will match the "11" from "dth11" in your receive.  You will want something like:

^.*\"Temperature:\": \"(<?tempvar>[0-9][0-9])

Reply all
Reply to author
Forward
0 new messages