[GELÖST] Daikin Klimaanlage

Begonnen von gamauf, 26 November 2015, 17:07:15

Vorheriges Thema - Nächstes Thema

rubinho

Servus Leute,

nachdem ich meine Daikin am Wochenende zum ersten Mal für dieses Jahr wieder in Betrieb nahm, funktionierte die Steuerung auch nicht mehr!

Im vorigen Jahr lief noch alles Problemlos.

Um herauszufinden was das Problem ist, musste ich einen Tcpdump machen.

Folgendes habe ich dabei gerausgefunden...

Wenn man unter Fhem die Klimaanlage einschalten will, geht das ja über den Power Befehl.
Dieser ist in den Attributen folgendermaßen definiert...

set01Data pow=$val&mode={{mode}}&stemp={{stemp}}&shum=0&f_rate={{f_rate}}&f_dir={{f_dir}}

Mittels Tcpdump konnte ich nun herausfinden, dass die Variablen {{mode}}, {{stemp}}, {{f_rate}} und {{f_dir}} nicht ausgewertet werden und genau wie sie hier stehen übermittelt werden.
Damit kann die Rest-Api von Daikin aber nichts anfangen und verwirft den Befehl.

Ich vermute irgendein Update in den Letzten Monaten hat die Syntax bei HTTPmod geändert.

Als Workaround kann man feste Werte eintragen, dann geht die Anlage wenigstens an, wenn auch immer mit der gleichen Einstellung.

Um das Problem dauerhaft zu lösen, müsste ein HTTPMod Spezi mal draufschauen und die Syntax anpassen.

Gruß
Rubinho
Fhem 5.9@Zotac Zbox Ci327 | HMCCU | Z-Wave@ZMEEUZB1 | HUE Bridge Gen2 | knxd over IP

roelb

#16
There are two issues, not just the one you are mentioning.

Issue 1: the use of double curly braces ({{varname}})  breaks because unescaped usage of a left curly brace in a perl regex has been deprecated since 5.22 and support has been discontinued as of 5.26. This is easily fixed by either escaping the left braces or by using a different marker:

attr <name> replacement01Regex #([^#]+)#
attr <name> set01Data pow=$val&mode=#mode#&stemp=#stemp#&shum=0&f_rate=#f_rate#&f_dir=#f_dir#


or

attr <name> replacement01Regex \{\{([^}]+)}}
attr <name> set01Data pow=$val&mode={{mode}}&stemp={{stemp}}&shum=0&f_rate={{f_rate}}&f_dir={{f_dir}}



See: https://metacpan.org/pod/release/RJBS/perl-5.22.0/pod/perldelta.pod#A-literal-%22{%22-should-now-be-escaped-in-a-pattern

Issue 2:

HTTPMOD does a POST request, sending the parameters as application/x-www-form-urlencoded. My Daikin does not accept that, it will only respond correctly to a HTTP GET request. A transcript:

POST /aircon/set_control_info?HTTP/1.0
Host: 10.0.1.105
User-Agent: fhem
Accept-Encoding: gzip,deflate
Content-Length: 47
Content-Type: application/x-www-form-urlencoded

pow=0&mode=3&stemp=18.0&shum=0&f_rate=B&f_dir=3

-- response

HTTP/1.0 200 OK
Content-Length: 12
Content-Type: text/plain

ret=PARAM NG


Looking in the code, this is caused by logic in the FHEM/HttpUtils.pm library. On lines 536 and 537:

my $method = $hash->{method};
$method = ($data ? "POST" : "GET") if( !$method );


But even changing this default won't matter, as everything passed in $data will only get sent in a POST request, never in a get (see lines 559-563). The optimal solution would be to modify HttpUtils.pm to automatically add the data supplied in $data as URL encoded GET parameters if the request type is GET, and modify HTTPMOD, adding a parameter to specify wether POST or GET should be used.

But there is a simpler solution. Looking through the code for HTTPMOD, we can use a seperate URL for each setXX action, instead of using the generic setURL attribute in combination with setXXData attributes. Instead, we simply specify setXXURL for each action and forget the setXXData. So, instead of using:


attr <name> set01Data pow=$val&mode=#mode#&stemp=#stemp#&shum=0&f_rate=#f_rate#&f_dir=#f_dir#
attr <name> setURL http://<ip>/aircon/set_control_info?


We need to use:



deleteattr <name> setURL
deleteattr <name> set01Data
attr <name> set01URL http://<ip>/aircon/set_control_info?pow=$val&mode=#mode#&stemp=#stemp#&shum=0&f_rate=#f_rate#&f_dir=#f_dir#


Finally, looking through the (pretty messy) code, I did find a bug in HttpUtils, which will always send the Content-Length and Content-Type: application/x-www-form-urlencoded headers, even if there is no data. A check is done if $data is defined, but not if it actually contains data (an empty string is also a defined variable in Perl)

line 559 of HttpUtils.pm is:


if(defined($data)) {


changing this to:


if(defined($data) && length($data)) {


will solve this issue and yield correct behaviour when $data is defined, but empty.

Taslow

Wenn ich das richtig nachvollzogen habe, wurden die Anregungen von roelb sowohl in der Beispielkonfiguration als auch in der HttpUtils.pm aufgenommen.

Irgendwie klappt es aber bei mir dennoch nicht. Werte der Klima werden erhoben und angezeigt, einschalten lässt sie sich aber nach wie vor nicht  :-\

hugomckinley

#18
Ich habe bereits herausgefunden, dass es anscheinend daran liegt, dass die B-Typen (BRP069B41) anders angesteuert werden müssen als die A-Typen(BRP069A41)
siehe: https://github.com/Apollon77/daikin-controller/issues/7

Lösung habe ich noch keine.

Gruß Hugo

Nachtrag: Lösung fast fertig. Folgt in den nächsten Tagen als Script welches die AC automatisch anlegt.
----------------------------------------------------
FHEM in TrueNAS-Jail
HMLGW + HM-Komponenten, alexa-fhem, Modbus/TCP, Modbus/RS485, LG-WebOS, Firmata, 1wire, ESP-RGBWW, DaikinAC per WLAN, Shellys, Denon AVR, Fronius WR, Helios Wohnraumlüftung, ...

Taslow

Zitat von: hugomckinley am 11 Juli 2019, 23:18:53
Nachtrag: Lösung fast fertig. Folgt in den nächsten Tagen als Script welches die AC automatisch anlegt.

Hallo Hugo,
konntest Du die Lösung schon fertigstellen? Wäre super, wenn die Daikin sich endlich auch bei mir steuern lassen würde :)

Gruß

smoudo

Moin,

ich wollte die Klimasteuerung mal um die Lüfterstufeneinstellung erweitern. soweit so gut. Allerdings wird die Stufe A=Auto und B=silent nicht gesetzt. Von 3-7 funktioniert das ganze schonmal. Fehler: set value A is not numeric. Irgendwie stehe ich da gerade auf dem Schlauch. Vielleicht hat jemand eine idee.

Grüße

Matze

define c_Klimaanlage HTTPMOD http://192.168.1.201/aircon/get_control_info 60
attr c_Klimaanlage userattr reading10Name reading10Regex reading11Name reading11OMap reading11Regex reading12Name reading12OMap reading12Regex reading13Name reading13Regex reading14Name reading14Regex reading15Name reading15Regex reading16Name reading16Regex reading17Name reading17Regex reading18Name reading18Regex reading19Name reading19Regex reading20Name reading20Regex reading21Name reading21Regex reading22Name reading22Regex reading23Name reading23Regex reading24Name reading24Regex reading25Name reading25Regex reading26Name reading26Regex reading27Name reading27Regex reading28Name reading28Regex reading29Name reading29Regex reading30Name reading30Regex reading31Name reading31Regex reading32Name reading32Regex reading33Name reading33OMap reading33Regex reading34Name reading34OMap reading34Regex reading35Name reading35OMap reading35Regex reading36Name reading36OMap reading36Regex reading37Name reading37Regex reading38Name reading38Regex reading39Name reading39Regex reading40Name reading40Regex reading41Name reading41Regex reading42Name reading42Regex reading43Name reading43Regex reading44Name reading44Regex reading45Name reading45Regex reading46Name reading46Regex reading47Name reading47Regex reading48Name reading48Regex reading49Name reading49Regex reading50Name reading50Regex reading51Name reading51Regex reading52Name reading52Regex replacement01Mode:reading,internal,text,expression,key replacement01Regex replacement01Value set01Data set01Hint set01Max set01Min set01Name set03Data set03Hint set03Max set03Min set03Name set03URL set04Data set04Hint set04Max set04Min set04Name setURL
attr c_Klimaanlage alias Klimaanlage
attr c_Klimaanlage devStateIcon off.*:frost@grey:on on.*:frost@blue:off
attr c_Klimaanlage enableControlSet 1
attr c_Klimaanlage group Klimaanlage
attr c_Klimaanlage icon frost
attr c_Klimaanlage reading10Name ret
attr c_Klimaanlage reading10Regex ret=([^,]*)
attr c_Klimaanlage reading11Name pow
attr c_Klimaanlage reading11Regex pow=([^,]*)
attr c_Klimaanlage reading12Name mode
attr c_Klimaanlage reading12Regex mode=([^,]*)
attr c_Klimaanlage reading13Name adv
attr c_Klimaanlage reading13Regex adv=([^,]*)
attr c_Klimaanlage reading14Name stemp
attr c_Klimaanlage reading14Regex stemp=([^,]*)
attr c_Klimaanlage reading15Name shum
attr c_Klimaanlage reading15Regex shum=([^,]*)
attr c_Klimaanlage reading16Name dt1
attr c_Klimaanlage reading16Regex dt1=([^,]*)
attr c_Klimaanlage reading17Name dt2
attr c_Klimaanlage reading17Regex dt2=([^,]*)
attr c_Klimaanlage reading18Name dt3
attr c_Klimaanlage reading18Regex dt3=([^,]*)
attr c_Klimaanlage reading19Name dt4
attr c_Klimaanlage reading19Regex dt4=([^,]*)
attr c_Klimaanlage reading20Name dt5
attr c_Klimaanlage reading20Regex dt5=([^,]*)
attr c_Klimaanlage reading21Name dt7
attr c_Klimaanlage reading21Regex dt7=([^,]*)
attr c_Klimaanlage reading22Name dh1
attr c_Klimaanlage reading22Regex dh1=([^,]*)
attr c_Klimaanlage reading23Name dh2
attr c_Klimaanlage reading23Regex dh2=([^,]*)
attr c_Klimaanlage reading24Name dh3
attr c_Klimaanlage reading24Regex dh3=([^,]*)
attr c_Klimaanlage reading25Name dh4
attr c_Klimaanlage reading25Regex dh4=([^,]*)
attr c_Klimaanlage reading26Name dh5
attr c_Klimaanlage reading26Regex dh5=([^,]*)
attr c_Klimaanlage reading27Name dh7
attr c_Klimaanlage reading27Regex dh7=([^,]*)
attr c_Klimaanlage reading28Name dhh
attr c_Klimaanlage reading28Regex dhh=([^,]*)
attr c_Klimaanlage reading29Name b_mode
attr c_Klimaanlage reading29Regex b_mode=([^,]*)
attr c_Klimaanlage reading30Name b_stemp
attr c_Klimaanlage reading30Regex b_stemp=([^,]*)
attr c_Klimaanlage reading31Name b_shum
attr c_Klimaanlage reading31Regex b_shum=([^,]*)
attr c_Klimaanlage reading32Name alert
attr c_Klimaanlage reading32Regex alert=([^,]*)
attr c_Klimaanlage reading33Name f_rate
attr c_Klimaanlage reading33Regex f_rate=([^,]*)
attr c_Klimaanlage reading34Name f_dir
attr c_Klimaanlage reading34Regex f_dir=([^,]*)
attr c_Klimaanlage reading35Name b_f_rate
attr c_Klimaanlage reading35OMap A:auto, B:silent, 3:very_low, 4:low, 5:medium, 6:high, 7:very_high
attr c_Klimaanlage reading35Regex b_f_rate=([^,]*)
attr c_Klimaanlage reading36Name b_f_dir
attr c_Klimaanlage reading36OMap 0:stopped, 1:vertical, 2:horizontal, 3:vertical&horizontal
attr c_Klimaanlage reading36Regex b_f_dir=([^,]*)
attr c_Klimaanlage reading37Name dfr1
attr c_Klimaanlage reading37Regex dfr1=([^,]*)
attr c_Klimaanlage reading38Name dfr2
attr c_Klimaanlage reading38Regex dfr2=([^,]*)
attr c_Klimaanlage reading39Name dfr3
attr c_Klimaanlage reading39Regex dfr3=([^,]*)
attr c_Klimaanlage reading40Name dfr4
attr c_Klimaanlage reading40Regex dfr4=([^,]*)
attr c_Klimaanlage reading41Name dfr5
attr c_Klimaanlage reading41Regex dfr5=([^,]*)
attr c_Klimaanlage reading42Name dfr6
attr c_Klimaanlage reading42Regex dfr6=([^,]*)
attr c_Klimaanlage reading43Name dfr7
attr c_Klimaanlage reading43Regex dfr7=([^,]*)
attr c_Klimaanlage reading44Name dfrh
attr c_Klimaanlage reading44Regex dfrh=([^,]*)
attr c_Klimaanlage reading45Name dfd1
attr c_Klimaanlage reading45Regex dfd1=([^,]*)
attr c_Klimaanlage reading46Name dfd2
attr c_Klimaanlage reading46Regex dfd2=([^,]*)
attr c_Klimaanlage reading47Name dfd3
attr c_Klimaanlage reading47Regex dfd3=([^,]*)
attr c_Klimaanlage reading48Name dfd4
attr c_Klimaanlage reading48Regex dfd4=([^,]*)
attr c_Klimaanlage reading49Name dfd5
attr c_Klimaanlage reading49Regex dfd5=([^,]*)
attr c_Klimaanlage reading50Name dfd6
attr c_Klimaanlage reading50Regex dfd6=([^,]*)
attr c_Klimaanlage reading51Name dfd7
attr c_Klimaanlage reading51Regex dfd7=([^,]*)
attr c_Klimaanlage reading52Name dfdh
attr c_Klimaanlage reading52Regex dfdh=([^,]*)
attr c_Klimaanlage replacement01Mode expression
attr c_Klimaanlage replacement01Regex {{([^}]+)}}
attr c_Klimaanlage replacement01Value ReadingsVal($name, $1, "")
attr c_Klimaanlage room Haus,Heizung/Klima,Treppenhaus
attr c_Klimaanlage set01Data pow=$val&mode={{mode}}&stemp={{stemp}}&shum=0&f_rate={{f_rate}}&f_dir={{f_dir}}
attr c_Klimaanlage set01Hint 0,1
attr c_Klimaanlage set01Max 1
attr c_Klimaanlage set01Min 0
attr c_Klimaanlage set01Name power
attr c_Klimaanlage set03Data pow={{pow}}&mode={{mode}}&stemp=$val&shum=0&f_rate={{f_rate}}&f_dir={{f_dir}}
attr c_Klimaanlage set03Max 41
attr c_Klimaanlage set03Min 10
attr c_Klimaanlage set03Name stemp
attr c_Klimaanlage set04Data pow={{pow}}&mode={{mode}}&stemp={{stemp}}&shum=0&f_rate=$val&f_rate&f_dir={{f_dir}}
attr c_Klimaanlage set04Hint A,B,3,4,5,6,7
attr c_Klimaanlage set04Max 7
attr c_Klimaanlage set04Min A
attr c_Klimaanlage set04Name f_rate
attr c_Klimaanlage setURL http://192.168.1.201/aircon/set_control_info?
attr c_Klimaanlage stateFormat {(ReadingsVal($name,"pow","") == 1) ? ("on") : ("off") }
attr c_Klimaanlage verbose 0
attr c_Klimaanlage webCmd on:off:stemp:f_rate
attr c_Klimaanlage widgetOverride stemp:slider,10,1,41 f_rate:slider,A,B,3,4,5,6,7

pejonp

@smoudo


attr c_Klimaanlage reading35OMap A:auto, B:silent, 3:very_low, 4:low, 5:medium, 6:high, 7:very_high


A und B sind nicht numeric,  0 und 1 sollten es eher sein !

Pejonp
LaCrossGW 868MHz:WT470+TFA+TX37-IT+EMT7110+W136+WH25A HP1003+WH2621
SignalD(CC1101):Bresser+WS-0101(868MHz WH1080)+Velux KLF200+MAX!+HM-MOD-UART:Smoke HM-SEC-SD+VITOSOLIC 200 RESOL VBUS-LAN+SolarEdge SE5K(Modbus)+Sonnen!eco8(10kWh)+TD3511+DRT710M(Modbus)+ZigBee+Z-Wave+MQTT+vitoconnect

smoudo

Und wie löse ich A und B in 0 und 1 auf.
Die api erwartet doch A B ?!

Grüße

Matze

pejonp

#23
Vielleicht in Hex

0xa  oder 0xb

Pejonp
LaCrossGW 868MHz:WT470+TFA+TX37-IT+EMT7110+W136+WH25A HP1003+WH2621
SignalD(CC1101):Bresser+WS-0101(868MHz WH1080)+Velux KLF200+MAX!+HM-MOD-UART:Smoke HM-SEC-SD+VITOSOLIC 200 RESOL VBUS-LAN+SolarEdge SE5K(Modbus)+Sonnen!eco8(10kWh)+TD3511+DRT710M(Modbus)+ZigBee+Z-Wave+MQTT+vitoconnect

smoudo

Funktioniert leider nicht. Selbe Fehlermeldung

Grüße

Matze

pejonp

Wie sieht den der vollständige String (url) aus, den du zur Klima sendest.

Pejonp
LaCrossGW 868MHz:WT470+TFA+TX37-IT+EMT7110+W136+WH25A HP1003+WH2621
SignalD(CC1101):Bresser+WS-0101(868MHz WH1080)+Velux KLF200+MAX!+HM-MOD-UART:Smoke HM-SEC-SD+VITOSOLIC 200 RESOL VBUS-LAN+SolarEdge SE5K(Modbus)+Sonnen!eco8(10kWh)+TD3511+DRT710M(Modbus)+ZigBee+Z-Wave+MQTT+vitoconnect

smoudo

http://192.168.1.210/aircon/set_control_info?pow=1&mode=3&stemp=22&shum=0&f_rate=B&f_dir=3

Das bedeutet:

Pow für ein/ausschalten wert 1
Mode=3 kühlen
Stemp=22 für Sollwert 22gradC
Shum= Luftfeuchtigkeit
f_rate= lüfterstufe
f_dir= lamellenrichtung vertikal+horizontal

Bei Lüfterstufe gibt es A,B,3,4,5,6,7

3-7 funktioniert mit dem Code

Grüße

Matze

pejonp

@smoudo

schau mal hier (https://wiki.fhem.de/wiki/ModbusAttr#Handling_Data_Types) ich würde sagen das mapping geht nur auf Zahlen. Du müstes dir jetzt eine Funktion überlegen die das abfängt. Ich frage mal im Modbus-Forum nach (https://forum.fhem.de/index.php/topic,75638.msg961473.html#msg961473).

pejonp
LaCrossGW 868MHz:WT470+TFA+TX37-IT+EMT7110+W136+WH25A HP1003+WH2621
SignalD(CC1101):Bresser+WS-0101(868MHz WH1080)+Velux KLF200+MAX!+HM-MOD-UART:Smoke HM-SEC-SD+VITOSOLIC 200 RESOL VBUS-LAN+SolarEdge SE5K(Modbus)+Sonnen!eco8(10kWh)+TD3511+DRT710M(Modbus)+ZigBee+Z-Wave+MQTT+vitoconnect

erwin

Hi All,
bei mir funktioniert das setzen der f_rate:
setxxIMap A:auto, B:silent, 3:very_low, 4:low, 5:medium, 6:high, 7:very_high
damit hab ich auch ein pulldown mit auto,silent,.....
l.g. erwin
FHEM aktuell auf RaspberryPI Mdl 1-4
Maintainer: 00_KNXIO.pm 10_KNX.pm
User: CUNO2 (868 SLOWRF) - HMS100xx, FS20, FHT, 1-Wire  - 2401(iButton), 18x20, 2406, 2413 (AVR), 2450,..,MQTT2, KNX, SONOFF, mySENSORS,....
Hardware:  Busware ROT, Weinzierl IP731, 1-Wire GW,...

smoudo

Könntest du dein komplettes define mal posten. Am Mode A und B bin ich am verzweifeln. Wenn ich den Code direkt im Browser schicke läufts, wenn ich über fhem auflösen lasse bekomme ich den Fehler.

Grüße

Matze