I am a happy user of the Trashcan Reminder 2.0 app for the notifications on my phone for when the trash will be picked up.
Until recently I had a Home-Assistant dashboard, where I had a card which showed, for each type of trash, the future pickup dates (today or later). Currently, I am making the switch to a homey dashboard (Hdashboards.app). I got all the functionality I had on HA, working on the new dashboard, except for the trash pickup card.
I see that the trashcan reminder app has all the correct pickup dates available, but the app itself only gives the option “today, tomorrow, or day after tomorrow”, not for example “01-12-2023” as next date.
There is a JSON available with all the dates, but I have no clue how to get the data out of there.
Anyone has any tips how I could achieve this?
As long as I can get the next date for, for example, Plastic as a tag or something like that; then I should be able to get it shown on my dashboard.
I want to show the next date for the trash pickup on my dashboard. So one date for plastic, 1 for organic, etc. The date should either be today, or the first date after today.
To be able to show it on the dashboard, i somehow need to obtain that date in some format. Then I can indeed use it in a flow, or virtual device, or something like that.
I have no experience with HDashboard, so I do not know how to get the string value to there. (Perhaps via an advanced virtual device or something?)
However, I do know how to use HomeyScript to fetch the data the Trashcan Reminder 2.0 app shows as debug info and use that to get the next date per type.
First get yourself an API key via Settings/API Keys ( https://my.homey.app/homeys/HOMEY_ID/settings/system/api-keys ) with permissions to View and Control Apps (make sure you’re logged in as the owner of the Homey and I believe you need a 2023 pro homey for this)
I hope that helps somewhat with getting things to work.
If you have an idea of how to get the string to the HDashboard and/or experience difficulties, let me know.
Wow thanks! Indeed exactly what I was looking for.
I installed the HomeyScript app, but i still have a question regarding the mentioned API.
What kind of API are you referring to? Of the Homey itself?
I have a homey (early 2019). Would it work with the Local API App for example?
And how would you setup a flow that would translate those 4 dates (console output) into a (advanced) virtual device?
Edit: For me it’s also okay if it’s not linked to trashcan reminder app. If I can simply type the list in homey script (once a year), and that the homeyscript looks up the next date (today or later) and outputs that; then that also works.
Guess i’ll have to investigate further into HomeyScript, to see how it works.
I made a homeyscript using chatgtp (since I do not know much about this language). Would the following work?:
// Specify a list with 10 pre-defined dates
const dateList = [
new Date(‘2023-01-01’),
new Date(‘2023-02-15’),
new Date(‘2023-03-10’),
new Date(‘2023-04-05’),
new Date(‘2023-05-20’),
new Date(‘2023-06-15’),
new Date(‘2023-07-01’),
new Date(‘2023-08-10’),
new Date(‘2023-09-05’),
new Date(‘2023-10-20’)
];
// Get the current date
const today = new Date();
// Find the first date after today in the list
let selectedDate = null;
for (const date of dateList) {
if (date >= today) {
selectedDate = date;
break;
}
}
// Save the selected date as a variable
let DatumPickup= selectedDate ? selectedDate.toISOString() : null;
// Output the result
console.log(‘Selected Date:’, DatumPickup);
I don’t know what your script does, but I doubt it solved your problem.
Regarding the API, it seems the internal token of HomeyScript also works fine, so I adjusted the script to not require an API token anymore
As said previously I have no experience with HDashboard, but if it is capable to show any device with it’s (text-)capabilities an Advanced Virtual Device may do the trick.
To create an Advanced Virtual Device, you need to install the Device Capabilities app ( Device Capabilities App voor Homey | Homey ).
While adding a new Advanced Virtual Device, you can choose the option to import a TEF file.
You can use this code to add a device with 4 text labels for PMD/GFT/PAPIER/REST: [tef:AVD:"H4sIAAAAAAACA4WUWZOiMBSF/wuvdlcLCSL9xuIS3HBBxKmprogRo0AQCIJT898Hp3WWLqs7L6k6J/eej7okP4QtKahPkM9i4VXowwxp78vQgDirJMUY6WY7nLvxMkMb0mhCwxswa4YGTqjZ6hgdTNLZTz0LzZBRKJdkesKE2BZbX6Cygg1c7UlROqaz2KhESuR+sRWlfuxvWoW9tOY8upyhPSx4FamrFZ2v9WChzXVE22sTTr3zoOJufCiqk9cID5oSVkvPshbnnTcBpsvTpFpoC3cPS73t0heGGhvITg1vtwcqnNjVmILGugtWy4Ohj70d6+rcPSttc+QnillW5/7eZQhvmnymGN7uRYmKiyXyBABJbA4tFLdcwFdjbyYv5xo6eqV9Al6/BSPgmImm7Zc0Mvhg2p1Eg6XTGzsToI9yFBxWw5jxnEmTTc91hlt4FBdkmHTlE+6zjNCLPOof58hs8tPaoz219PTSUwMaVHYoR1XvNDYGHdR1Ej06RpKB0pnKd9ywzgjIo2nbHw5KD3e9xDNMqtO11qnQaN1Yy7lcNh1uj8/B0hePsVHax0urUuRqe1BfbMtsTweLAO61QNOEJ8HnWc6i69wz4fXHzyeBpTSgMQ7Rtv4R2r4iEZ+QZ7Jpgmfok+0zVqH6LKoqFOXWVtpiqW6SkTyncXDtIJCYpEH1VuCQk7dr2xzHufAa8zB8EmIebUg62S1ImXcpCbd1Cfwrj3/vd6P519AZCwmOHzk8z9kjw8ARSfEDY0iz/B/ZD+tdYPmepPWX5DWYOK5La63XXdwVIyU4J92QnQ2cXgt3OMzIzZyTBKe1beAEb2hIc0o+ntizs3aNyUicsT85t9v2PoI3Ubzp0i3f1mzUmd3FzxCkLxGkxwjS/wiSctPBHWFk3pXP8sGX+eBxPviQD246vOXPOvP7DOBnAPBLAPgYAH6YARDqK/D+Ft4QBiE9svo0Fl6/ff/5C2bi9SwpBQAA":/tef]
After that, make a HomeyScript “Kliko Next Days” with the following content:
Hi all,
when testing the script, I get the following script error. Who can help me further?
Script Error
FetchError: request to https://192-168-178-100.homey.homeylocal.com/api/manager/apps/app/com.trashchecker/setting/collectingDays failed, reason: getaddrinfo ENOTFOUND 192-168-178-100.homey.homeylocal.com
at ClientRequest. (/app/node_modules/node-fetch/lib/index.js:1491:11)
at ClientRequest.emit (node:events:517:28)
at TLSSocket.socketErrorListener (node:_http_client:501:9)
at TLSSocket.emit (node:events:517:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
With this widget you are able to see all next trash dates for every type. So if GFT is collected in 14 days, you will see it in the widget if it collected today and in 14 days, you will only see today. But I guess that is the most important right?
The dashboard widget supports this now indeed! The data has always been available in the app, so you can retrieve it (just as the new widget does). But then you need to create some virtual devices somehow (some options are described above in this thread). However they are all quite complex.
Think the new widget will serve its purpose. And if someone with some UI/UX skills comes along I might make some variants.
So if you have specific requirements then please let me know. A mock-up / wireframe helps to realise the requirements