|
| 1 | +import "@ebusd/ebus-typespec"; |
| 2 | +import "./_templates.tsp"; |
| 3 | +using Ebus; |
| 4 | +using Ebus.Num; |
| 5 | +using Ebus.Str; |
| 6 | +namespace Vaillant; |
| 7 | + |
| 8 | +/** b516 energy statistics */ |
| 9 | +namespace B516_inc { |
| 10 | + @base(MF, 0x16, 0x10) |
| 11 | + model rc { |
| 12 | + // @out |
| 13 | + // @values(Values_period) |
| 14 | + // period: UCH; |
| 15 | + // @out |
| 16 | + // @constValue(0xffff) |
| 17 | + // ign2: UIN; |
| 18 | + /** the energy source */ |
| 19 | + @out |
| 20 | + @values(Values_source) |
| 21 | + source: UCH; |
| 22 | + |
| 23 | + /** the energy usage */ |
| 24 | + @out |
| 25 | + @values(Values_usage) |
| 26 | + usage: UCH; |
| 27 | + } |
| 28 | + |
| 29 | + @inherit(rc) |
| 30 | + @ext( |
| 31 | + 3, // period=year |
| 32 | + 0xff, 0xff // fix value |
| 33 | + ) |
| 34 | + model StatEnergySumYear { |
| 35 | + // according to #490 and #504: |
| 36 | + // hex digits MDYY with M=month*2 (or 0 for year period), D=day of month (or 0 for year/month period), YY=year*2 since 2000 (or 0 for total) |
| 37 | + // i.e. bits (rev): yyyyyyy mmmm ddddd |
| 38 | + // e.g. 0x3257 = 0b0011001 0010 10111 = 2025-02-23 |
| 39 | + // e.g. 0x3180 = 0b0011000 1100 00000 = 2024-12-00 |
| 40 | + // @out |
| 41 | + // date: UIN; // would require a new base datatype |
| 42 | + @out |
| 43 | + @constValue(0) |
| 44 | + ign2: UCH; // ignored M+D for period=year |
| 45 | + |
| 46 | + /** the year as offset from 2000 */ |
| 47 | + @out |
| 48 | + @divisor(2) |
| 49 | + year: UCH; // upper 7 bits of YY (with divisor) |
| 50 | + |
| 51 | + @maxLength(7) |
| 52 | + ign: IGN; // repeats the query (more or less) |
| 53 | + |
| 54 | + value: energye; |
| 55 | + } |
| 56 | + |
| 57 | + enum Values_period { |
| 58 | + total: 0, |
| 59 | + day: 1, |
| 60 | + month: 2, |
| 61 | + year: 3, |
| 62 | + } |
| 63 | + |
| 64 | + enum Values_source { |
| 65 | + solar: 1, |
| 66 | + environment: 2, |
| 67 | + electricity: 3, |
| 68 | + gas: 4, |
| 69 | + } |
| 70 | + |
| 71 | + enum Values_usage { |
| 72 | + all: 0, |
| 73 | + heat: 2, |
| 74 | + water: 4, |
| 75 | + cool: 5, |
| 76 | + } |
| 77 | + |
| 78 | + @base(MF, 0x16, 0x10, |
| 79 | + 0, // period=total |
| 80 | + 0xff, 0xff // fix value |
| 81 | + ) |
| 82 | + model r { |
| 83 | + @maxLength(7) |
| 84 | + ign: IGN; |
| 85 | + } |
| 86 | + |
| 87 | + @inherit(r) |
| 88 | + @ext(1, 0, 0, 0) |
| 89 | + model StatSolarEnergySum { |
| 90 | + value: energye; |
| 91 | + } |
| 92 | + |
| 93 | + @inherit(r) |
| 94 | + @ext(1, 0x03, 0, 0) |
| 95 | + model StatSolarEnergySumHc { |
| 96 | + value: energye; |
| 97 | + } |
| 98 | + |
| 99 | + @inherit(r) |
| 100 | + @ext(1, 0x04, 0, 0) |
| 101 | + model StatSolarEnergySumHwc { |
| 102 | + value: energye; |
| 103 | + } |
| 104 | + |
| 105 | + @inherit(r) |
| 106 | + @ext(0x02, 0, 0, 0) |
| 107 | + model StatEnvironmentEnergySum { |
| 108 | + value: energye; |
| 109 | + } |
| 110 | + |
| 111 | + @inherit(r) |
| 112 | + @ext(0x02, 0x03, 0, 0) |
| 113 | + model StatEnvironmentEnergySumHc { |
| 114 | + value: energye; |
| 115 | + } |
| 116 | + |
| 117 | + @inherit(r) |
| 118 | + @ext(0x02, 0x04, 0, 0) |
| 119 | + model StatEnvironmentEnergySumHwc { |
| 120 | + value: energye; |
| 121 | + } |
| 122 | + |
| 123 | + @inherit(r) |
| 124 | + @ext(0x02, 0x05, 0, 0) |
| 125 | + model StatEnvironmentEnergySumCool { |
| 126 | + value: energye; |
| 127 | + } |
| 128 | + |
| 129 | + @inherit(r) |
| 130 | + @ext(0x03, 0, 0, 0) |
| 131 | + model StatElectricEnergySum { |
| 132 | + value: energye; |
| 133 | + } |
| 134 | + |
| 135 | + @inherit(r) |
| 136 | + @ext(0x03, 0x03, 0, 0) |
| 137 | + model StatElectricEnergySumHc { |
| 138 | + value: energye; |
| 139 | + } |
| 140 | + |
| 141 | + @inherit(r) |
| 142 | + @ext(0x03, 0x04, 0, 0) |
| 143 | + model StatElectricEnergySumHwc { |
| 144 | + value: energye; |
| 145 | + } |
| 146 | + |
| 147 | + @inherit(r) |
| 148 | + @ext(0x03, 0x05, 0, 0) |
| 149 | + model StatElectricEnergySumCool { |
| 150 | + value: energye; |
| 151 | + } |
| 152 | + |
| 153 | + @inherit(r) |
| 154 | + @ext(0x04, 0, 0, 0) |
| 155 | + model StatFuelSum { |
| 156 | + value: energye; |
| 157 | + } |
| 158 | + |
| 159 | + @inherit(r) |
| 160 | + @ext(0x04, 0x03, 0, 0) |
| 161 | + model StatFuelSumHc { |
| 162 | + value: energye; |
| 163 | + } |
| 164 | + |
| 165 | + @inherit(r) |
| 166 | + @ext(0x04, 0x04, 0, 0) |
| 167 | + model StatFuelSumHwc { |
| 168 | + value: energye; |
| 169 | + } |
| 170 | +} |
0 commit comments