All png are in www folder
Custom UI is in www/custom_ui folder
state.attributes.heatLevel exist and show value from 0 to 100 %
I suspect that I don’t write my template correctly. Could someone help me with the correct syntax ? Thank you
I thank you for this reply. I’ve tried it and it didn’t work. no change in my climate card. The icon is still the original one. worst I get flooded by Service “system_log/write” called. sending a strange big log message 12 pages long every 30 second:
data:text/javascript;charset=utf-8,%2F*!%20For%20license%20information%20please%20see%20scripts.js.LICENSE%20*%2F%0A!function(t)%7Bvar%20e%3D%7B%7D%3Bfunction%20i(s)%7Bif(e%5Bs%5D)return%20e%5Bs%5D.
…12 pages…
local%2Fcustom_ui%2Fstate-card-custom-ui.html.js%0A line 27 > Function:0:0 Script error.
kind of dump screen error
Hi. I confirm that it dump the file state-card-custom-ui.html every 30 seconds
I’m on CustomUI: 20190113 HA 0.86.4
lines that cause problem in customize.yaml:
climate.sinope_climate_cave:
templates:
entity_picture: >
if (state.attributes.heatLevel < 1) return '/local/heat-0.png';
if (state.attributes.heatLevel < 21) return '/local/heat-1.png';
if (state.attributes.heatLevel < 41) return '/local/heat-2.png';
if (state.attributes.heatLevel < 61) return '/local/heat-3.png';
if (state.attributes.heatLevel < 81) return '/local/heat-4.png';
return '/local/heat-5.png';
I’m using Sinope thermostat and made a custom component for them as they are not supported yet in HA. You can find my code on my Git:[claudegel/sinope-1](https://github.com/claudegel/sinope-1)
for the second line it’s showing actual temperature:
@property
def current_temperature(self):
"""Return the current temperature."""
return self._cur_temp
in the update self._cur_temp = float(self.sinope_data.data[self.device_id]["data"]["temperature"])
I don’t have this card at all nor the thermostat, but that shouldn’t matter, Im simply trying to understand how to get an attributes on the second line below the state, as you do.
must be the code in the python sensor declaration somehow. But I can’t find it in you CC.
for comparisons sake:
I use this very simple python script to create sensors, and set its attributes. Would you know how to expand this and have it show the second line below the state:
##########################################################################################
entity_id = data.get('entity_id')
if not entity_id:
logger.error('No entity_id provided')
state = data.get('state')
if not state:
logger.error('No state provided')
if entity_id and state:
# old_state = hass.states.get(entity_id)
# if old_state:
# attrs = old_state.attributes
# else:
# attrs = None
theme = 'red' if state == 'on' else 'green'
friendlyName = entity_id.split('.')[1].title().replace('_',' ')
hass.states.set(entity_id, state,{
'custom_ui_state_card': 'state-card-custom-ui',
'friendly_name': friendlyName,
'device_class': 'problem',
'theme': theme,
'show_last_changed': 'true'
})
The code to print the second line is in the climate component not in my custom component. I just set the value for current_temperature and the second line is printed. If I don’t provide value for current_temperature nothing is printed on second line.
maybe @pnbruckner would know how to, based on the above? Show an attribute of an entity on the second line under the state as shown inpost 25 of this thread
can’t do that with custom-ui, and supposedly is in the components code.
thanks for having a look if you would.
Hi folks!
Can we somehow use this templating/scripting inside LovelaceUI?
In my floor plan I have entity of type image representing my TV. I have made custom ambilight behind my tv, and I want to apply a filter of the tv image like: “filter: drop-shadow(0px 0px 10px rgb( >> put somehow the rgb value from ambilight << ))”.
How can I achieve this?
Soo, in installed the custom-ui files in www, added the custom_component, registered in configuration.yaml and edited my customize.yaml file like this: