Hallo,
Ich möchte bestimmte Befehle ausführen, wenn FTUI's index.html geöffnet ist.
Beispiel "get <device> state".
Es funktioniert nicht im Widget, sondern funktioniert, wenn direkt geschrieben, wenn funktioniert
Sei bitte ein bisschen genauer. Wenn eine FTUI html Seite geladen wird, werden alle Widgets aktualisiert. Abhängig von den "data-......" Definitionen. Wenn data-get nicht eingegeben wird, wird i.d.R. das "state" des Devices abgefragt.
Was willst Du genau machen, und wie würde deine html Seite aussehen?
<div class="inline" data-type="dimmer" data-device="Study" data-cmd="state" data-get="state" data-get-value="dimvalue" data-set-on="on" data-set-off="off" data-dim = "dimvalue" data-max="254" data-step="2" ></div>
<div class="inline" data-type="select" data-device="Study" data-items='["warm","cold","standard"]' data-set="color" ></div>
Und noch ein list von deinem Dimmer in code tags bitte
Genauere Antwort erst wenn Du ein list des Dimmers postest, aber ein paar Anmerkungen:
data-cmd: gibt es nicht für ein data-type dimmer sondern evtl. data-set-cmd
data-get: das Reading "state" ist nicht mit STATE zu vertauschen.
Halte deine Definition so kurz wie möglich: es hat kein Sinn eine data-xxxxxxxx zu definieren, wenn Du die Standart-Wert nutzt (z.B. data-get-on und data-get-off)
okay, aber die Problem ist so:
Wann ich zB. habe die Licht direkt geschaltet, und dann bei FHEM, wann ich schreibe "get Study state", und dann FHEM's dashboard oder the FTUI geoffnet, die State is richting.
Aber wann ich habe die Licht direkt geschaltet, und dann FHEM's dashboard oder FTUI geoffnet, die State ich falsch.
So ich mochtet, jedenmal wann FTUI's page is geoffnet, "get Study state" ist gesendet.
(Die andere option ist bei FHEM ich mache "set attr TV AutoUpdateInterval 1", aber das ist ein schlechter Hack.
Ich vermute ein longpoll Problem. Siehe hier: https://wiki.fhem.de/wiki/FHEM_Tablet_UI#Verbindung_zu_FHEM
Aber um das sicher zu stellen, poste mal bitte ein "list" von dem Dimmer (in FHEMWeb im Kommandofeld "list Study") und das Ergebnis hier in code tags (der # Knopf im Editieren Menü hieroben).
Mich interessieren auch die <meta> tags, die Du in index.html hast (wegen longpoll).
Ohne diese zusätzliche Informationen ist es schwierig zu helfen.
PS: if you prefer, we can do it in english.
Hello Amenomade, can you do it in English please? :)
Zitat von: amenomade am 31 Mai 2017, 14:05:17
Ich vermute ein longpoll Problem. Siehe hier: https://wiki.fhem.de/wiki/FHEM_Tablet_UI#Verbindung_zu_FHEM
Aber um das sicher zu stellen, poste mal bitte ein "list" von dem Dimmer (in FHEMWeb im Kommandofeld "list Study") und das Ergebnis hier in code tags (der # Knopf im Editieren Menü hieroben).
Mich interessieren auch die <meta> tags, die Du in index.html hast (wegen longpoll).
Ohne diese zusätzliche Informationen ist es schwierig zu helfen.
PS: if you prefer, we can do it in english.
I tried "list Study" and got:
Internals:
CHANGED
DEF 65537
IODev TradfriGW
NAME Study
NR 62
STATE off
TYPE TradfriDevice
deviceAddress 65537
name Study
Readings:
2017-05-30 20:04:49 color f1e0b5
2017-05-30 18:56:44 createdAt Sun, 30 Apr 2017 10:10:04 GMT
2017-05-31 11:04:52 dimvalue 101
2017-05-31 15:49:52 lastSeen Wed, 31 May 2017 15:35:34 GMT
2017-05-30 18:56:44 manufacturer IKEA of Sweden
2017-05-30 18:56:44 name Study
2017-05-30 18:56:44 reachableState 1
2017-05-30 18:56:44 softwareVersion 1.1.1.1-5.7.2.0
2017-05-31 10:57:55 state off
2017-05-30 18:56:44 type TRADFRI bulb E27 WS opal 980lm
Attributes:
autoUpdateInterval 900
icon light_ceiling_light
room LivingRoom
But if I type "get Study state", I get "on", if I repeat list:
Internals:
DEF 65537
IODev TradfriGW
NAME Study
NR 62
STATE on
TYPE TradfriDevice
deviceAddress 65537
name Study
Readings:
2017-05-30 20:04:49 color f1e0b5
2017-05-30 18:56:44 createdAt Sun, 30 Apr 2017 10:10:04 GMT
2017-05-31 11:04:52 dimvalue 101
2017-05-31 15:49:52 lastSeen Wed, 31 May 2017 15:35:34 GMT
2017-05-30 18:56:44 manufacturer IKEA of Sweden
2017-05-30 18:56:44 name Study
2017-05-30 18:56:44 reachableState 1
2017-05-30 18:56:44 softwareVersion 1.1.1.1-5.7.2.0
2017-05-31 17:45:26 state on
2017-05-30 18:56:44 type TRADFRI bulb E27 WS opal 980lm
Attributes:
autoUpdateInterval 900
icon light_ceiling_light
room LivingRoom
Also.. so wie es aussieht gibt es doch ein Problem mit dem Modul. Ich würde diese Ergebnisse im anderen Thread posten, wo nw. der Maintainer vom Modul Support anbieten sollte.
https://forum.fhem.de/index.php/topic,70653.0.html
It seems indeed to be be a problem in the module itself. I would post these results in the other thread, where the maintainer of the module should propose support for it.
Try perhaps nevertheless attr <FHEMWEBinstance> longpoll 1
Was already previously done based on the advice of module thread discussion... :(
It works if I set AutoUpdateInterval=1
Perhaps it's linked to the polling method which is used by the module. But I find it stange anyway. A good module should not poll, but react on events. I'm not a developer myself, and don't know how difficult it could be, but I'm only thinking about other modules and how they work
A polling each second could be somehow a bit overloading for fhem. If it works that way, then OK. But you should keep an eye on it.
I did not apply AutoUpdateInterval = 1.
It feels like a bruteforce hack.
I wanted to add "get Study state" as a command in FTUI's html, that way at least, a webpage refresh is always latest.
Hmm such a thing is not so easy. You could try to call (with javascript for example) the url http(s)://<fhemIP>:<fhemPort>/fhem?get%20Study%state