I’ve been breaking my head over this a couple of nights now, but I don’t know how to get this done so I hope someone can help me out.
Goal:
My dryer and washing machine (using the Bosch Home Connect app) have a tag available with “minutes left” (string, format mm:ss) that indicates when the current program is finished. My goal is to calculate the end time of the program using the remaining time from the current time.
For example: The current time is 15:00, remaining time is 30:00. I want to calculate the end time, in this case 15:30.
I’ve been trying with Homeyscript, but if I’m correct, I can’t read tag/variable values in the script.
My guess is I need to use BLL for this, but I don’t know what to do.
Hoping someone can help me in the right direction!
I would suggest to ignore the seconds part from your dryer/washer. Make a flow, that extract the first part of the variable like this:
(You can use the standard logical card, just get the format right)
Divide the result by 60.
Extract time from now-time variabel, use the whole number value from your previous calculation, add that to the hour time you just extracted.
from your calculation, you got a value after the desimal point, that is the minute part. 60*result gives you minutes. Add that to now-time variabel. After calculation, run it in to a “all” block, then set the time hours and minutes.
You have to make “failsafe” function so you do not exceeed 24 hours and exceed 60 minutes.
Thanks a lot! This works. I don’t have the failsafe yet though.
@Rmb, I’ll have to look into this. Does this mean that the hours and minutes I extracted in the example of @Marius_Stensrod I all have to convert to milliseconds to use the BLL flow card for epoch?
Yes, to set the endtime 1 hour and 30 minutes later after the current time, use BLL card “set variable to BLL expression “, using the expression date('shorttime', Date.now() + (90*60000) )
Or date('hh:mm', Date.now() + (90*60000) )
Which does the same format.
Am I missing something? I do not see that this is Epoch(Unix) time.
And you can remove the number 24 after HH, it should be HH:mm to get the time now with 24hour timestamp.
For Unix time, you can just write “now” in the BLL card, without the quotes. If I understand correctly when it is talking about Epoch time.