Hi,
zur Steuerung meiner Klimaanlage nutze ich HTTPMOD.
define Klimaanlage HTTPMOD http://192.168.x.x/climate/midea_climate 10
attr Klimaanlage extractAllJSON 1
attr Klimaanlage set01Decode utf8
attr Klimaanlage set01Hint select,HEAT,COOL,HEAT_COOL,FAN_ONLY,DRY,OFF
attr Klimaanlage set01Method POST
attr Klimaanlage set01Name Modus
attr Klimaanlage set01TextArg 1
attr Klimaanlage set01URL http://192.168.x.x/climate/midea_climate/set?mode=$val
attr Klimaanlage showBody 1
attr Klimaanlage showError 1
attr Klimaanlage showMatched 1
attr Klimaanlage webCmd Modus
Die Anweisung lautet: "set Klimaanlage Modus DRY"
Welches Attribut muss ich für eine die vereinfachte Anweisung "set Klimaanlage trocknen" setzen?
Gruß Jens
ZitatWelches Attribut muss ich für eine die vereinfachte Anweisung "set Klimaanlage trocknen" setzen?
Hallo,
das Attribut eventMap ermöglicht sowas.
Zitat von: commandrefeventMap
Replace event names and set arguments. The value of this attribute consists of a list of space separated values, each value is a colon separated pair. The first part specifies the "old" value, the second the new/desired value. If the first character is slash(/) or comma(,) then split not by space but by this character, enabling to embed spaces. You can specify a widgetOverride after an additional colon (e.g. on-for-timer:OnFor:texField), the default widget is :noArg to avoid extra input fields in cmdList. Examples:
attr store eventMap on:open off:closed
attr store eventMap /on-for-timer 10:open/off:closed/
set store open
The explicit variant of this attribute has the following syntax:
attr store eventMap { dev=>{'on'=>'open'}, usr=>{'open'=>'on'} }
attr store eventMap { dev=>{'^on(-for-timer)?(.*)'=>'open$2'}, usr=>{'^open(.*)'=>'on$1'}, fw=>{'^open(.*)'=>'open'} }
This variant must be used, if the mapping is not symmetrical, the first part (dev) representing the device to user mapping, i.e. if the device reports on 100 or on-for-timer 100, the user will see open 100. The second part (usr) is the other direction, if the user specified open 10, the device will receive on 10. On both occasions the key will be first compared directly with the text, and if it is not equal, then it will be tried to match it as a regexp. When using regexps in the usr part with wildcards, the fw part must be filled with the exact same keys to enable a correct display in the FHEMWEB set dropdown list in the detail view.
Zitat von: ÜbersetzungWenn das erste Zeichen ein Schrägstrich (/) oder ein Komma (,) ist, wird die Aufteilung nicht durch ein Leerzeichen, sondern durch dieses Zeichen vorgenommen, sodass Leerzeichen eingebettet werden können.
Würde dann so aussehen bei dir:
attr Klimaanlage eventMap /Modus DRY:trocknen/
Gruß
Thomas
Zitat von: JensS am 29 August 2024, 20:10:41Die Anweisung lautet: "set Klimaanlage Modus DRY"
Welches Attribut muss ich für eine die vereinfachte Anweisung "set Klimaanlage trocknen" setzen?
eventMap ist schon ein guter Ansatz. Um "set Klimaanlage trocknen" verwenden zu können, würde ich sowas hier einbauen:
attr Klimaanlage eventMap { usr=>{'trocknen'=>'Modus DRY'} }
Der verwendete hash läßt sich natürlich auch seht einfach noch für andere Werte erweitern.
Wenn es darum geht, dass dann auch "trocknen" zur Auswahl im Frontend auswählbar angeboten wird, musst Du die entsprechenden Attribute für die Anzeige auch noch anpassen.
Vielen Dank @betateilchen und @TomLee,
{ usr=>{'trocknen'=>'Modus DRY','on'=>'Modus DRY','kühlen'=>'Modus COOL','heizen'=>'Modus HEAT','lüften'=>'Modus FAN_ONLY','off'=>'Modus OFF'} }
... macht genau das, was es soll.
Gruß Jens