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