Not the one you’re replying to, but I did this:
Add the following to your configuration.yaml and replace the all caps parts:
rest:
- authentication: basic
username: "ONE2TRACK USERNAME"
password: "ONE2TRACK PASSWORD"
headers:
Cookie: _iadmin=ONE2TRACK_COOKIE_VALUE
Accept: application/json
scan_interval: 900
resource: https://www.one2trackgps.com/users/ONE2TRACK_USERNAME/devices
sensor:
- name: "ONE2TRACK_DEVICENAME_1"
json_attributes_path: "$.[?(@.device.id==ONE2TRACK_DEVICEID)]"
value_template: "OK"
json_attributes:
- "device"
- name: "ONE2TRACK_DEVICENAME_2"
json_attributes_path: "$.[?(@.device.id==ONE2TRACK_DEVICEID)]"
value_template: "OK"
json_attributes:
- "device"
This should give you the devices listed as sensor.ONE2TRACK_DEVICENAME_1 with attribute ‘device’ and a ton of subattributes.
Oh, and the device ID you’ll find if you add this too:
logger:
default: info
logs:
homeassistant.components.rest: debug
Then find the homeassistant.log file and look at the output. You should see a block of JSON output somewhere. It’s not the same as the ID shown on the website.
Edited to add:
If you then create a template sensor, you can format the values a little better for easier use in a device tracker. Like so:
- platform: template
sensors:
DEVICENAME_ONE2TRACK:
value_template: "{{ state_attr('sensor.one2track_ONE2TRACK_DEVICENAME_1','device')['status'] }}"
attribute_templates:
latitude: "{{ state_attr('sensor.ONE2TRACK_DEVICENAME_1','device')['last_location']['latitude'] }}"
longitude: "{{ state_attr('sensor.ONE2TRACK_DEVICENAME_1','device')['last_location']['longitude'] }}"
last_contact: "{{ state_attr('sensor.ONE2TRACK_DEVICENAME_1','device')['last_location']['last_communication'] }}"
last_update: "{{ state_attr('sensor.ONE2TRACK_DEVICENAME_1','device')['last_location']['last_location_update'] }}"
speed: "{{ state_attr('sensor.ONE2TRACK_DEVICENAME_1','device')['last_location']['speed'] }}"
signal_strength: "{{ state_attr('sensor.ONE2TRACK_DEVICENAME_1','device')['last_location']['signal_strength'] }}"
battery: "{{ state_attr('sensor.ONE2TRACK_DEVICENAME_1','device')['last_location']['battery_percentage'] }}"
balance: "{{ (state_attr('sensor.ONE2TRACK_DEVICENAME_1','device')['simcard']['balance_cents']/ 100)| round(2) }}"
Changed the balance to display in rounded euro’s instead of cents.
Then you can easily make a device tracker like so:
- id: DEVICETRACKER_NAME
alias: DEVICETRACKER NAME
description: ADD DESCRIPTION
mode: queued
trigger:
- platform: homeassistant
event: start
- platform: state
entity_id: sensor.DEVICENAME_ONE2TRACK
action:
- service: device_tracker.see
data:
dev_id: DEVICENAME
gps: >
{% if not is_state('sensor.DEVICENAME_ONE2TRACK', 'OFFLINE') -%}
[{{ state_attr('sensor.DEVICENAME_ONE2TRACK','latitude') }}, {{ state_attr('sensor.DEVICENAME_ONE2TRACK','longitude') }}]
{%- else -%}
[]
{%- endif %}
Might not work as it’s part of a larger device tracker I built for my kids that also switches based on calendar entries. But it should at least point you in the right direction.