Pattern format in Channel Code

Hi all,

via HTTP Binding I created a thing based on JSONPATH Transformation. Basically it’s about getting COVID stuff from here: https://api.corona-zahlen.org/vaccinations/

The thing works quite well:

UID: http:url:92180f4e2e
label: CovidVaccinationNW
thingTypeUID: http:url
configuration:
  authMode: BASIC
  ignoreSSLErrors: false
  baseURL: https://api.corona-zahlen.org/vaccinations/
  delay: 0
  stateMethod: GET
  refresh: 30
  commandMethod: GET
  contentType: application/json
  timeout: 3000
  bufferSize: 2048
channels:
  - id: administeredVaccinations
    channelTypeUID: http:number
    label: Gesamte Impfungen
    description: null
    configuration:
      pattern: "%1$,d"
      stateTransformation: JSONPATH:$.data[*].NW.administeredVaccinations

But I’m wondering, if it would be possible to also format the number here? E.g. I want to include a thousands separator and therefore added

pattern: "%1$,d"

above. Unfortunately I does not work.

It works, when I put

%1$,d

into add Metadata → State Description → Pattern section.

Many thanks!

Matthias

That won’t work because all the transformations done in the Channel are to format the incoming data to a format that the Item supports, or format the state of the Item to work with the end device.

There are no separators for Numbers internally. It’s just a Number. The separator is strictly for displaying to a human. to Therefore it only makes sense to define that in the State Description.

Thanks for clarification.