Skip to content

Instantly share code, notes, and snippets.

@nbeernink
Last active January 13, 2026 17:29
Show Gist options
  • Select an option

  • Save nbeernink/a79120e1fce6247b3a90ab547fccc051 to your computer and use it in GitHub Desktop.

Select an option

Save nbeernink/a79120e1fce6247b3a90ab547fccc051 to your computer and use it in GitHub Desktop.
Trappers.net REST sensor for Home Assistant
rest:
- resource: https://api.trappers.net/api/auth/v2/login
method: POST
headers:
user-agent: Home Assistant
content-type: application/json
scan_interval: 3600 # Set this number (in seconds) to be HIGHER then the sensor below to "cache" the bearer token attribute
payload: '{"employeeEmail": "<your-email>", "password": "<your-password>"}'
sensor:
- name: Trappers Balance
value_template: "{{ value_json.userDetails.balance | round(0) }}"
unit_of_measurement: Trappers
icon: mdi:bicycle
state_class: total
json_attributes:
- token
- resource: "https://api.trappers.net/api/events?limit=1&offset=0"
method: POST
scan_interval: 3540 # Set this number in (seconds) to be LOWER then the above sensor otherwise the bearer token is invalid
headers:
authorization: "Bearer {{ state_attr('sensor.trappers_balance','token') }}"
content-type: application/json
payload: '{}'
sensor:
- name: Trappers Last Registration
value_template: "{{ value_json['items'][0].date }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment