Hauptmenü

State formatieren

Begonnen von gloob, 27 Juni 2016, 20:05:07

Vorheriges Thema - Nächstes Thema

gloob

Hallo,

Ich habe ein paar Lampen die als State "On" und "Off" haben. Jedoch benötige ich "on" und "off" klein geschrieben. Gibt es eine Möglichkeit, dass ganze über stateFormat zu formatieren?
Raspberry Pi 3 | miniCUL 433MHz | nanoCUL 868 MHz | nanoCUL 433 MHz | MySensors WLAN Gateway | LaCrosse WLAN Gateway | SignalESP 433 MHz | SignalESP 868 MHz | HM-MOD-UART WLAN Gateway | IR - 360 Grad WLAN Gateway

Ellert

Ja, z.B. mit {ReadingsVal($name,"state","<default>") eq "On" ? "on" : "off"} , ungetestet.

automatisierer

oder dem Attribut:
attr <device> eventMap On:on Off:off

dann kannst du auch on und off auch im set Befehl nutzen

marvin78

Meinst du das Internal STATE oder das Reading state?

gloob

Ich meine das Reading "state"
Raspberry Pi 3 | miniCUL 433MHz | nanoCUL 868 MHz | nanoCUL 433 MHz | MySensors WLAN Gateway | LaCrosse WLAN Gateway | SignalESP 433 MHz | SignalESP 868 MHz | HM-MOD-UART WLAN Gateway | IR - 360 Grad WLAN Gateway

marvin78

stateFormat zielt auf STATE (Anzeige in FHEMWEB). Wenn du sagst, wofür genau du das benötigst, kann ich dir sagen, ob eventMap das richtige für dich ist. Oder probiere die Varianten einfach aus.

gloob

#6
Ich habe ein MQTT Device welches als "state" "On" und "Off" liefert.
Ich möchte jedoch gerne "on" und "off" verwenden, damit eine Glühbirne als StateIcon angezeigt wird.
Zusätzlich möchte ich die Devices in eine Structure zusammenfassen und ebenfalls die Glühbirne als StateIcon haben.

Das MQTT Device sieht im Moment so aus:
Internals:
   IODev      mqtt
   NAME       sonoff1
   NR         529
   STATE      On
   TYPE       MQTT_DEVICE
   qos        0
   retain     1
   Readings:
     2016-06-27 20:56:52   state           On
     2016-06-27 21:01:03   transmission-state subscription acknowledged
   Message_ids:
   Publishsets:
     :
       topic      cmnd/sonoff1/power
       values:
         on
         off
   Sets:
     off
     on
   subscribe:
     stat/sonoff1/POWER
   subscribeExpr:
     ^stat\/sonoff1\/POWER$
   Subscribereadings:
     stat/sonoff1/POWER state
Attributes:
   IODev      mqtt
   alias      Good Karma
   devStateIcon On:on:off Off:off:on
   fhem_widget_command {"allowed_values":["off","on"]}
   group      Lampen
   publishSet on off cmnd/sonoff1/power
   qos        at-most-once
   retain     1
   room       MQTT,Wohnzimmer
   stateFormat state
   subscribeReading_state stat/sonoff1/POWER
   userattr   room_map structexclude


und meine Structure so:

Internals:
   ATTR       room
   DEF        room sonoff0 sonoff1
   NAME       Switch_Licht
   NR         194
   NTFY_ORDER 50-Switch_Licht
   STATE      on
   TYPE       structure
   Content:
     sonoff0    On
     sonoff1    On
   Readings:
     2016-06-27 21:01:03   LastDevice      sonoff1
     2016-06-27 21:01:03   LastDevice_Abs  sonoff1
     2016-06-27 21:01:03   state           On
Attributes:
   alias      Alle Lampen
   clientstate_behavior relative
   clientstate_priority On Off
   fhem_widget_command {"allowed_values":["off","on"]}
   group      Steckdosen
   room       CUL,Wohnzimmer
   
Raspberry Pi 3 | miniCUL 433MHz | nanoCUL 868 MHz | nanoCUL 433 MHz | MySensors WLAN Gateway | LaCrosse WLAN Gateway | SignalESP 433 MHz | SignalESP 868 MHz | HM-MOD-UART WLAN Gateway | IR - 360 Grad WLAN Gateway

marvin78

Wenn es nur im das Icon geht, kannst du das natürlich auch mit devStateIcon machen. Andernfalls eben eventMap, wie vorgeschlagen.