Giter Site home page Giter Site logo

Comments (23)

andrey-git avatar andrey-git commented on August 28, 2024

return Seit (entities['sensor.climate_livingroom_windowshutter_openingtime'].state) Minuten offen; => return 'Seit ' + (entities['sensor.climate_livingroom_windowshutter_openingtime'].state) + ' Minuten offen';

from home-assistant-custom-ui.

tringler avatar tringler commented on August 28, 2024

Applied that, but unfortunately no change in the behaviour.

from home-assistant-custom-ui.

andrey-git avatar andrey-git commented on August 28, 2024

In both group and binary sensor?
It should have eliminated at lest one of the javascript errors.

from home-assistant-custom-ui.

tringler avatar tringler commented on August 28, 2024

Yes, I have only that left:

state-card-custom-ui.html:1 Uncaught TypeError: Cannot read property 'customizer.customizer' of null
    at Object.useCustomizer (state-card-custom-ui.html:1)
    at Object.init (state-card-custom-ui.html:1)
    at state-card-custom-ui.html:1

Yep, it's the same for group and for binary_sensor directly:

image

from home-assistant-custom-ui.

andrey-git avatar andrey-git commented on August 28, 2024

I pushed a new version were the template error prints a more helpful message and the "Cannot read property 'customizer.customizer' of null" is fixed.

from home-assistant-custom-ui.

tringler avatar tringler commented on August 28, 2024

I updated to the last version and can confirm all javascript errors are gone.

from home-assistant-custom-ui.

andrey-git avatar andrey-git commented on August 28, 2024

What happens if you apply the 'yellow' theme to everything via ConfigurationPanel->General menu?

from home-assistant-custom-ui.

tringler avatar tringler commented on August 28, 2024

That is working.

from home-assistant-custom-ui.

andrey-git avatar andrey-git commented on August 28, 2024

Just making sure: Is the state of binary_sensor.climate_livingroom_windowshutter indeed 'on' in the dev-state panel?

from home-assistant-custom-ui.

andrey-git avatar andrey-git commented on August 28, 2024

Also try to replace theme_template with a plain template: yellow to check if the template calculation is to blame or the theming code.

from home-assistant-custom-ui.

tringler avatar tringler commented on August 28, 2024

theme: yellow and template: yellow is working for sensor group and for binary_sensor.

from home-assistant-custom-ui.

andrey-git avatar andrey-git commented on August 28, 2024

What platform is that binary sensor?

from home-assistant-custom-ui.

tringler avatar tringler commented on August 28, 2024

binary_sensor - In my case binary_sensor.climate_livingroom_windowshutter - Which is defined as:

climate_livingroom_windowshutter:
  friendly_name: Fenster
  value_template: >-
    {%- if is_state("binary_sensor.jmd4015744_state", "off") -%}
        Zu
    {%- else -%}
        Offen
    {%- endif %}

I use it just for localization.

from home-assistant-custom-ui.

andrey-git avatar andrey-git commented on August 28, 2024

That explains it: The states of climate_livingroom_windowshutter are Zu and Offen, not on and off.

Either change theme_template to compare with those values or look at binary_sensor.jmd4015744_state's state

from home-assistant-custom-ui.

tringler avatar tringler commented on August 28, 2024

I'm sorry! - My configuration is a chaos. This is the right definition of the binary_sensor:

climate_livingroom_windowshutter:
  friendly_name: Fenster
  value_template: >-
    {%- if is_state("binary_sensor.jmd4015744_state", "off") -%}
        False
    {%- else -%}
        True
    {%- endif %}
  device_class: opening

But now it's working. Strange, but thanks a lot of for your help! Great work!

from home-assistant-custom-ui.

tringler avatar tringler commented on August 28, 2024

Unfortunately this seems to stop working - I have seen that the syntax changed a bit and I changed to that, but it's not working:

sensor.dashboard_livingroom_windowshutter:
  icon: mdi:glassdoor
  friendly_name: Wohnzimmer
  templates:
   theme: return 'yellow';

This is also not working anymore:
extra_data_template: if (entities['sensor.dashboard_livingroom_windowshutter'].state === 'Offen') return null; else 'Seit ' + (entities['sensor.climate_wc_windowshutter_openingtime'].state) + ' Minuten offen';

Only badges seems to be affected. In example this custom ui of a group is working:

group.windowshutter_kitchen:
  extra_data_template: return 'Erinnerung nach '  + (entities['sensor.climate_kitchen_windowshutter_remindertime'].state) + ' Minuten';

I don't see any error regarding custom ui on the js console. Any help is really appreciated.

from home-assistant-custom-ui.

tringler avatar tringler commented on August 28, 2024

@andrey-git Do you have a hint how I can get rid of that problem?

from home-assistant-custom-ui.

andrey-git avatar andrey-git commented on August 28, 2024

Could you provide a screenshot of what you get and a fuller config (i.e.. everything related to the non-working entity)

from home-assistant-custom-ui.

tringler avatar tringler commented on August 28, 2024

Frontend:

frontend:
#  javascript_version: latest
  extra_html_url:
    - /local/custom_ui/state-card-media_player.html
    - /local/custom_ui/state-card-custom-ui.html
    - /local/custom_ui/state-card-custom_alarm.html
    
  themes:
    yellow:
      label-badge-text-color: '#ffcc00'
    standard:
      ha-label-badge-title-width: 5em
    wide_badges:
      ha-label-badge-title-width: 7em

Group & Customization:

windowshutter_state:
  name: Fenster
  icon: mdi:glassdoor
  entities:
    - binary_sensor.dashboard_livingroom_windowshutter
    - binary_sensor.dashboard_bedroom_windowshutter
    - binary_sensor.dashboard_childrenroom_windowshutter
    - binary_sensor.dashboard_kitchen_windowshutter
    - binary_sensor.dashboard_wc_windowshutter


binary_sensor.dashboard_livingroom_windowshutter:
  icon: mdi:glassdoor
  friendly_name: Wohnzimmer
  templates:
   theme: return 'yellow';
  #extra_data_template: if (entities['sensor.dashboard_livingroom_windowshutter'].state === 'Offen') return null; else 'Seit ' + (entities['sensor.climate_wc_windowshutter_openingtime'].state) + ' Minuten offen';
  #state_card_mode: badges
binary_sensor.dashboard_bedroom_windowshutter:
  icon: mdi:glassdoor
  friendly_name: Schlafzimmer
  theme_template: if (entities['binary_sensor.climate_wc_windowshutter'].state === 'on') return 'yellow'; else return 'wide-badges';
  state_card_mode: badges
binary_sensor.dashboard_childrenroom_windowshutter:
  icon: mdi:glassdoor
  friendly_name: Kinderzimmer
  theme_template: if (entities['binary_sensor.climate_wc_windowshutter'].state === 'on') return 'yellow'; else return 'wide-badges';
  state_card_mode: badges
binary_sensor.dashboard_kitchen_windowshutter:
  icon: mdi:glassdoor
  friendly_name: Küche
  theme_template: if (entities['binary_sensor.climate_wc_windowshutter'].state === 'on') return 'yellow'; else return 'wide-badges';
  state_card_mode: badges
binary_sensor.dashboard_wc_windowshutter:
  icon: mdi:glassdoor
  friendly_name: WC
  theme_template: if (entities['binary_sensor.climate_wc_windowshutter'].state === 'on') return 'yellow'; else return 'wide-badges';
  state_card_mode: badges

Binary Sensor:

climate_livingroom_windowshutter:
  value_template: >-
    {%- if is_state("binary_sensor.jmd4015744_state", "off") -%}
        False
    {%- else -%}
        True
    {%- endif %}
  device_class: opening

This is what I get:

image

If I apply the theme manually it works:

image

I'm running HASS 0.58.1 + Custom UI 20171117 and I have no JS console errors.

from home-assistant-custom-ui.

andrey-git avatar andrey-git commented on August 28, 2024

You still have a few

theme_template:

which you need to replace with

templates:
   theme:

from home-assistant-custom-ui.

tringler avatar tringler commented on August 28, 2024

Thanks. Solved! Sorry - It was not clear to me, that a wrong syntax somewhere in the configuration kills all other configuration items.

from home-assistant-custom-ui.

fanaticDavid avatar fanaticDavid commented on August 28, 2024

@tringler Sorry for posting an unrelated question here but what are the state-card-media_player.html and state-card-custom_alarm.html files you're using? I'm mainly wondering if the first brings back the old visual representation of media players, as shown below.

afbeelding

from home-assistant-custom-ui.

tringler avatar tringler commented on August 28, 2024

@fanaticDavid I added these months ago just to test some custom state cards like these.

from home-assistant-custom-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.