Shortcuts — Water Meter with debit control, markdown

Inspired by @Solar-Glare‘s topic DTTG - Update sheet action in Shortcuts added.

The shortcut

  • logs current measurement with date
  • calculates and logs debit from last measurement
  • marks overspending by red — you define your threshold (limit) of debit in dictionary in beginning of shortcut

Installation

Get the shortcut — Water Meter with debit control

Create markdown form “Water Meter Log.md” with the following content:

![Water meter # 1](https://www.balkanplumbing.com/wp-content/uploads/old-water-meter.jpg)

| Date | Measurement | Debit |
|:--|--:|--:

IMPORTANT: No empty line after |:—|—:|—:

IMPORTANT: Previous measurement stores in Comment property of Water Meter Log file — put there a number.

You can use multiple meters, so you can put a picture for every meter’s markdown-log.

You can adjust Date format as you want — with or without time, in YYYY-MM-DD and so on.

1 Like

Future-request

If we had custom metadata

We could define debit threshold for every separate meter’s log file — now we can define this parameter only in shortcut.

If we could insert data in defined line of markdown file

We would be able to make descending by date list order — fresh records on top. Now, if there are many records, we have to scroll down a file.

Dear developers, please, in Update Content action — add option Insert into N line, where N is line number.

Nice work! This reverses the rows and puts new data on top. That does indeed make more sense in the context of a water meter for example.

Unfortunately, this cannot put new data on top.

Sorry for my unclear description :flushed: — “28 июн.” means “June 27”, and “27 сент.” means “September 27” :slight_smile:

It would be able to put new data on top, if Update Content action could insert new data into definite place (line number). Now Update Content action can replace all the data, or append at the end of file.

Right, misunderstood that. I must admit my Cyrillic isn’t very good :grinning:

Result looks fine.

Jim, did you use TWO auxiliary files? — One for historical data, and another one for heading?

Jim, did you use TWO auxiliary files? — One for historical data , and another one for heading ?

Nope.

Given the simplicity of the task and the low overhead of plain text, I cached the prefixing text and the current text separately. Then I added them back together with the new data in between, and rewrote the entire file. Again, plain text = low hanging fruit, so not a performance problem.

Takes waaay more steps than other automation options, but it’s passable.
Here’s a link to the quickly composed shortcut: Split Example

2 Likes

Jim,

Your solution reminded me film The Flying Scotsman (2006), where the main character told something like “Use what you have”.

Your solution is better than I expected from my suggestion! No need to care about line number — alter Markdown file as you need, just don’t touch first two strings of table.

You improved my system, Jim, thanks a lot!

My updated shortcut

Now puts new data on top.

Installation

Get the shortcut — Water Meter with debit control (v2)

Create markdown form “Water Meter Log.md” with the following content:

<Your heading — Meter info, photo, …>

| Date | Measurement | Debit |
|:--|--:|--:|

Don’t forget to write a number in comment — “0” or any other number — it’s previous measurement.

2 Likes

It makes sense to make reusable shortcut, for use it by other shortcuts.

How to pass to such shortcut the following variables?

  • Text to be splitted
  • “Splitter” like |:—|—:|—:| or ## Links
  • Text to be inserted

This would allow to use such reusable shortcut for many situations

  • To register new document in docs registry
  • To add new record in counterpart’s journal
  • To create new note and immediate interlink with another note (Zettelkasten)

Glad you liked it and indeed, (1) you use the tools available at hand or (2) you do nothing at all. I prefer the former :slight_smile:

1 Like

Via List action.

RTFM helped :slight_smile:

1 Like