Changing input_number doesn't work

Why does this:
ha-test

throw this error?

you cannot use templates here. do it in yaml file
NOT TRUE! See below

1 Like

You can’t use templates in the dev tools :frowning:

Edit: @AhmadK JINX

1 Like

But why does this work?
ha-test-3

can you call persistent_notification.create service with the same data and tell us how it works?

Works!
ha-test-4

well spotted!

so it looks like it depends on an integration - some of them accept templates in input data and some don’t.

here’s how input_number is configured inside:

component.async_register_entity_service(
        SERVICE_SET_VALUE,
        {vol.Required(ATTR_VALUE): vol.Coerce(float)},
        "async_set_value",
    )

so good luck in passing templates to it :wink:

on the other hand, with persistent_notification:

SCHEMA_SERVICE_CREATE = vol.Schema(
    {
        vol.Required(ATTR_MESSAGE): cv.template,
        vol.Optional(ATTR_TITLE): cv.template,
        vol.Optional(ATTR_NOTIFICATION_ID): cv.string,
    }
)

So yes, it depends on an integration you’re using.

Speaking about persistent_notification - the docs would benefit from mentioning this handy feature.
Actually, I use it all the time but didn’t think there is no mention of templates’ support in the docs.
It’s there, but below service parameters’ description - not ideal I’d say, so easy not to reach that line… :frowning:
PR merged!

@jocnnor, looks like we’re too fast to answer :man_facepalming:

1 Like