“Add items via textual definition” - pattern and unit?

I tried adding an item with the following string:

Number:Time haard_eetkamer_waakvlamaftelling "Waakvlamaftelling haard eetkamer [%1$tM:%1$tS]" {	stateDescription=" "[pattern="%1$tM:%1$tS", min="", max="", step="", options=""] }

But not all went as I expected:

  1. Something unexpected happens with the [%1$tM:%1$tS]. As per the documentation, that’s the proper format, but the substring is also included in the label, which isn’t what I wanted to achieve, obviously.
  2. The pattern isn’t correctly integrated… I assume this no longer works…


&

The pattern isn’t used:

Any takers? :slight_smile:

stateDescription is meant to be a replacement for the old method of putting labels in names. However, labels still work since there are lots of people still using them. You can’t have both at the same time, so remove one or the other.

Got it. I deleted and recreated the item, this time with:

Number:Time haard_eetkamer_waakvlamaftelling "Waakvlamaftelling haard eetkamer" {	stateDescription=" "[pattern="%1$tM:%1$tS", min="", max="", step="", options=""] }

But why doesn’t the format work? The item reads 66 s, instead of 1:06?

The pattern is correct, it seems…?

Are you sure you’re showing the item created from file input ?
It should show a lock symbol and a text saying "Note: This Item is not editable because it has been provisioned from a file. " which it doesn’t in your post.
So seems that’s the UI-provisioned version. If so, delete it.

No, I’m using “Add items via textual definition” in the UI.

I think that the pattern you are using applies to DateTime items and not to Number items with Unit Of Measurement time.

No, the pattern works for an other item, which I made in the “regular” UI way:

See also Countdown timer widget - #7 by ErikDB.

Can you try removing the state description from the item and recreating it?

  1. I don’t know how well the item import from text handles these attributes. There may be issues.
  2. If you delete an item in the UI, the metadata may nog get deleted. So if you import again, it has the old value.

That did the trick. I assume that’s a bug?

(Luckily, I only have two items like that, so manual editing is not too cumbersome, for me at least.)