spook icon indicating copy to clipboard operation
spook copied to clipboard

Add template method: (is_)on

Open frenck opened this issue 1 year ago • 1 comments

Description

Adds a template function: is_on. Available as test: on.

Motivation and Context

This allows for a cleaner syntax in templates. For example:

{{ is_on("light.kitchen") }}
{{ "light.kitchen" | is_on }}

The real gem here is the test usage:

{% if "light.kitchen" is on %}
  Yes the light is on!
{% endif %}

How has this been tested?

Screenshots (if appropriate):

Types of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] Other

Checklist

  • [x] My code follows the code style of this project.
  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.

frenck avatar Jan 11 '24 07:01 frenck

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

sonarqubecloud[bot] avatar Jan 11 '24 11:01 sonarqubecloud[bot]