]> git.basschouten.com Git - openhab-addons.git/blob
19572aaa537ea4ea8f6f65fec45944bf808421c8
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2021 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.ecotouch.internal;
14
15 import static org.openhab.core.library.unit.MetricPrefix.*;
16 import static org.openhab.core.library.unit.SIUnits.*;
17 import static org.openhab.core.library.unit.Units.*;
18
19 import java.math.BigDecimal;
20 import java.util.LinkedList;
21 import java.util.List;
22
23 import javax.measure.Unit;
24
25 /**
26  * Represents all valid commands which could be processed by this binding
27  *
28  * @author Sebastian Held <sebastian.held@gmx.de> - Initial contribution
29  * @since 1.5.0
30  */
31 public enum EcoTouchTags {
32
33     // German: Außentemperatur
34     TYPE_TEMPERATURE_OUTSIDE {
35         {
36             command = "temperature_outside";
37             unit = CELSIUS;
38             tagName = "A1";
39         }
40     },
41
42     // German: Außentemperatur gemittelt über 1h
43     TYPE_TEMPERATURE_OUTSIDE_1H {
44         {
45             command = "temperature_outside_1h";
46             unit = CELSIUS;
47             tagName = "A2";
48         }
49     },
50
51     // German: Außentemperatur gemittelt über 24h
52     TYPE_TEMPERATURE_OUTSIDE_24H {
53         {
54             command = "temperature_outside_24h";
55             unit = CELSIUS;
56             tagName = "A3";
57         }
58     },
59
60     // German: Quelleneintrittstemperatur
61     TYPE_TEMPERATURE_SOURCE_IN {
62         {
63             command = "temperature_source_in";
64             unit = CELSIUS;
65             tagName = "A4";
66         }
67     },
68
69     // German: Quellenaustrittstemperatur
70     TYPE_TEMPERATURE_SOURCE_OUT {
71         {
72             command = "temperature_source_out";
73             unit = CELSIUS;
74             tagName = "A5";
75         }
76     },
77
78     // German: Verdampfungstemperatur
79     TYPE_TEMPERATURE_EVAPORATION {
80         {
81             command = "temperature_evaporation";
82             unit = CELSIUS;
83             tagName = "A6";
84         }
85     },
86
87     // German: Sauggastemperatur
88     TYPE_TEMPERATURE_SUCTION {
89         {
90             command = "temperature_suction";
91             unit = CELSIUS;
92             tagName = "A7";
93         }
94     },
95
96     // German: Verdampfungsdruck
97     TYPE_PRESSURE_EVAPORATION {
98         {
99             command = "pressure_evaporation";
100             unit = BAR;
101             tagName = "A8";
102         }
103     },
104
105     // German: Temperatur Rücklauf Soll
106     TYPE_TEMPERATURE_RETURN_SET {
107         {
108             command = "temperature_return_set";
109             unit = CELSIUS;
110             tagName = "A10";
111         }
112     },
113
114     // German: Temperatur Rücklauf
115     TYPE_TEMPERATURE_RETURN {
116         {
117             command = "temperature_return";
118             unit = CELSIUS;
119             tagName = "A11";
120         }
121     },
122
123     // German: Temperatur Vorlauf
124     TYPE_TEMPERATURE_FLOW {
125         {
126             command = "temperature_flow";
127             unit = CELSIUS;
128             tagName = "A12";
129         }
130     },
131
132     // German: Kondensationstemperatur
133     TYPE_TEMPERATURE_CONDENSATION {
134         {
135             command = "temperature_condensation";
136             unit = CELSIUS;
137             tagName = "A14";
138         }
139     },
140
141     // German: Kondensationsdruck
142     TYPE_PRESSURE_CONDENSATION {
143         {
144             command = "pressure_condensation";
145             unit = BAR;
146             tagName = "A15";
147         }
148     },
149
150     // German: Speichertemperatur
151     TYPE_TEMPERATURE_STORAGE {
152         {
153             command = "temperature_storage";
154             unit = CELSIUS;
155             tagName = "A16";
156         }
157     },
158
159     // German: Raumtemperatur
160     TYPE_TEMPERATURE_ROOM {
161         {
162             command = "temperature_room";
163             unit = CELSIUS;
164             tagName = "A17";
165         }
166     },
167
168     // German: Raumtemperatur gemittelt über 1h
169     TYPE_TEMPERATURE_ROOM_1H {
170         {
171             command = "temperature_room_1h";
172             unit = CELSIUS;
173             tagName = "A18";
174         }
175     },
176
177     // German: Warmwassertemperatur
178     TYPE_TEMPERATURE_WATER {
179         {
180             command = "temperature_water";
181             unit = CELSIUS;
182             tagName = "A19";
183         }
184     },
185
186     // German: Pooltemperatur
187     TYPE_TEMPERATURE_POOL {
188         {
189             command = "temperature_pool";
190             unit = CELSIUS;
191             tagName = "A20";
192         }
193     },
194
195     // German: Solarkollektortemperatur
196     TYPE_TEMPERATURE_SOLAR {
197         {
198             command = "temperature_solar";
199             unit = CELSIUS;
200             tagName = "A21";
201         }
202     },
203
204     // German: Solarkreis Vorlauf
205     TYPE_TEMPERATURE_SOLAR_FLOW {
206         {
207             command = "temperature_solar_flow";
208             unit = CELSIUS;
209             tagName = "A22";
210         }
211     },
212
213     // German: Ventilöffnung elektrisches Expansionsventil
214     TYPE_POSITION_EXPANSION_VALVE {
215         {
216             command = "position_expansion_valve";
217             unit = PERCENT;
218             tagName = "A23";
219         }
220     },
221
222     // German: elektrische Leistung Verdichter
223     TYPE_POWER_COMPRESSOR {
224         {
225             command = "power_compressor";
226             unit = KILO(WATT);
227             tagName = "A25";
228         }
229     },
230
231     // German: abgegebene thermische Heizleistung der Wärmepumpe
232     TYPE_POWER_HEATING {
233         {
234             command = "power_heating";
235             unit = KILO(WATT);
236             tagName = "A26";
237         }
238     },
239
240     // German: abgegebene thermische KälteLeistung der Wärmepumpe
241     TYPE_POWER_COOLING {
242         {
243             command = "power_cooling";
244             unit = KILO(WATT);
245             tagName = "A27";
246         }
247     },
248
249     // German: COP Heizleistung
250     TYPE_COP_HEATING {
251         {
252             command = "cop_heating";
253             tagName = "A28";
254         }
255     },
256
257     // German: COP Kälteleistungleistung
258     TYPE_COP_COOLING {
259         {
260             command = "cop_cooling";
261             tagName = "A29";
262         }
263     },
264
265     // German: Aktuelle Heizkreistemperatur
266     TYPE_TEMPERATURE_HEATING {
267         {
268             command = "temperature_heating_return";
269             unit = CELSIUS;
270             tagName = "A30";
271         }
272     },
273
274     // German: Geforderte Temperatur im Heizbetrieb
275     TYPE_TEMPERATURE_HEATING_SET {
276         {
277             command = "temperature_heating_set";
278             unit = CELSIUS;
279             tagName = "A31";
280         }
281     },
282
283     // German: Sollwertvorgabe Heizkreistemperatur
284     TYPE_TEMPERATURE_HEATING_SET2 {
285         {
286             command = "temperature_heating_set2";
287             unit = CELSIUS;
288             tagName = "A32";
289         }
290     },
291
292     // German: Aktuelle Kühlkreistemperatur
293     TYPE_TEMPERATURE_COOLING {
294         {
295             command = "temperature_cooling_return";
296             unit = CELSIUS;
297             tagName = "A33";
298         }
299     },
300
301     // German: Geforderte Temperatur im Kühlbetrieb
302     TYPE_TEMPERATURE_COOLING_SET {
303         {
304             command = "temperature_cooling_set";
305             unit = CELSIUS;
306             tagName = "A34";
307         }
308     },
309
310     // German: Sollwertvorgabe Kühlbetrieb
311     TYPE_TEMPERATURE_COOLING_SET2 {
312         {
313             command = "temperature_cooling_set2";
314             unit = CELSIUS;
315             tagName = "A35";
316         }
317     },
318
319     // German: Sollwert Warmwassertemperatur
320     TYPE_TEMPERATURE_WATER_SET {
321         {
322             command = "temperature_water_set";
323             unit = CELSIUS;
324             tagName = "A37";
325         }
326     },
327
328     // German: Sollwertvorgabe Warmwassertemperatur
329     TYPE_TEMPERATURE_WATER_SET2 {
330         {
331             command = "temperature_water_set2";
332             unit = CELSIUS;
333             tagName = "A38";
334         }
335     },
336
337     // German: Sollwert Poolwassertemperatur
338     TYPE_TEMPERATURE_POOL_SET {
339         {
340             command = "temperature_pool_set";
341             unit = CELSIUS;
342             tagName = "A40";
343         }
344     },
345
346     // German: Sollwertvorgabe Poolwassertemperatur
347     TYPE_TEMPERATURE_POOL_SET2 {
348         {
349             command = "temperature_pool_set2";
350             unit = CELSIUS;
351             tagName = "A41";
352         }
353     },
354
355     // German: geforderte Verdichterleistung
356     TYPE_COMPRESSOR_POWER {
357         {
358             command = "compressor_power";
359             unit = PERCENT;
360             tagName = "A50";
361         }
362     },
363
364     // German: % Heizungsumwälzpumpe
365     TYPE_PERCENT_HEAT_CIRC_PUMP {
366         {
367             command = "percent_heat_circ_pump";
368             unit = PERCENT;
369             tagName = "A51";
370         }
371     },
372
373     // German: % Quellenpumpe
374     TYPE_PERCENT_SOURCE_PUMP {
375         {
376             command = "percent_source_pump";
377             unit = PERCENT;
378             tagName = "A52";
379         }
380     },
381
382     // German: % Leistung Verdichter
383     TYPE_PERCENT_COMPRESSOR {
384         {
385             command = "percent_compressor";
386             unit = PERCENT;
387             tagName = "A58";
388         }
389     },
390
391     // German: Hysterese Heizung
392     TYPE_HYSTERESIS_HEATING {
393         {
394             command = "hysteresis_heating";
395             unit = CELSIUS;
396             tagName = "A61";
397         }
398     },
399
400     // German: Außentemperatur gemittelt über 1h (scheinbar identisch zu A2)
401     TYPE_TEMPERATURE2_OUTSIDE_1H {
402         {
403             command = "temperature2_outside_1h";
404             unit = CELSIUS;
405             tagName = "A90";
406         }
407     },
408
409     // German: Heizkurve - nviNormAussen
410     TYPE_NVINORMAUSSEN {
411         {
412             command = "nviNormAussen";
413             unit = CELSIUS;
414             tagName = "A91";
415         }
416     },
417
418     // German: Heizkurve - nviHeizkreisNorm
419     TYPE_NVIHEIZKREISNORM {
420         {
421             command = "nviHeizkreisNorm";
422             unit = CELSIUS;
423             tagName = "A92";
424         }
425     },
426
427     // German: Heizkurve - nviTHeizgrenze
428     TYPE_NVITHEIZGRENZE {
429         {
430             command = "nviTHeizgrenze";
431             unit = CELSIUS;
432             tagName = "A93";
433         }
434     },
435
436     // German: Heizkurve - nviTHeizgrenzeSoll
437     TYPE_NVITHEIZGRENZESOLL {
438         {
439             command = "nviTHeizgrenzeSoll";
440             unit = CELSIUS;
441             tagName = "A94";
442         }
443     },
444
445     // German: undokumentiert: Heizkurve max. VL-Temp (??)
446     TYPE_MAX_VL_TEMP {
447         {
448             command = "maxVLTemp";
449             unit = CELSIUS;
450             tagName = "A95";
451         }
452     },
453
454     // German: undokumentiert: Heizkreis Soll-Temp bei 0° Aussen
455     TYPE_TEMP_SET_0DEG {
456         {
457             command = "tempSet0Deg";
458             unit = CELSIUS;
459             tagName = "A97";
460         }
461     },
462
463     // German: Raum Soll
464     TYPE_TEMP_ROOM_SET {
465         {
466             command = "tempRoomSet";
467             unit = CELSIUS;
468             tagName = "A100";
469         }
470     },
471
472     // German: undokumentiert: Kühlen Einschalt-Temp. Aussentemp (??)
473     TYPE_COOLENABLETEMP {
474         {
475             command = "coolEnableTemp";
476             unit = CELSIUS;
477             tagName = "A108";
478         }
479     },
480
481     // German: Heizkurve - nviSollKuehlen
482     TYPE_NVITSOLLKUEHLEN {
483         {
484             command = "nviSollKuehlen";
485             unit = CELSIUS;
486             tagName = "A109";
487         }
488     },
489
490     // German: Temperaturveränderung Heizkreis bei PV-Ertrag
491     TYPE_TEMPCHANGE_HEATING_PV {
492         {
493             command = "tempchange_heating_pv";
494             unit = CELSIUS;
495             tagName = "A682";
496         }
497     },
498
499     // German: Temperaturveränderung Kühlkreis bei PV-Ertrag
500     TYPE_TEMPCHANGE_COOLING_PV {
501         {
502             command = "tempchange_cooling_pv";
503             unit = CELSIUS;
504             tagName = "A683";
505         }
506     },
507
508     // German: Temperaturveränderung Warmwasser bei PV-Ertrag
509     TYPE_TEMPCHANGE_WARMWATER_PV {
510         {
511             command = "tempchange_warmwater_pv";
512             unit = CELSIUS;
513             tagName = "A684";
514         }
515     },
516
517     // German: Temperaturveränderung Pool bei PV-Ertrag
518     TYPE_TEMPCHANGE_POOL_PV {
519         {
520             command = "tempchange_pool_pv";
521             unit = CELSIUS;
522             tagName = "A685";
523         }
524     },
525
526     // German: undokumentiert: Firmware-Version Regler
527     // value 10401 => 01.04.01
528     TYPE_VERSION_CONTROLLER {
529         {
530             command = "version_controller";
531             divisor = 1;
532             tagName = "I1";
533             type = Type.Word;
534         }
535     },
536
537     // German: undokumentiert: Firmware-Build Regler
538     TYPE_VERSION_CONTROLLER_BUILD {
539         {
540             command = "version_controller_build";
541             divisor = 1;
542             tagName = "I2";
543             type = Type.Word;
544         }
545     },
546
547     // German: undokumentiert: BIOS-Version
548     // value 620 => 06.20
549     TYPE_VERSION_BIOS {
550         {
551             command = "version_bios";
552             divisor = 1;
553             tagName = "I3";
554             type = Type.Word;
555         }
556     },
557
558     // German: undokumentiert: Datum: Tag
559     TYPE_DATE_DAY {
560         {
561             command = "date_day";
562             divisor = 1;
563             tagName = "I5";
564             type = Type.Word;
565         }
566     },
567
568     // German: undokumentiert: Datum: Monat
569     TYPE_DATE_MONTH {
570         {
571             command = "date_month";
572             divisor = 1;
573             tagName = "I6";
574             type = Type.Word;
575         }
576     },
577
578     // German: undokumentiert: Datum: Jahr
579     TYPE_DATE_YEAR {
580         {
581             command = "date_year";
582             divisor = 1;
583             tagName = "I7";
584             type = Type.Word;
585         }
586     },
587
588     // German: undokumentiert: Uhrzeit: Stunde
589     TYPE_TIME_HOUR {
590         {
591             command = "time_hour";
592             divisor = 1;
593             tagName = "I8";
594             type = Type.Word;
595         }
596     },
597
598     // German: undokumentiert: Uhrzeit: Minute
599     TYPE_TIME_MINUTE {
600         {
601             command = "time_minute";
602             divisor = 1;
603             tagName = "I9";
604             type = Type.Word;
605         }
606     },
607
608     // German: Betriebsstunden Verdichter 1
609     TYPE_OPERATING_HOURS_COMPRESSOR1 {
610         {
611             command = "operating_hours_compressor1";
612             divisor = 1;
613             unit = HOUR;
614             tagName = "I10";
615             type = Type.Word;
616         }
617     },
618
619     // German: Betriebsstunden Verdichter 2
620     TYPE_OPERATING_HOURS_COMPRESSOR2 {
621         {
622             command = "operating_hours_compressor2";
623             divisor = 1;
624             unit = HOUR;
625             tagName = "I14";
626             type = Type.Word;
627         }
628     },
629
630     // German: Betriebsstunden Heizungsumwälzpumpe
631     TYPE_OPERATING_HOURS_CIRCULATION_PUMP {
632         {
633             command = "operating_hours_circulation_pump";
634             divisor = 1;
635             unit = HOUR;
636             tagName = "I18";
637             type = Type.Word;
638         }
639     },
640
641     // German: Betriebsstunden Quellenpumpe
642     TYPE_OPERATING_HOURS_SOURCE_PUMP {
643         {
644             command = "operating_hours_source_pump";
645             divisor = 1;
646             unit = HOUR;
647             tagName = "I20";
648             type = Type.Word;
649         }
650     },
651
652     // German: Betriebsstunden Solarkreis
653     TYPE_OPERATING_HOURS_SOLAR {
654         {
655             command = "operating_hours_solar";
656             divisor = 1;
657             unit = HOUR;
658             tagName = "I22";
659             type = Type.Word;
660         }
661     },
662
663     // German: Handabschaltung Heizbetrieb
664     TYPE_ENABLE_HEATING {
665         {
666             command = "enable_heating";
667             divisor = 1;
668             tagName = "I30";
669             type = Type.Word;
670         }
671     },
672
673     // German: Handabschaltung Kühlbetrieb
674     TYPE_ENABLE_COOLING {
675         {
676             command = "enable_cooling";
677             divisor = 1;
678             tagName = "I31";
679             type = Type.Word;
680         }
681     },
682
683     // German: Handabschaltung Warmwasserbetrieb
684     TYPE_ENABLE_WARMWATER {
685         {
686             command = "enable_warmwater";
687             divisor = 1;
688             tagName = "I32";
689             type = Type.Word;
690         }
691     },
692
693     // German: Handabschaltung Pool_Heizbetrieb
694     TYPE_ENABLE_POOL {
695         {
696             command = "enable_pool";
697             divisor = 1;
698             tagName = "I33";
699             type = Type.Word;
700         }
701     },
702
703     // German: undokumentiert: vermutlich Betriebsmodus PV 0=Aus, 1=Auto, 2=Ein
704     TYPE_ENABLE_PV {
705         {
706             command = "enable_pv";
707             divisor = 1;
708             tagName = "I41";
709             type = Type.Word;
710         }
711     },
712
713     // German: Status der Wärmepumpenkomponenten
714     TYPE_STATE {
715         {
716             command = "state";
717             divisor = 1;
718             tagName = "I51";
719             type = Type.Word;
720         }
721     },
722
723     // German: Status der Wärmepumpenkomponenten: Quellenpumpe
724     TYPE_STATE_SOURCEPUMP {
725         {
726             command = "state_sourcepump";
727             tagName = "I51";
728             type = Type.Bitfield;
729             bitnum = 0;
730         }
731     },
732
733     // German: Status der Wärmepumpenkomponenten: Heizungsumwälzpumpe
734     TYPE_STATE_HEATINGPUMP {
735         {
736             command = "state_heatingpump";
737             tagName = "I51";
738             type = Type.Bitfield;
739             bitnum = 1;
740         }
741     },
742
743     // German: Status der Wärmepumpenkomponenten: Freigabe Regelung EVD /
744     // Magnetventil
745     TYPE_STATE_EVD {
746         {
747             command = "state_evd";
748             tagName = "I51";
749             type = Type.Bitfield;
750             bitnum = 2;
751         }
752     },
753
754     // German: Status der Wärmepumpenkomponenten: Verdichter 1
755     TYPE_STATE_compressor1 {
756         {
757             command = "state_compressor1";
758             tagName = "I51";
759             type = Type.Bitfield;
760             bitnum = 3;
761         }
762     },
763
764     // German: Status der Wärmepumpenkomponenten: Verdichter 2
765     TYPE_STATE_compressor2 {
766         {
767             command = "state_compressor2";
768             tagName = "I51";
769             type = Type.Bitfield;
770             bitnum = 4;
771         }
772     },
773
774     // German: Status der Wärmepumpenkomponenten: externer Wärmeerzeuger
775     TYPE_STATE_extheater {
776         {
777             command = "state_extheater";
778             tagName = "I51";
779             type = Type.Bitfield;
780             bitnum = 5;
781         }
782     },
783
784     // German: Status der Wärmepumpenkomponenten: Alarmausgang
785     TYPE_STATE_alarm {
786         {
787             command = "state_alarm";
788             tagName = "I51";
789             type = Type.Bitfield;
790             bitnum = 6;
791         }
792     },
793
794     // German: Status der Wärmepumpenkomponenten: Motorventil Kühlbetrieb
795     TYPE_STATE_cooling {
796         {
797             command = "state_cooling";
798             tagName = "I51";
799             type = Type.Bitfield;
800             bitnum = 7;
801         }
802     },
803
804     // German: Status der Wärmepumpenkomponenten: Motorventil Warmwasser
805     TYPE_STATE_water {
806         {
807             command = "state_water";
808             tagName = "I51";
809             type = Type.Bitfield;
810             bitnum = 8;
811         }
812     },
813
814     // German: Status der Wärmepumpenkomponenten: Motorventil Pool
815     TYPE_STATE_pool {
816         {
817             command = "state_pool";
818             tagName = "I51";
819             type = Type.Bitfield;
820             bitnum = 9;
821         }
822     },
823
824     // German: Status der Wärmepumpenkomponenten: Solarbetrieb
825     TYPE_STATE_solar {
826         {
827             command = "state_solar";
828             tagName = "I51";
829             type = Type.Bitfield;
830             bitnum = 10;
831         }
832     },
833
834     // German: Status der Wärmepumpenkomponenten: 4-Wegeventil im Kältekreis
835     TYPE_STATE_cooling4way {
836         {
837             command = "state_cooling4way";
838             tagName = "I51";
839             type = Type.Bitfield;
840             bitnum = 11;
841         }
842     },
843
844     // German: Meldungen von Ausfällen F0xx die zum Wärmepumpenausfall führen
845     TYPE_ALARM {
846         {
847             command = "alarm";
848             divisor = 1;
849             tagName = "I52";
850             type = Type.Word;
851         }
852     },
853
854     // German: Unterbrechungen
855     TYPE_INTERRUPTIONS {
856         {
857             command = "interruptions";
858             divisor = 1;
859             tagName = "I53";
860             type = Type.Word;
861         }
862     },
863
864     // German: Serviceebene (0: normal, 1: service)
865     TYPE_STATE_SERVICE {
866         {
867             command = "state_service";
868             divisor = 1;
869             tagName = "I135";
870             type = Type.Word;
871         }
872     },
873
874     // German: Temperaturanpassung für die Heizung
875     TYPE_ADAPT_HEATING {
876         {
877             command = "adapt_heating";
878             divisor = 1;
879             tagName = "I263";
880             type = Type.Word; // value range 0..8 => -2K .. +2K
881         }
882     },
883
884     // German: Raumeinfluss
885     TYPE_TEMP_ROOM_INFLUENCE {
886         {
887             command = "tempRoomInfluence";
888             divisor = 1;
889             tagName = "I264";
890             type = Type.Word; // value range 0..4 => 0%, 50%, 100%, 150%, 200%
891         }
892     },
893
894     // German: Handschaltung Heizungspumpe (H-0-A)
895     // H:Handschaltung Ein 0:Aus A:Automatik
896     // Kodierung: 0:? 1:? 2:Automatik
897     TYPE_MANUAL_HEATINGPUMP {
898         {
899             command = "manual_heatingpump";
900             divisor = 1;
901             tagName = "I1270";
902             type = Type.Word;
903         }
904     },
905
906     // German: Handschaltung Quellenpumpe (H-0-A)
907     TYPE_MANUAL_SOURCEPUMP {
908         {
909             command = "manual_sourcepump";
910             divisor = 1;
911             tagName = "I1281";
912             type = Type.Word;
913         }
914     },
915
916     // German: Handschaltung Solarpumpe 1 (H-0-A)
917     TYPE_MANUAL_SOLARPUMP1 {
918         {
919             command = "manual_solarpump1";
920             divisor = 1;
921             tagName = "I1287";
922             type = Type.Word;
923         }
924     },
925
926     // German: Handschaltung Solarpumpe 2 (H-0-A)
927     TYPE_MANUAL_SOLARPUMP2 {
928         {
929             command = "manual_solarpump2";
930             divisor = 1;
931             tagName = "I1289";
932             type = Type.Word;
933         }
934     },
935
936     // German: Handschaltung Speicherladepumpe (H-0-A)
937     TYPE_MANUAL_TANKPUMP {
938         {
939             command = "manual_tankpump";
940             divisor = 1;
941             tagName = "I1291";
942             type = Type.Word;
943         }
944     },
945
946     // German: Handschaltung Brauchwasserventil (H-0-A)
947     TYPE_MANUAL_VALVE {
948         {
949             command = "manual_valve";
950             divisor = 1;
951             tagName = "I1293";
952             type = Type.Word;
953         }
954     },
955
956     // German: Handschaltung Poolventil (H-0-A)
957     TYPE_MANUAL_POOLVALVE {
958         {
959             command = "manual_poolvalve";
960             divisor = 1;
961             tagName = "I1295";
962             type = Type.Word;
963         }
964     },
965
966     // German: Handschaltung Kühlventil (H-0-A)
967     TYPE_MANUAL_COOLVALVE {
968         {
969             command = "manual_coolvalve";
970             divisor = 1;
971             tagName = "I1297";
972             type = Type.Word;
973         }
974     },
975
976     // German: Handschaltung Vierwegeventil (H-0-A)
977     TYPE_MANUAL_4WAYVALVE {
978         {
979             command = "manual_4wayvalve";
980             divisor = 1;
981             tagName = "I1299";
982             type = Type.Word;
983         }
984     },
985
986     // German: Handschaltung Multiausgang Ext. (H-0-A)
987     TYPE_MANUAL_MULTIEXT {
988         {
989             command = "manual_multiext";
990             divisor = 1;
991             tagName = "I1319";
992             type = Type.Word;
993         }
994     },
995
996     // German: Umgebung
997     TYPE_TEMPERATURE_SURROUNDING {
998         {
999             command = "temperature_surrounding";
1000             unit = CELSIUS;
1001             tagName = "I2020";
1002             type = Type.Analog;
1003             divisor = 100;
1004         }
1005     },
1006
1007     // German: Sauggas
1008     TYPE_TEMPERATURE_SUCTION_AIR {
1009         {
1010             command = "temperature_suction_air";
1011             unit = CELSIUS;
1012             tagName = "I2021";
1013             type = Type.Analog;
1014             divisor = 100;
1015         }
1016     },
1017
1018     // German: Ölsumpf
1019     TYPE_TEMPERATURE_SUMP {
1020         {
1021             command = "temperature_sump";
1022             unit = CELSIUS;
1023             tagName = "I2023";
1024             type = Type.Analog;
1025             divisor = 100;
1026         }
1027     },
1028
1029     //
1030     // The following tags are only available, if an Ecovent System is attached to the Ecotouch
1031     //
1032
1033     // German: Abluft
1034     // Waterkotte reference: airventilation-temperature-1
1035     TYPE_ECOVENT_TEMP_EXHAUST_AIR {
1036         {
1037             command = "ecovent_temp_exhaust_air";
1038             unit = CELSIUS;
1039             tagName = "3:HREG400000";
1040             type = Type.Float;
1041             divisor = 1;
1042         }
1043     },
1044
1045     // German: Fortluft
1046     // Waterkotte reference: airventilation-temperature-2
1047     TYPE_ECOVENT_TEMP_EXIT_AIR {
1048         {
1049             command = "ecovent_temp_exit_air";
1050             unit = CELSIUS;
1051             tagName = "3:HREG400002";
1052             type = Type.Float;
1053             divisor = 1;
1054         }
1055     },
1056
1057     // German: Außenluft
1058     // Waterkotte reference: airventilation-temperature-3
1059     TYPE_ECOVENT_TEMP_OUTDOOR_AIR {
1060         {
1061             command = "ecovent_temp_outdoor_air";
1062             unit = CELSIUS;
1063             tagName = "3:HREG400004";
1064             type = Type.Float;
1065             divisor = 1;
1066         }
1067     },
1068
1069     // German: Zuluft
1070     // Waterkotte reference: airventilation-temperature-4
1071     TYPE_ECOVENT_TEMP_SUPPLY_AIR {
1072         {
1073             command = "ecovent_temp_supply_air";
1074             unit = CELSIUS;
1075             tagName = "3:HREG400006";
1076             type = Type.Float;
1077             divisor = 1;
1078         }
1079     },
1080
1081     // German: CO2
1082     // Waterkotte reference: airventilation-co2-value
1083     TYPE_ECOVENT_CO2_VALUE {
1084         {
1085             command = "ecovent_CO2_value";
1086             unit = PARTS_PER_MILLION;
1087             tagName = "3:HREG400008";
1088             type = Type.Float;
1089             divisor = 1;
1090         }
1091     },
1092
1093     // German: Luftfeuchtigkeit
1094     // Waterkotte reference: airventilation-air-moisture-value
1095     TYPE_ECOVENT_MOISTURE_VALUE {
1096         {
1097             command = "ecovent_moisture_value";
1098             unit = PARTS_PER_MILLION;
1099             tagName = "3:HREG400010";
1100             type = Type.Float;
1101             divisor = 1;
1102         }
1103     },
1104
1105     // German: Lüfterdrehzahl
1106     // Waterkotte reference: airventilation-analog-output-y1
1107     TYPE_ECOVENT_OUTPUT_Y1 {
1108         {
1109             command = "ecovent_output_y1";
1110             unit = PERCENT;
1111             tagName = "3:HREG400014";
1112             type = Type.Float;
1113             divisor = 1;
1114         }
1115     },
1116
1117     TYPE_ECOVENT_MODE {
1118         {
1119             command = "ecovent_mode";
1120             tagName = "I4582";
1121             type = Type.Word; // Type.Enum;
1122             divisor = 1;
1123             stringEnum = new String[] { "Day Mode", "Night Mode", "Timer Mode", "Party Mode", "Vacation Mode",
1124                     "Bypass Mode" };
1125         }
1126     },
1127
1128     ;
1129
1130     /**
1131      * Represents the heatpump command as it will be used in *.items
1132      * configuration
1133      */
1134     String command;
1135     /**
1136      * Represents the internal raw heatpump command as it will be used in
1137      * querying the heat pump
1138      */
1139     String tagName;
1140
1141     Unit<?> unit = ONE;
1142
1143     /**
1144      * The heatpump always returns 16-bit integers encoded as ASCII. They need
1145      * to be interpreted according to the context.
1146      * The EcoVent unit returns floating point numbers.
1147      */
1148     public enum Type {
1149         Analog,
1150         Word,
1151         Bitfield,
1152         Float,
1153         Enum
1154     };
1155
1156     /**
1157      * The format of the response of the heat pump
1158      */
1159     Type type = Type.Analog;
1160
1161     /**
1162      * If \c type is Type.Bitfield, this determines the bit number (0-based)
1163      */
1164     int bitnum = 0;
1165
1166     /**
1167      * If type is anything else than {@link Type#Bitfield} this is used as divisor for the scaled integer.
1168      * Defaults to 10 and should be a power of 10 (e.g. 10, 100, 1000).
1169      */
1170     int divisor = 10;
1171
1172     /**
1173      * If \c type is Type.Enum, this defines the meaning of the values (0-based)
1174      */
1175     String[] stringEnum = null;
1176
1177     /**
1178      * @return command name (uses in *.items files)
1179      */
1180     public String getCommand() {
1181         return command;
1182     }
1183
1184     /**
1185      * @return tag name (raw communication with heat pump)
1186      */
1187     public String getTagName() {
1188         return tagName;
1189     }
1190
1191     /**
1192      * @return type: how to interpret the response from the heat pump
1193      */
1194     public Type getType() {
1195         return type;
1196     }
1197
1198     /**
1199      * @return bitnum: if the value is a bit field, this indicates the bit
1200      *         number (0-based)
1201      */
1202     public int getBitNum() {
1203         return bitnum;
1204     }
1205
1206     /**
1207      * @return Divisor for scaled integer analog values.
1208      */
1209     public int getDivisor() {
1210         return divisor;
1211     }
1212
1213     public Unit<?> getUnit() {
1214         return unit;
1215     }
1216
1217     /**
1218      *
1219      * @param bindingConfig
1220      *            command e.g. TYPE_TEMPERATURE_OUTSIDE,..
1221      * @param itemClass
1222      *            class to validate
1223      * @return true if item class can bound to heatpumpCommand
1224      */
1225     // public static boolean validateBinding(EcoTouchTags bindingConfig, Class<? extends Item> itemClass) {
1226     // boolean ret = false;
1227     // for (EcoTouchTags c : EcoTouchTags.values()) {
1228     // if (c.getCommand().equals(bindingConfig.getCommand()) && c.getItemClass().equals(itemClass)) {
1229     // ret = true;
1230     // break;
1231     // }
1232     // }
1233     // return ret;
1234     // }
1235
1236     /**
1237      * Decode a raw value from the heat pump's ethernet interface into a scaled value
1238      * 
1239      * @param rawValue
1240      * @return
1241      */
1242     public BigDecimal decodeValue(String rawValue) {
1243         BigDecimal raw = new BigDecimal(rawValue);
1244         if (type == Type.Bitfield) {
1245             // ignore any scaling from \ref divisor
1246             int value = raw.intValue();
1247             if ((value & (1 << bitnum)) != 0)
1248                 return BigDecimal.ONE;
1249             else
1250                 return BigDecimal.ZERO;
1251         }
1252         BigDecimal result = raw.divide(new BigDecimal(divisor));
1253         return result;
1254     }
1255
1256     /**
1257      * Searches the available heat pump commands and returns the matching one.
1258      *
1259      * @param heatpumpCommand
1260      *            command string e.g. "temperature_outside"
1261      * @return matching EcoTouchTags instance, if available
1262      */
1263     public static EcoTouchTags fromString(String heatpumpCommand) {
1264         if ("".equals(heatpumpCommand)) {
1265             return null;
1266         }
1267         for (EcoTouchTags c : EcoTouchTags.values()) {
1268             if (c.getCommand().equals(heatpumpCommand)) {
1269                 return c;
1270             }
1271         }
1272
1273         throw new IllegalArgumentException("cannot find EcoTouch tag for '" + heatpumpCommand + "'");
1274     }
1275
1276     /**
1277      * Searches the available heat pump commands and returns the first matching
1278      * one.
1279      *
1280      * @param tag
1281      *            raw heatpump tag e.g. "A1"
1282      * @return first matching EcoTouchTags instance, if available
1283      */
1284     public static List<EcoTouchTags> fromTag(String tag) {
1285         List<EcoTouchTags> result = new LinkedList<EcoTouchTags>();
1286         for (EcoTouchTags c : EcoTouchTags.values()) {
1287             if (c.getTagName().equals(tag)) {
1288                 result.add(c);
1289             }
1290         }
1291
1292         return result;
1293     }
1294 }