I have been trying to set up an AMS reader to submit power readings to openhab via mosquitto.
AMS Reader can provide Home Assistant discovery. Unfortunately all the discovered channels contain a value template along the lines of "val_tpl":"{{ value_json.P3 | is_defined }}".
"is_defined" is a HA extension to jinja, so all channels fail when receiving data with:
"Executing the JINJA-transformation failed: An error occurred while transformation. UnknownTokenException: Unknown token found: value_json.P3 | is_defined".
To be able to implement these extensions in the mqtt.homeassistant binding, you need to be able to add java implementations of jinja extensions.
jinjava supports adding custom extensions that implement given interfaces on the Context class, so the main thing missing is a facility in the JinjaTransformationService, or similar place, to read something from f.x. feature.xml for a binding and instantiate and register extensions when constructing the service.
Your Environment
Version used: 4.x
So far this is a somewhat nebulous request submitted to start a discussion.
I have been trying to set up an AMS reader to submit power readings to openhab via mosquitto.
AMS Reader can provide Home Assistant discovery. Unfortunately all the discovered channels contain a value template along the lines of "val_tpl":"{{ value_json.P3 | is_defined }}". "is_defined" is a HA extension to jinja, so all channels fail when receiving data with: "Executing the JINJA-transformation failed: An error occurred while transformation. UnknownTokenException: Unknown token found: value_json.P3 | is_defined".
There is a list of these extensions at https://www.home-assistant.io/docs/configuration/templating/.
To be able to implement these extensions in the mqtt.homeassistant binding, you need to be able to add java implementations of jinja extensions.
jinjava supports adding custom extensions that implement given interfaces on the Context class, so the main thing missing is a facility in the JinjaTransformationService, or similar place, to read something from f.x. feature.xml for a binding and instantiate and register extensions when constructing the service.
Your Environment
So far this is a somewhat nebulous request submitted to start a discussion.