Autor Thema: Werte für die verschiedenen Widgets seperat übernehmen  (Gelesen 163 mal)

Offline Rompe

  • New Member
  • *
  • Beiträge: 5
Huhu Leute.

Da ich mit dem Problem, dass die .js Datei nicht übernommen wird, leider nicht weitergekommen bin, versuche ich nun, die SOLL-Temperatur an die Thermostate auf anderen Wegen zu übermitteln. Mein Gedanke war nun, dass ich aus dem jeweiligen Widget der verschiedenen Heizkörper ein PopUp aufrufe, wo ich dann die Wunschtemperatur anklicken kann. Das funktioniert soweit auch und der angeklickte Wert wird an FHEM übermittelt, doch leider werden alle Werte immer nur an das erste Gerät gesendet. D.h. wenn ich das PopUp für den Flur aufrufe und die Temperatur anklicke, wird der Wert nicht für den Flur, sondern für das Wohnzimmer übernommen. Wie kann man das umgehen? Bin für jede Hilfe dankbar.


widget_homematic.html
/**
* Homematic HM-TC Wandthermostat und HM-CC Heizkörperventil
*
* @param unique id for this widget
* @param Text for display in the middle of the widget (i use "mode")
* @param gad_actual a gad/item for the actual temperature
* @param gad_set a gad/item for the set temperature
* @param gad_controlmode a gad/item for setting auto / manual
* @param gad_daytemp a gad/item for daytemp reading (currently unused)
* @param gad_nighttemp a gad/item for nighttemp reading (currently unused)
* @param gad_window a gad/item for an external window open sensor (additionally paired to the HM-TC for automation)
* @param gad_battery a gad/item for battery level of "mother"-device
* @param gad_state a gad/item for the current state of the actor (if paired to a switch for floor heating)
* @param gad_text a gad/item for a text (i use it for the boost-time reading), (optional)
* @param step for plus/minus buttons (optional, default 0.5)
* @param gad_valve for HM-CC RT valve position (optional, use only for CC-RT)
* @param gad_humidity for HM-TC humidity Sensor (optional, use only for TC)
*/
{% macro hmtc(id, txt, gad_actual, gad_set, gad_controlmode, gad_daytemp, gad_nighttemp, gad_window, gad_battery, gad_state, gad_txt, step, gad_valve, gad_humidity) %}
{% import "basic.html" as basic %}
{% import "icon.html" as icon %}
<div id="{{ uid(page, id) }}" data-widget="device.rtr" data-step="{{ step|default(0.5) }}"
class="rtr">
<div class="actual">
<div class="temp">
{{ basic.symbol(id~'windowopen', gad_window, '', icon1~'fts_window_2w_open.png','open') }}
{{ basic.symbol(id~'windowclose', gad_window, '', icon0~'fts_window_2w.png','closed') }}
&nbsp;{{ basic.float(id~'actual', gad_actual, '°' ) }}
<!-- {{ icon.battery(id~'battery', '', gad_battery, '2.2', '3') }}
--> </div>

{% if gad_humidity %}<div style="font-size:0.8em">Luftfeuchte:&nbsp;{{ basic.value(id~'humidity', gad_humidity) }}%</div>{% endif %}
{% if gad_valve %}<div style="font-size:0.8em">Ventil:&nbsp;{{ basic.value(id~'valve', gad_valve) }}%</div>{% endif %}

<div class="text">
Status: {{ basic.value(id~'controlmode', gad_controlmode) }}
</div>

<div class="text">
Batterie: {% if gad_txt %} {{ basic.value(id~'txt', gad_txt) }} {% endif %}
</div>
</div>

{% if gad_set %}
<div class="set">
<a href="#popup3" data-rel="popup">
<img class="icon" src="{{ icon1~'edit_settings.png' }}">
</a>

<div id="popup3" data-role="popup" style="width:300px; height:250px;">
<a href="#" data-rel="back" data-role="button" data-icon="delete" data-iconpos="notext" class="ui-btn-right">Close</a>
<table align="center" cellpadding="0">
<tr>
<td>{{ basic.button(id~'set', gad_set, '15,0', pic, '15.0', 'mini') }}</td>
<td>{{ basic.button(id~'set', gad_set, '15,5', pic, '15.5', 'mini') }}</td>
<td>{{ basic.button(id~'set', gad_set, '16,0', pic, '16.0', 'mini') }}</td>
<td>{{ basic.button(id~'set', gad_set, '16,5', pic, '16.5', 'mini') }}</td>
<td>{{ basic.button(id~'set', gad_set, '17,0', pic, '17.0', 'mini') }}</td>
<td>{{ basic.button(id~'set', gad_set, '17,5', pic, '17.5', 'mini') }}</td>
</tr>
<tr>
<td>{{ basic.button(id~'set', gad_set, '18,0', pic, '18.0', 'mini') }}</td>
<td>{{ basic.button(id~'set', gad_set, '18,5', pic, '18.5', 'mini') }}</td>
<td>{{ basic.button(id~'set', gad_set, '19,0', pic, '19.0', 'mini') }}</td>
<td>{{ basic.button(id~'set', gad_set, '19,5', pic, '19.5', 'mini') }}</td>
<td>{{ basic.button(id~'set', gad_set, '20,0', pic, '20.0', 'mini') }}</td>
<td>{{ basic.button(id~'set', gad_set, '20,5', pic, '20.5', 'mini') }}</td>
</tr>
<tr>
<td>{{ basic.button(id~'set', gad_set, '21,0', pic, '21.0', 'mini') }}</td>
<td>{{ basic.button(id~'set', gad_set, '21,5', pic, '21.5', 'mini') }}</td>
<td>{{ basic.button(id~'set', gad_set, '22,0', pic, '22.0', 'mini') }}</td>
<td>{{ basic.button(id~'set', gad_set, '22,5', pic, '22.5', 'mini') }}</td>
<td>{{ basic.button(id~'set', gad_set, '23,0', pic, '23.0', 'mini') }}</td>
<td>{{ basic.button(id~'set', gad_set, '23,5', pic, '23.5', 'mini') }}</td>
</tr>
<tr>
<td>{{ basic.button(id~'set', gad_set, '24,0', pic, '24.0', 'mini') }}</td>
<td>{{ basic.button(id~'set', gad_set, '24,5', pic, '24.5', 'mini') }}</td>
<td>{{ basic.button(id~'set', gad_set, '25,0', pic, '25.0', 'mini') }}</td>
<td>{{ basic.button(id~'set', gad_set, '25,5', pic, '25.5', 'mini') }}</td>
<td>{{ basic.button(id~'set', gad_set, '26,0', pic, '26.0', 'mini') }}</td>
<td>{{ basic.button(id~'set', gad_set, '26,5', pic, '26.5', 'mini') }}</td>
</tr>
<tr>
<td>{{ basic.button(id~'set', gad_set, '27,0', pic, '27.0', 'mini') }}</td>
<td>{{ basic.button(id~'set', gad_set, '27,5', pic, '27.5', 'mini') }}</td>
<td>{{ basic.button(id~'set', gad_set, '28,0', pic, '28.0', 'mini') }}</td>
<td>{{ basic.button(id~'set', gad_set, '28,5', pic, '28.5', 'mini') }}</td>
<td>{{ basic.button(id~'set', gad_set, '29,0', pic, '29.0', 'mini') }}</td>
<td>{{ basic.button(id~'set', gad_set, '29,5', pic, '29.5', 'mini') }}</td>
</tr>
</table>
</div>
<div class="temp">{{ basic.float(id~'set', gad_set, '°' ) }}</div>
</div>
{% endif %}

<div class="control" style="width: 250px;">
<table align="center" cellpadding="0">
<tr>
<td>{{ basic.switch(id~'manauto', gad_controlmode, icon1~'sani_heating_automatic.png', icon0~'sani_heating_manual.png', 'auto', 'manual') }}</td>
<td>{{ basic.switch(id~'boost', gad_controlmode, icon1~'sani_heating_boost.png', icon0~'sani_heating_boost.png', 'boost', 'auto') }}</td>
<td>{{ basic.switch(id~'night', gad_set, icon1~'scene_night.png', icon0~'scene_night.png', '17', '21') }}</td>
<td>{{ basic.switch(id~'day', gad_set, icon1~'scene_day.png', icon0~'scene_day.png', '21', '17') }}</td>
{% if gad_state %}<td>{{ basic.switch(id~'state', gad_state, icon1~'sani_heating.png', icon0~'sani_heating.png') }}</td>{% endif %}
</tr>
</table>
</div>
</div>
{% endmacro %}

raum_heizung.html
/**
* -----------------------------------------------------------------------------
* @package     smartVISU
* @author      Martin Gleiß
* @copyright   2012
* @license     GPL [http://www.gnu.de]
* -----------------------------------------------------------------------------
*/


{% extends "rooms.html" %}

{% block content %}



<h3><img class="icon" src='{{ icon0 }}sani_heating.png' />H e i z u n g s s t e u e r u n g</h3>


<div class="block">
<div class="set-2" data-role="collapsible-set" data-theme="c" data-content-theme="a" data-mini="true">
<div data-role="collapsible" data-collapsed="false">
<h3>Wohnzimmer</h3>
{% import "widget_homematic.html" as homematic %}
{{ homematic.hmtc('Wohn_Heizung', 'Wohnzimmer', 'wohn_actual', 'wohn_set', 'wohn_controlmode', '',
  '', 'wohn_window', '', '', 'wohn_txt', '', 'wohn_valve',
  '', 'show_auto_man','', '') }}
</div>
</div>
</div>

<div class="block">
<div class="set-2" data-role="collapsible-set" data-theme="c" data-content-theme="a" data-mini="true">
<div data-role="collapsible" data-collapsed="false">
<h3>Flur</h3>
{% import "widget_homematic.html" as homematic %}
{{ homematic.hmtc('Flur_Heizung', 'Flur', 'flur_actual', 'flur_set', 'flur_controlmode', '',
  '', 'flur_window', '', '', 'flur_txt', '', 'flur_valve',
  '', 'show_auto_man','', '') }}
</div>
</div>
</div>

<div class="block">
<div class="set-2" data-role="collapsible-set" data-theme="c" data-content-theme="a" data-mini="true">
<div data-role="collapsible" data-collapsed="false">
<h3>Schlafzimmer</h3>
{% import "widget_homematic.html" as homematic %}
{{ homematic.hmtc('Schlaf_Heizung', 'Schlafzimmer', 'schlaf_actual', 'schlaf_set', 'schlaf_controlmode', '',
  '', 'schlaf_window', '', '', 'schlaf_txt', '', 'schlaf_valve',
  '', 'show_auto_man','', '') }}
</div>
</div>
</div>

<div class="block">
<div class="set-2" data-role="collapsible-set" data-theme="c" data-content-theme="a" data-mini="true">
<div data-role="collapsible" data-collapsed="false">
<h3>Kinderzimmer</h3>
{% import "widget_homematic.html" as homematic %}
{{ homematic.hmtc('Kinder_Heizung', 'Kinderzimmer', 'kinder_actual', 'kinder_set', 'kinder_controlmode', '',
  '', 'kinder_window', '', '', 'kinder_txt', '', 'kinder_valve',
  '', 'show_auto_man','', '') }}
</div>
</div>
</div>

<div class="block">
<div class="set-2" data-role="collapsible-set" data-theme="c" data-content-theme="a" data-mini="true">
<div data-role="collapsible" data-collapsed="false">
<h3>Badezimmer</h3>
{% import "widget_homematic.html" as homematic %}
{{ homematic.hmtc('Bade_Heizung', 'Badezimmer', 'bade_actual', 'bade_set', 'bade_controlmode', '',
  '', 'bade_window', '', '', 'bade_txt', '', 'bade_valve',
  '', 'show_auto_man','', '') }}
</div>
</div>
</div>

<div class="block">
<div class="set-2" data-role="collapsible-set" data-theme="c" data-content-theme="a" data-mini="true">
<div data-role="collapsible" data-collapsed="false">
<h3>Gästezimmer</h3>
{% import "widget_homematic.html" as homematic %}
{{ homematic.hmtc('Gaeste_Heizung', 'Gaestezimmer', 'gaeste_actual', 'gaeste_set', 'gaeste_controlmode', '',
  '', 'gaeste_window', '', '', 'gaeste_txt', '', 'gaeste_valve',
  '', 'show_auto_man','', '') }}
</div>
</div>
</div>
{% endblock %}

Offline smai

  • New Member
  • *
  • Beiträge: 27
  • Maintainer of smartVISU
    • smartVISU auf GitHub
Antw:Werte für die verschiedenen Widgets seperat übernehmen
« Antwort #1 am: 30 Juli 2017, 08:13:26 »
Dein Popup hat fix die id 'popup3', damit öffnet sich immer dasselbe Fenster.
Mach daraus <div id="{{ id }}popup" und <a href="#{{ id }}popup"

Die Buttons innerhalb eines Widgets haben ebenfalls alle dieselbe id. Diese kannst du z.B. folgendermassen schreiben:
<td>{{ basic.button(id~'set150', gad_set, '15,0', pic, '15.0', 'mini') }}</td>
<td>{{ basic.button(id~'set155', gad_set, '15,5', pic, '15.5', 'mini') }}</td>
...
Gefällt mir Gefällt mir x 1 Liste anzeigen

Offline Rompe

  • New Member
  • *
  • Beiträge: 5
Antw:Werte für die verschiedenen Widgets seperat übernehmen
« Antwort #2 am: 30 Juli 2017, 10:37:29 »
Guten Morgen smai.

Super, vielen Dank. Klappt einwandfrei. Das Leben kann so einfach sein ;P


MfG,
Tobi