TagConfig attempt


#1

We need a tag-scoped config type, like TenantConfig. I looked at the documentation of Config and tried first something dynamic but then gave up and tried this:

entity type TagConfig mixes Config, Singleton schema name 'TAGCFG' {
    IndividualOverConsumptionAlertEnabled: boolean
    IndividualConsumptionPositiveAlertEnabled: boolean
    HotWaterColdWaterAlertEnabled: boolean
    SumIndividualOverConsumptionAlertEnabled: boolean
    ZeroOrNegativeAlert: boolean
}

I am still getting errors like:


and I could not find examples in c3base on how to use the documented methods, in particular:

  1. configValue(path, failIfMissing)
  2. setConfigValue(path, value, override)
  3. getConfig()

#2

Renamed the type to something more specific, and removed the entity attribute:

type AlertConfig mixes Config, Singleton {
    IndividualOverConsumptionAlertEnabled: boolean
    IndividualConsumptionPositiveAlertEnabled: boolean
    HotWaterColdWaterAlertEnabled: boolean
    SumIndividualOverConsumptionAlertEnabled: boolean
    ZeroOrNegativeAlert: boolean
}

Still getting the cast error:


It is a little different this time:

Error: wrapped ClassCastException: c3.type.admin.impl.ConfigImpl cannot be cast to c3.type.metadata.Singleton
    at new C3.client.ActionError (https://engie-vertuoz-stage3.c3iot.com/typesys/1/all.js?env=browser&compat:1130:13)
    at Object.request (https://engie-vertuoz-stage3.c3iot.com/typesys/1/all.js?env=browser&compat:882:15)
    at Object.call (https://engie-vertuoz-stage3.c3iot.com/typesys/1/all.js?env=browser&compat:567:27)
    at c3Call (https://engie-vertuoz-stage3.c3iot.com/typesys/1/all.js?env=browser&compat:100:20)
    at Object._call (https://engie-vertuoz-stage3.c3iot.com/typesys/1/all.js?env=browser&compat:2764:20)
    at Object.eval (eval at get (https://engie-vertuoz-stage3.c3iot.com/typesys/1/all.js?env=browser&compat:3177:20), <anonymous>:5:15)
    at <anonymous>

At the same time, ZkConfig.inst() works, whereas the type is declared as:

type ZkConfig mixes Config, Singleton

and has a boolean field.