Created
April 2, 2020 14:53
-
-
Save esbenr/c1b0970548a2431ab75be24ea82c20e0 to your computer and use it in GitHub Desktop.
Utilizing Renosyds API to integrate garbage collection into Home Assistant
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sensor: | |
- platform: rest | |
resource: http://skanderborg.netdialog.renosyd.dk/service/Restservice.svc/json/commonapp1/address/123964/containers | |
username: !secret renosyd_username | |
password: !secret renosyd_password | |
authentication: basic | |
headers: | |
Content-Type: application/json | |
scan_interval: 360 | |
json_attributes: | |
- District | |
- NextCollectionDate | |
- CollectionCalendar | |
- CollectionDescription | |
- ContainerDescription | |
name: renovation_haveaffald | |
device_class: timestamp | |
value_template: '{{ strptime(value_json[0].NextCollectionDate, "%d-%m-%Y") }}' | |
- platform: rest | |
resource: http://skanderborg.netdialog.renosyd.dk/service/Restservice.svc/json/commonapp1/address/123964/containers | |
username: !secret renosyd_username | |
password: !secret renosyd_password | |
authentication: basic | |
headers: | |
Content-Type: application/json | |
scan_interval: 360 | |
name: renovation_restaffald | |
device_class: timestamp | |
value_template: '{{ strptime(value_json[1].NextCollectionDate, "%d-%m-%Y") }}' | |
- platform: rest | |
resource: http://skanderborg.netdialog.renosyd.dk/service/Restservice.svc/json/commonapp1/address/123964/containers | |
username: !secret renosyd_username | |
password: !secret renosyd_password | |
authentication: basic | |
headers: | |
Content-Type: application/json | |
scan_interval: 360 | |
name: renovation_storskrald | |
device_class: timestamp | |
value_template: '{{ strptime(value_json[2].NextCollectionDate, "%d-%m-%Y") }}' | |
- platform: rest | |
resource: http://skanderborg.netdialog.renosyd.dk/service/Restservice.svc/json/commonapp1/address/123964/containers | |
username: !secret renosyd_username | |
password: !secret renosyd_password | |
authentication: basic | |
headers: | |
Content-Type: application/json | |
scan_interval: 360 | |
name: renovation_emballage | |
device_class: timestamp | |
value_template: '{{ strptime(value_json[3].NextCollectionDate, "%d-%m-%Y") }}' | |
- platform: rest | |
resource: http://skanderborg.netdialog.renosyd.dk/service/Restservice.svc/json/commonapp1/address/123964/containers | |
username: !secret renosyd_username | |
password: !secret renosyd_password | |
authentication: basic | |
headers: | |
Content-Type: application/json | |
scan_interval: 360 | |
name: renovation_pappapir | |
device_class: timestamp | |
value_template: '{{ strptime(value_json[4 ].NextCollectionDate, "%d-%m-%Y") }}' | |
- platform: template | |
sensors: | |
renovation_restaffald_formatted: | |
friendly_name: Restaffald | |
value_template: >- | |
{% set date = states.sensor.renovation_restaffald.state %} | |
{% set strDate = as_timestamp(date) | timestamp_custom("%d/%m-%Y", true) %} | |
{% set weekdays = ["Mandag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lørdag", "Søndag"] %} | |
{% set weekdaynumber = strptime(strDate, "%d/%m-%Y").weekday() | int %} | |
{% set weekday = weekdays[weekdaynumber] %} | |
{% set days = (((as_timestamp(date))-as_timestamp(now())) | int /60/1440) | round(0, "ceil") %} | |
{% if days == 0 %} | |
Tømmes idag ({{ weekday }} d. {{ strDate }}) | |
{% elif days == 1 %} | |
Tømmes imorgen ({{ weekday }} d. {{ strDate }}) | |
{% else%} | |
Tømmes om {{ days }} dage ({{ weekday }} d. {{ strDate }}) | |
{% endif %} | |
renovation_emballage_formatted: | |
friendly_name: Emballage | |
value_template: >- | |
{% set date = states.sensor.renovation_emballage.state %} | |
{% set strDate = as_timestamp(date) | timestamp_custom("%d/%m-%Y", true) %} | |
{% set weekdays = ["Mandag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lørdag", "Søndag"] %} | |
{% set weekdaynumber = strptime(strDate, "%d/%m-%Y").weekday() | int %} | |
{% set weekday = weekdays[weekdaynumber] %} | |
{% set days = (((as_timestamp(date))-as_timestamp(now())) | int /60/1440) | round(0, "ceil") %} | |
{% if days == 0 %} | |
Tømmes idag ({{ weekday }} d. {{ strDate }}) | |
{% elif days == 1 %} | |
Tømmes imorgen ({{ weekday }} d. {{ strDate }}) | |
{% else%} | |
Tømmes om {{ days }} dage ({{ weekday }} d. {{ strDate }}) | |
{% endif %} | |
renovation_pappapir_formatted: | |
friendly_name: Pap og papir | |
value_template: >- | |
{% set date = states.sensor.renovation_pappapir.state %} | |
{% set strDate = as_timestamp(date) | timestamp_custom("%d/%m-%Y", true) %} | |
{% set weekdays = ["Mandag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lørdag", "Søndag"] %} | |
{% set weekdaynumber = strptime(strDate, "%d/%m-%Y").weekday() | int %} | |
{% set weekday = weekdays[weekdaynumber] %} | |
{% set days = (((as_timestamp(date))-as_timestamp(now())) | int /60/1440) | round(0, "ceil") %} | |
{% if days == 0 %} | |
Tømmes idag ({{ weekday }} d. {{ strDate }}) | |
{% elif days == 1 %} | |
Tømmes imorgen ({{ weekday }} d. {{ strDate }}) | |
{% else%} | |
Tømmes om {{ days }} dage ({{ weekday }} d. {{ strDate }}) | |
{% endif %} | |
renovation_haveaffald_formatted: | |
friendly_name: Haveaffald | |
value_template: >- | |
{% set date = states.sensor.renovation_haveaffald.state %} | |
{% set strDate = as_timestamp(date) | timestamp_custom("%d/%m-%Y", true) %} | |
{% set weekdays = ["Mandag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lørdag", "Søndag"] %} | |
{% set weekdaynumber = strptime(strDate, "%d/%m-%Y").weekday() | int %} | |
{% set weekday = weekdays[weekdaynumber] %} | |
{% set days = (((as_timestamp(date))-as_timestamp(now())) | int /60/1440) | round(0, "ceil") %} | |
{% if days == 0 %} | |
Tømmes idag ({{ weekday }} d. {{ strDate }}) | |
{% elif days == 1 %} | |
Tømmes imorgen ({{ weekday }} d. {{ strDate }}) | |
{% else%} | |
Tømmes om {{ days }} dage ({{ weekday }} d. {{ strDate }}) | |
{% endif %} | |
renovation_storskrald_formatted: | |
friendly_name: Storskrald | |
value_template: >- | |
{% set date = states.sensor.renovation_storskrald.state %} | |
{% set strDate = as_timestamp(date) | timestamp_custom("%d/%m-%Y", true) %} | |
{% set weekdays = ["Mandag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lørdag", "Søndag"] %} | |
{% set weekdaynumber = strptime(strDate, "%d/%m-%Y").weekday() | int %} | |
{% set weekday = weekdays[weekdaynumber] %} | |
{% set days = (((as_timestamp(date))-as_timestamp(now())) | int /60/1440) | round(0, "ceil") %} | |
{% if days == 0 %} | |
Tømmes idag ({{ weekday }} d. {{ strDate }}) | |
{% elif days == 1 %} | |
Tømmes imorgen ({{ weekday }} d. {{ strDate }}) | |
{% else%} | |
Tømmes om {{ days }} dage ({{ weekday }} d. {{ strDate }}) | |
{% endif %} |
Use Fiddler or Charles to inspect the traffic when using the app.
Sadly, I haven't access to do that :(
You don't know if there is any other way to get it?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@esbenr Where did you get your username and password? :-)