Comments (23)
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.
Applied that, but unfortunately no change in the behaviour.
from home-assistant-custom-ui.
In both group and binary sensor?
It should have eliminated at lest one of the javascript errors.
from home-assistant-custom-ui.
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:
from home-assistant-custom-ui.
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.
I updated to the last version and can confirm all javascript errors are gone.
from home-assistant-custom-ui.
What happens if you apply the 'yellow' theme to everything via ConfigurationPanel->General menu?
from home-assistant-custom-ui.
That is working.
from home-assistant-custom-ui.
Just making sure: Is the state of binary_sensor.climate_livingroom_windowshutter indeed 'on' in the dev-state panel?
from home-assistant-custom-ui.
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.
theme: yellow
and template: yellow
is working for sensor group and for binary_sensor.
from home-assistant-custom-ui.
What platform is that binary sensor?
from home-assistant-custom-ui.
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.
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.
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.
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.
@andrey-git Do you have a hint how I can get rid of that problem?
from home-assistant-custom-ui.
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.
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:
If I apply the theme manually it works:
I'm running HASS 0.58.1 + Custom UI 20171117 and I have no JS console errors.
from home-assistant-custom-ui.
You still have a few
theme_template:
which you need to replace with
templates:
theme:
from home-assistant-custom-ui.
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.
@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.
from home-assistant-custom-ui.
@fanaticDavid I added these months ago just to test some custom state cards like these.
from home-assistant-custom-ui.
Related Issues (20)
- Configuration tab on Homeassistant broken with 0.90.0 HOT 13
- HTML Imports is deprecated and will be removed in M73, around March 2019. Please use ES modules instead. HOT 1
- Custom-ui not working on HA 0.93.0 HOT 18
- Extra keys not allowed HOT 2
- Hass.io 0.96.3 : Cannot read property 'some' of undefined HOT 14
- UndefinedError: 'None' has no attribute 'state' hanging up server HOT 1
- Is the custom ui working with lovelace? HOT 6
- 0:0 Script error on HA 0.102.1 HOT 4
- Confusing docs, pls help. HOT 4
- http://192.168.200.235:8123/local/custom_ui/state-card-custom-ui.html:27:8908 Uncaught TypeError: e.push is not a function HOT 9
- input_datetime icon_color based on state HOT 1
- HA 0.108.1 HOT 28
- icon_color don‘t work anymore with ha 0.110 HOT 19
- HA 0.110.2: Extra badge does not show up HOT 16
- HA 0.110.2 - Icons are not being colorized HOT 3
- New custom-ui for HA 110+ HOT 1
- Customization is being ignored within paper-buttons-row HOT 7
- state-custom-ui is not loading/working on HA 0.115.x HOT 1
- What is it? Does it work with default “lovelace” dashboard ui?
- Error during setup HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from home-assistant-custom-ui.