Replies: 2 comments 1 reply
-
Thanks for posting a discussion about homepage here on GitHub. Homepage now uses a fancy new AI tool thanks to our friends at Glime, so the answer below is the AI bot's attempt to answer your question. If you feel it's sufficient you can mark the answer and close this post, otherwise feel free to leave it open of course! Thanks for using Homepage! ❤️ To display the "time_remaining" value in a relative time format, you can use the Here's how you can modify your configuration to display the estimated finish time:
Unfortunately, based on the provided context, the Custom API widget does not seem to support direct conversion of a duration in seconds to a relative date format like "in an hour" or "2:30pm". You would need to perform this calculation server-side or within the widget's processing logic, which may not be directly supported by the widget configuration. If the widget or the system it's running on supports JavaScript or another programming language, you could potentially write a script to perform this calculation and then pass the calculated date-time to the widget for display. Since the documentation does not provide a direct way to achieve this with the given configuration options, you may need to look into extending the widget's functionality with custom code or requesting this feature from the developers. For now, you can display the time remaining in seconds or convert it to a more readable format like hours and minutes using the Here's an example of how you might display the time remaining in hours and minutes: - field: time_remaining
label: Time Remaining
format: number
suffix: " minutes"
scale: 0.0166667 # Converts seconds to minutes This will not give you the exact "in an hour" or "2:30pm" format, but it will provide a more readable estimate of the time remaining. If you have access to the system's backend or can modify the widget's code, you could implement the desired functionality there. This comment was generated by Glime. |
Beta Was this translation helpful? Give feedback.
-
This discussion has been automatically closed due to inactivity. See our contributing guidelines for more details. |
Beta Was this translation helpful? Give feedback.
-
Description
Hello! I'm testing out using the Custom API widget to display information from the PrusaLink service on my Prusa 3D Printer. I'm trying to mimic what the built-on Octoprint widget does basically.
I've setup the widget and am getting data back from the PrusaLink API. Here's an example response body for reference:
{ "id": 217, "state": "PRINTING", "progress": 36, "time_remaining": 6000, "time_printing": 3814, "file": { "refs": { "icon": "/thumb/s/usb/HSW_PA~1.BGC", "thumbnail": "/thumb/l/usb/HSW_PA~1.BGC", "download": "/usb/HSW_PA~1.BGC" }, "name": "HSW_PA~1.BGC", "display_name": "HSW_Panel_224x190_0.4n_0.25mm_PETG_MK4IS_2h38m.bgcode", "path": "/usb", "size": 2480278, "m_timestamp": 1711036211 } }
The "time_remaining" value is in seconds. Does anyone know of a way I could display that in a relative time format to display the estimated print finish time? Something like "in an hour" or "2:30pm"? I've tried playing around with relativeDate, but haven't quite gotten there yet.
homepage version
c89c488
Installation method
Docker
Configuration
Container Logs
No response
Browser Logs
No response
Troubleshooting
No relevant tests, I'm not having any major issues. Just a question on relative time formatting.
Beta Was this translation helpful? Give feedback.
All reactions