I was rebuilding my system and finally got everything back to where it was and started looking to see what else I could add.
This was quick and simple one. Will definitely help with the HA approval factor. I usually forget to renew my RD account and have to fix it. I guess I could set a calendar reminder. But why do that when they have an api?
sensor:
- platform: rest
name: Real Debrid Expiration
resource: https://api.real-debrid.com/rest/1.0/user
method: GET
headers:
Authorization: 'Bearer private API token'
value_template: "{{ value_json.expiration }}"
scan_interval: 86400 # Update once a day
- platform: template
sensors:
real_debrid_expiration_machine:
value_template: "{{ states('sensor.real_debrid_expiration') }}"
friendly_name: "Real Debrid Expiration Date"
formatted_real_debrid_expiration:
value_template: "{{ as_timestamp(states('sensor.real_debrid_expiration')) | timestamp_custom('%B %d, %Y') }}"
friendly_name: "Real Debrid Formatted Date"
real_debrid_expiration_countdown:
value_template: >
{% set expiration = as_timestamp(states('sensor.real_debrid_expiration')) %}
{% set now = as_timestamp(now()) %}
{% set days_remaining = ((expiration - now) // 86400) | int %}
{{ days_remaining }}
friendly_name: "Days Until Real Debrid Expiration"
unit_of_measurement: "days"
I plan on adding an automation to send a notification or turn the lamp in the TV room red when it get close to the expiration date.
If you find it helpful or not, but still want to get an RD account, here is a my referral link.