I entered your curl command and it returned your sensors! Give me a few minutes and I will append this post with a suggestion…
…here’s the suggestion, polls every two minutes. Untested against openHAB, and only a starting point for you to take forward.
Install the exec binding:
sudo apt-get install openhab-addon-binding-exec
###Create a tiny bash script /home/openhab/grabit.sh (or wherever):
#!/bin/bash
curl --silent -X POST http://www.mytaglist.com/ethClient.asmx/StopBeep -d '{id:3}' -H 'Content-Type: application/json' -H 'Authorization: Bearer d6702ad6-ab3a-4497-8eae-22b6229dfe03'
Make sure to chmod +x /home/openhab/grabit.sh
.
###Add the following items:
Group gWT
String WirelesstagPayload { exec="<[/home/openhab/grabit.sh:120000:REGEX((.*?))]" }
Number Temperature "Temperature [%.1f °C]" (gWT)
Number Cap "Cap [%.1f]" (gWT)
Number BatteryRemaining "Battery remaining [%.1f]" (gWT)
Contact EventState "Event state [%s]" (gWT)
###Add the following rules file:
import org.openhab.core.library.types.*
rule UnpackWirelesstagPayload
when
Item WirelesstagPayload received update
then
val String payload = WirelesstagPayload.state.toString
// logInfo("wt", transform("JSONPATH", "$.d.temperature", payload))
// logInfo("wt", transform("JSONPATH", "$.d.cap", payload))
// logInfo("wt", transform("JSONPATH", "$.d.batteryRemaining", payload))
// logInfo("wt", transform("JSONPATH", "$.d.eventState", payload))
Temperature.postUpdate(new DecimalType(transform("JSONPATH", "$.d.temperature", payload)))
Cap.postUpdate(new DecimalType(transform("JSONPATH", "$.d.cap", payload)))
BatteryRemaining.postUpdate(new DecimalType(transform("JSONPATH", "$.d.batteryRemaining", payload)))
val String eventState = transform("JSONPATH", "$.d.eventState", payload)
switch eventState {
case "3" : EventState.postUpdate(OPEN) // guessing
case "4" : EventState.postUpdate(CLOSED) // guessing
// API doc says values are Disarmed or Armed or Moved or Opened or Closed or DetectedMovement or TimedOut or Stabilizing, but they are numbers!
// so you will have to find or figure out the mappings
}
end