andrey-git / home-assistant-custom-ui

Custom UI elements for https://home-assistant.io
https://home-assistant.io
MIT License
526 stars 97 forks source link

input_boolean (not) customizable? #124

Closed Mariusthvdb closed 6 years ago

Mariusthvdb commented 6 years ago

trying to change the icon of an input_boolean, ive run out of ideas. Is it possible, if yes, what should i do? ive tried several variations of below code:

input_boolean.activity_notification: icon_template: > if (state === 'on') return 'mdi:message-bulleted' else return 'mdi:message-bulleted-off'

icon_template: > {% if is_state('input_boolean.activity_notification', 'on') %} mdi:message-bulleted {% else %} mdi:message-bulleted-off {% endif %}

entity_picture_template: > {% if is_state('input_boolean.activity_notification', 'on') %} mdi:message-bulleted {% elif is_state('input_boolean.activity_notification', 'off') %} mdi:message-bulleted-off {% endif %}

Thanks, Marius

fanaticDavid commented 6 years ago

icon_template and entity_picture_template are config options within Home Assistant which are (currently) only available for specific platforms, such as the Template Sensor and the Template Switch. Based on the input boolean docs here, those config options have not been implemented.

Mariusthvdb commented 6 years ago

starting to think you're right.... but since these doc's have been found incomplete at times, i'd thought i'd ask here. Hope it will be anytime soon. the template section in -dev-tools show they work fine though, must make implementing it at least an viable option.

btw i have this template sensor that doesnt work either, would you be able to spot the issue (only thing i can think of now is it in a package, which might frustrate correct behavior?):

sensor:
  - platform: template
    sensors:
      alarmclock_wd_time_template:
        friendly_name: 'Time wd'
        icon_template: "{{ 'mdi:alarm' if is_state('input_boolean.alarmclock_wd_enabled', 'on') else 'mdi:close-circle' }}"
        value_template: '{{ "%0.02d:%0.02d" | format(states("input_number.alarmclock_wd_hour") | int, states("input_number.alarmclock_wd_minute") | int) }}'
andrey-git commented 6 years ago

This is unrelated to customui. Please take it to the forum.