Noob trying to use REST

Just a quick warning - when I added some additional Tag Sensors, the order the order of the tags got scrambled, so I had to re-align the sensors with the correct order from the response.

What you can do is use the curl statement in a commandline:

curl -X POST mytaglist.com/ethClient.asmx/GetTagList2 -H 'Content-Type: application/json' -H 'Authorization: Bearer YOU_RBEARER_CODE' -d ""

Take the response, put it in a text editor, and change the comma in the },{ sequence to a return, and you can see the sensors in order, each line from the top down is 0,1,2,3, so on, which goes inside the brackets in the value_template line:

value_template: '{{ value_json.d[0].temperature | round(2) }}'

hello some one please help me with this

im trying to get below json value on rest sensor.

sensor setup

  - platform: rest
    resource: http://api.aladhan.com/timingsByCity?city=aljubail&country=SaudiArabia&method=2
    name: Prayer Time
    value_template: '{{ value_json.fajr }}'

json

{"code":200,"status":"OK","data":{"timings":{"Fajr":"04:11","Sunrise":"05:17","Dhuhr":"11:42","Asr":"15:13","Sunset":"18:07","Maghrib":"18:07","Isha":"19:13","Imsak":"04:01","Midnight":"23:42"},"date":{"readable":"16 Apr 2017","timestamp":"1492321943"}}}

i get the empty value
but if i change value_template

value_template: '{{ value_json.code }}'
i get the sensor value 200

Fajr is nested inside of timings, which is nested inside of dataā€¦

Hereā€™s a recent post that gives some pointers about using the template dev tool to debug json templating:

i have done it. this worked for me

value_template: '{{ value_json.data.timings.fajr }}'

Hi sorry for my ignorance, but can you share all the configuration. I am new at this Hass.io stuff and Iā€™m really struggling to get this to work with my wireless tag sensors.
Thanks in advance.

sorry for the delay was busy with work had no time to check the community

here it is

  - platform: mqtt
    name: Fuel Left
    unit_of_measurement: "%"
    state_topic: local/car/state
    value_template: '{{ value_json.fuelleft }}'

another

  - platform: mqtt
    state_topic: local/prayer/state
    name: Fajr
    value_template: '{{ value_json.data.timings.Fajr }}'

I just started with my first set of tagsā€¦ Theyā€™re pretty neat. But if the order of tags changes randomly in GetTagList and GetTagList2 (and Iā€™m pretty sure thatā€™s legal, if inconvenient sometimes, in JSON) you can use GetTagForSlaveId. Iā€™m not sure what the slaveid is other than an incremental of what tags were added to the system, but so far it seems unchanging. Iā€™d prefer an endpoint you can retrieve specific tags off of the uuid, but I havenā€™t found that yet.

Hi, just read your post and I also have these wireless tag sensors. Iā€™m a newbie and would love to have these running win home assistant/hass.io. Can you share how to put these sensor working ?? Where should all this code go ?
Thanks so much in advance.

I keep getting an error when adding these wireless tags as a rest sensor: Invalid config for [sensor.rest]: required key not provided @ data[ā€˜resourceā€™]. Got None.

I can curl successfully and see the data, but I canā€™t get my sensor config right.

- platform: rest
    sensors:
      guest_bathroom_humidity:
        friendly_name: 'guest bathroom humidity'
        resource: https://my.wirelesstag.net/ethClient.asmx/GetTagList2
        method: POST
        value_template: '{{ value_json.d[0].temperature | round(2) }}'
        unit_of_measurement: Ā°F
        headers:
          Content-Type: application/json
          Authorization: 'Bearer <my_auth_code>'

Hereā€™s sample data returned via curl:

{"d":[{"__type":"MyTagList.Tag2","managerName":"Home","mac":"<mac_address>","dbid":2,"mirrors":[],"notificationJS":null,"name":"guest bath","uuid":"<udid value>","comment":"","slaveId":0,"tagType":13,"lastComm":131587221142341535,"alive":true,"signaldBm":-72,"batteryVolt":2.9375063932615917,"beeping":false,"lit":false,"migrationPending":false,"beepDurationDefault":1001,"eventState":0,"tempEventState":0,"OutOfRange":false,"lux":0,"temperature":21.072044372558594,"tempCalOffset":0,"capCalOffset":0,"image_md5":null,"cap":42.2177734375,"capRaw":0,"az2":0,"capEventState":0,"lightEventState":0,"shorted":false,"thermostat":null,"playback":null,"postBackInterval":300,"rev":111,"version1":3,"freqOffset":2705,"freqCalApplied":0,"reviveEvery":4,"oorGrace":2,"LBTh":2.55,"enLBN":true,"txpwr":16,"rssiMode":true,"ds18":false,"v2flag":18,"batteryRemaining":0.91}]}

Any ideas?

FYI to anyone trying to set these up, URLs have changed without documentation. You should use https://my.wirelesstag.net for both OAuth and service calls.