Partially a sharing post, partially a request for ideas.
I have to fill in a timesheet at work, like many others. I maintain my own, having been an Excel jockey for years. It exports an XML file with my current available leave balance and current flexi time balance. This is one of the things I love about HA, I have finally got a place to have a ‘personal dashboard’ where I can throw all sorts of interesting (to me!) information that I would normally set something up for but then not really use. I use VBA in Excel to export a table to XML which is saved in my dropbox. I then use a curl command line sensor to download the file and use this very crude command line sensor to get the data;
My question is, does anyone have any idea how I can take the XML duration information for my flexi balance and get ‘x hours and y minutes’, not necessarily for the HA screen but for an Alexa flash briefing. I’ve googled around but not being a programmer I am struggling as there doesn’t seem to be any similar examples I can find. I am running on a raspberry pi with Rasbian Stretch and HA 0.59.
Yes, by all means thank you! I thought it would be possible using awk but I’ve never used that before and struggled to find an example I could work with, so this is really helpful. I will replace my grep call as well. Much appreciated =]
Update: sorry, realised the awk replaces the grep, but will still note that for future usage.
Thanks to stibbons, and also after having discovered that you can’t get a JSON array from the command_line sensor, I have wrapped this up into a little script that gives me a integer value along with a unit_of_measurement I can use;