Hello,
I would like to change the color of temperature value when heating status changes. I have problem to compare python value to True or False in HTML. How can I compare the value of python variable. If I put value 1 or 0 to variable instead of eka_ker_temp_ohjaus.arki_et.state it works. I have also checked that 'eka_ker_temp_ohjaus.arki_et.state' get values 1 and 0, but comparing doesn't work.
KNX.yaml:
HTML:
HTML:
I would like to change the color of temperature value when heating status changes. I have problem to compare python value to True or False in HTML. How can I compare the value of python variable. If I put value 1 or 0 to variable instead of eka_ker_temp_ohjaus.arki_et.state it works. I have also checked that 'eka_ker_temp_ohjaus.arki_et.state' get values 1 and 0, but comparing doesn't work.
KNX.yaml:
Code:
eka_ker_temp_ohjaus:
et:
state:
type: bool
knx_dpt: 1
knx_cache: 11/2/1
Code:
{{ ov.float ('eka_ker_temp_ohjaus.arki_et.temperature1', 'Arkieteinen lämpötila', '71%', '35%', 'arki_et_popup', 'eka_ker_temp_ohjaus.arki_et.temperature', '°', 1, [MARKIEREN]'eka_ker_temp_ohjaus.arki_et.state'[/MARKIEREN]) }}
Code:
/**
* Float: Displays a value as float
*
* @param unique id for this widget
* @param popup-info of the float value (optional)
* @param icon position from left side
* @param icon position from top side
* @param unique id for the popup
* @param a gad/item
* @param a unit, tries to get the format for that unit from the language-file (optional)
* @param hide on mobile displays (optional value 1)
* @param item_state changes color of float
*/
{% macro float (id, info, left, top, id_popup, gad, unit, hide, [MARKIEREN]item_state[/MARKIEREN]) %}
<a id="{{ uid(page, id) }}-overview" {% if info %}title="{{ info }}"{% endif %}
{% if hide %}class="hide-mobile"{% endif %}
{% if id_popup %}data-rel="popup" href="#{{ uid(page, id_popup) }}" {% endif %}
style="display: block; position: absolute; top: {{ top }}; left: {{ left }}; text-align: center;[MARKIEREN]{% if item_state == 1 %} color:red {% endif %};[/MARKIEREN]"
<span id="{{ uid(page, id) }}" data-widget="basic.float" data-item="{{ gad }}" data-unit="{{ unit }}">-.- {{ unit }}</span>
</a>
<script type="text/javascript">
$(document).on("pageshow",function() {
$("#{{ uid(page, id) }}-overview").css("margin-top", Math.round($("#{{ uid(page, id) }}-overview").height() / 2) * -1);
$("#{{ uid(page, id) }}-overview").css("margin-left", Math.round($("#{{ uid(page, id) }}-overview").width() / 2) * -1);
});
</script>
{% endmacro %}


Kommentar