FHEM Forum

FHEM => Anfängerfragen => Thema gestartet von: PingPong am 20 Januar 2018, 07:46:06

Titel: (gelöst) state on statt dim...
Beitrag von: PingPong am 20 Januar 2018, 07:46:06
Hallo zusammen,

bräuchte mal wieder Eure Hilfe.
Habe ein Device, welchen den Status dimxx% ausgibt.
Jetzt würde ich diesen gerne umbiegen auf "on".

Internals:
   CHANGED   
   DEF        0E5C000000261884  IODev=OsramGateway
   ID         0E5C000000261884
   INTERVAL   
   IODev      OsramGateway
   NAME       LIGHTIFY0E5C000000261884
   NR         21
   STATE      dim06%
   TYPE       HUEDevice
   desired    1
   type       Color temperature tight
   uniqueid   0E5C000000261884
   READINGS:
     2018-01-20 07:44:48   bri             5
     2018-01-20 06:39:33   colormode       ct
     2018-01-20 06:39:33   ct              370 (2702K)
     2018-01-20 07:44:48   onoff           1
     2018-01-20 07:44:48   pct             2
     2018-01-20 06:39:33   reachable       1
     2018-01-20 06:39:33   rgb             ffc698
     2018-01-20 07:44:48   state           dim06%
   helper:
     alert     
     bri        5
     colormode  ct
     ct         370
     devtype   
     effect     
     hue        -1
     on         1
     pct        2
     reachable  1
     rgb        ffc698
     sat        -1
     transitiontime 0
     type       2
     update_timeout -1
     xy         
Attributes:
   IODev      OsramGateway
   Kellertreppe Kellertreppe
   alias      FlurUG_Treppe
   color-icons 2
   devStateIcon {(HUEDevice_devStateIcon($name),"toggle")}
   group      Beleuchtung
   icon       light_stairs
   room       09_Flur,91_LightifyDevices
   structure  alleLampen_innen
   webCmd     pct:on:off


Hintergrund ist, dass ich diesen gerne in einer structure nutzen möchte.
Habt Ihr nen Tipp für mich?

VG
Marc
Titel: Antw:state on statt dim...
Beitrag von: CoolTux am 20 Januar 2018, 07:56:51
Dafür gibt es das map Attribut
_map pct:^[1-9][0-9]{0,2}:on pct:^0$:off

Schau dir die Commandref zu structure an
Titel: Antw:state on statt dim...
Beitrag von: PingPong am 20 Januar 2018, 10:21:55
Danke für die schnelle Antwort...
Ja, das hatte ich auch schon gesehen.
Leider scheiter ich echt an der Transferleistung vom "pct" zu "dim" 🤔
Titel: Antw:state on statt dim...
Beitrag von: CoolTux am 20 Januar 2018, 10:43:35
Da musst Du nichts tranferieren
Titel: Antw:state on statt dim...
Beitrag von: PingPong am 20 Januar 2018, 10:54:33
hmmm... ok...
hatte ein Device übersehen... Jetzt bei allen exakt so gesetzt... und es klappt... auch wenn ich es noch nicht verstehe.
Trotzdem erstmal ganz lieben Dank für Deine Hilfe.
Titel: Antw:(gelöst) state on statt dim...
Beitrag von: binford6000 am 17 Februar 2018, 10:16:22
Zitatund es klappt... auch wenn ich es noch nicht verstehe.
Moin pingpong, ich bin auch gerade an dem Thema und bin auf diesen Thread gestoßen. Mit
onoff:[1]{1}:on onoff:[0]{1}:off
würde es (bei dir) auch funktonieren.

<struct_type>_map mappt ein Reading so, dass es structure als on/off versteht.
Im o.g. Fall also vom Reading "onoff" eine "1" für "on" und eine "0" für "off". Das Gleiche funktioiert wie bei cooltux auch mit dem pct Reading.
Hier wird aus dem Reading pct eine Zahl "1-999" als "on" und eine "0" als "off" an die structure übergeben.
VG Sebastian
Titel: Antw:(gelöst) state on statt dim...
Beitrag von: choetzu am 13 Januar 2019, 15:33:27
hmm, ich habe genau die selbe Situation, komme aber irgendwie nicht auf das gewünschte Resultat.....

ich habe 2 HUEDevices und ein Structure.

HUEDevice1
defmod HUEDevice1 HUEDevice 1  IODev=HUEBridge
attr HUEDevice1 userattr HUE HUE_map structexclude
attr HUEDevice1 HUE_map pct:^[1-9][0-9]{0,2}:on pct:^0$:off
attr HUEDevice1 IODev HUEBridge
attr HUEDevice1 alias Office
attr HUEDevice1 color-icons 2
attr HUEDevice1 devStateIcon on:ios_on_fill@blue off:ios_off_fill@gray
attr HUEDevice1 group Dimmer
attr HUEDevice1 icon light-bulb
attr HUEDevice1 model LCT015
attr HUEDevice1 room 03_Licht,HUEDevice
attr HUEDevice1 subType extcolordimmer
attr HUEDevice1 webCmd on:off:pct



Das selbe gilt für HUEDevice2.. Genau identisch.

Structure ist wie folgt:
defmod HUE_Structure structure HUE HUEDevice1 HUEDevice2
attr HUE_Structure clientstate_behavior relative
attr HUE_Structure clientstate_priority An|On|on Aus|Off|off


Irgendetwas übersehe ich... Komm aber nicht drauf...