Skip to content

Commit

Permalink
Some meter ids on kaifa have 7 byte data. (#89)
Browse files Browse the repository at this point in the history
* Some meter ids on kaifa have 7 byte data.

* Update manifest.json

Update version
  • Loading branch information
turbokongen authored Nov 1, 2022
1 parent 23ed817 commit 1aa1a7f
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 38 deletions.
2 changes: 1 addition & 1 deletion custom_components/ams/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"codeowners": ["@turbokongen"],
"requirements": ["pyserial==3.5", "crccheck==1.0"],
"config_flow": true,
"version": "1.9.6",
"version": "1.9.7",
"iot_class": "local_push"
}
84 changes: 51 additions & 33 deletions custom_components/ams/parsers/kaifa.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,28 @@ def parse_data(stored, data, swedish = False):

han_data[HAN_LIST_VER_ID] = field_type(fields=pkt[35:42], enc=chr)
han_data[HAN_METER_SERIAL] = field_type(fields=pkt[44:60], enc=chr)
_LOGGER.debug("kaifa meter_type length is %s", pkt[61])
_offset = 0
if pkt[61] == 7:
_LOGGER.debug("set kaifa _offset to 1")
_offset = 1
han_data[HAN_METER_TYPE] = (
METER_TYPE.get(field_type(fields=pkt[62:70], enc=chr), UNKNOWN_METER)
METER_TYPE.get(field_type(fields=pkt[62:70 - _offset], enc=chr), UNKNOWN_METER)
)
han_data["active_power_n"] = byte_decode(fields=pkt[76:80]) / 100
han_data["active_power_p"] = byte_decode(fields=pkt[70:74])
sensor_data["ams_active_power_import"] = {
SENSOR_STATE: han_data["active_power_p"],
SENSOR_ATTR: {
"timestamp": han_data["date_time"],
HAN_METER_MANUFACTURER: han_data[
HAN_LIST_VER_ID].title(),
HAN_METER_TYPE: han_data[HAN_METER_TYPE],
HAN_METER_SERIAL: han_data[HAN_METER_SERIAL],
SENSOR_UOM: "W",
SENSOR_ICON: "mdi:gauge",
},
}
han_data["active_power_n"] = byte_decode(fields=pkt[76 - _offset:80 - _offset]) / 100
sensor_data["ams_active_power_export"] = {
SENSOR_STATE: han_data["active_power_n"],
SENSOR_ATTR: {
Expand All @@ -105,7 +123,7 @@ def parse_data(stored, data, swedish = False):
SENSOR_ICON: "mdi:gauge",
},
}
han_data["reactive_power_p"] = byte_decode(fields=pkt[81:85])
han_data["reactive_power_p"] = byte_decode(fields=pkt[81 - _offset:85 - _offset])
sensor_data["ams_reactive_power_import"] = {
SENSOR_STATE: han_data["reactive_power_p"],
SENSOR_ATTR: {
Expand All @@ -118,7 +136,7 @@ def parse_data(stored, data, swedish = False):
SENSOR_ICON: "mdi:gauge",
},
}
han_data["reactive_power_n"] = byte_decode(fields=pkt[86:90])
han_data["reactive_power_n"] = byte_decode(fields=pkt[86 - _offset:90 - _offset])
sensor_data["ams_reactive_power_export"] = {
SENSOR_STATE: han_data["reactive_power_n"],
SENSOR_ATTR: {
Expand All @@ -131,7 +149,7 @@ def parse_data(stored, data, swedish = False):
SENSOR_ICON: "mdi:gauge",
},
}
han_data["current_l1"] = byte_decode(fields=pkt[91:95]) / 1000
han_data["current_l1"] = byte_decode(fields=pkt[91 - _offset:95 - _offset]) / 1000
sensor_data["ams_current_l1"] = {
SENSOR_STATE: han_data["current_l1"],
SENSOR_ATTR: {
Expand All @@ -147,7 +165,7 @@ def parse_data(stored, data, swedish = False):

if (list_type is LIST_TYPE_SHORT_3PH or
list_type is LIST_TYPE_LONG_3PH):
han_data["current_l2"] = byte_decode(fields=pkt[96:100]) / 1000
han_data["current_l2"] = byte_decode(fields=pkt[96 - _offset:100 - _offset]) / 1000
sensor_data["ams_current_l2"] = {
SENSOR_STATE: han_data["current_l2"],
SENSOR_ATTR: {
Expand All @@ -160,7 +178,7 @@ def parse_data(stored, data, swedish = False):
SENSOR_ICON: "mdi:current-ac",
},
}
han_data["current_l3"] = byte_decode(fields=pkt[101:105]) / 1000
han_data["current_l3"] = byte_decode(fields=pkt[101 - _offset:105 - _offset]) / 1000
sensor_data["ams_current_l3"] = {
SENSOR_STATE: han_data["current_l3"],
SENSOR_ATTR: {
Expand All @@ -173,7 +191,7 @@ def parse_data(stored, data, swedish = False):
SENSOR_ICON: "mdi:current-ac",
},
}
han_data["voltage_l1"] = byte_decode(fields=pkt[106:110]) / 10
han_data["voltage_l1"] = byte_decode(fields=pkt[106 - _offset:110 - _offset]) / 10
sensor_data["ams_voltage_l1"] = {
SENSOR_STATE: han_data["voltage_l1"],
SENSOR_ATTR: {
Expand All @@ -186,7 +204,7 @@ def parse_data(stored, data, swedish = False):
SENSOR_ICON: "mdi:flash",
},
}
han_data["voltage_l2"] = byte_decode(fields=pkt[111:115]) / 10
han_data["voltage_l2"] = byte_decode(fields=pkt[111 - _offset:115 - _offset]) / 10
sensor_data["ams_voltage_l2"] = {
SENSOR_STATE: han_data["voltage_l2"],
SENSOR_ATTR: {
Expand All @@ -199,7 +217,7 @@ def parse_data(stored, data, swedish = False):
SENSOR_ICON: "mdi:flash",
},
}
han_data["voltage_l3"] = byte_decode(fields=pkt[116:120]) / 10
han_data["voltage_l3"] = byte_decode(fields=pkt[116 - _offset:120 - _offset]) / 10
sensor_data["ams_voltage_l3"] = {
SENSOR_STATE: han_data["voltage_l3"],
SENSOR_ATTR: {
Expand All @@ -213,14 +231,14 @@ def parse_data(stored, data, swedish = False):
},
}
if list_type == LIST_TYPE_LONG_3PH:
meter_date_time_year = byte_decode(fields=pkt[122:124], count=2)
meter_date_time_month = pkt[124]
meter_date_time_date = pkt[125]
meter_date_time_year = byte_decode(fields=pkt[122 - _offset:124 - _offset], count=2)
meter_date_time_month = pkt[124 - _offset]
meter_date_time_date = pkt[125 - _offset]
han_data[HAN_METER_DAYOFWEEK] = WEEKDAY_MAPPING.get(
pkt[126])
meter_date_time_hour = str(pkt[127]).zfill(2)
meter_date_time_minute = str(pkt[128]).zfill(2)
meter_date_time_seconds = str(pkt[129]).zfill(2)
pkt[126 - _offset])
meter_date_time_hour = str(pkt[127 - _offset]).zfill(2)
meter_date_time_minute = str(pkt[128 - _offset]).zfill(2)
meter_date_time_seconds = str(pkt[129 - _offset]).zfill(2)
han_data[HAN_METER_DATETIME] = (
str(meter_date_time_year)
+ "-"
Expand All @@ -235,7 +253,7 @@ def parse_data(stored, data, swedish = False):
+ meter_date_time_seconds
)
han_data["active_energy_p"] = (
byte_decode(fields=pkt[135:139]) / 1000
byte_decode(fields=pkt[135 - _offset:139 - _offset]) / 1000
)
sensor_data["ams_active_energy_import"] = {
SENSOR_STATE: han_data["active_energy_p"],
Expand All @@ -255,7 +273,7 @@ def parse_data(stored, data, swedish = False):
},
}
han_data["active_energy_n"] = (
byte_decode(fields=pkt[140:144]) / 1000
byte_decode(fields=pkt[140 - _offset:144 - _offset]) / 1000
)
sensor_data["ams_active_energy_export"] = {
SENSOR_STATE: han_data["active_energy_n"],
Expand All @@ -275,7 +293,7 @@ def parse_data(stored, data, swedish = False):
},
}
han_data["reactive_energy_p"] = (
byte_decode(fields=pkt[145:149]) / 1000
byte_decode(fields=pkt[145 - _offset:149 - _offset]) / 1000
)
sensor_data["ams_reactive_energy_import"] = {
SENSOR_STATE: han_data["reactive_energy_p"],
Expand All @@ -295,7 +313,7 @@ def parse_data(stored, data, swedish = False):
},
}
han_data["reactive_energy_n"] = (
byte_decode(fields=pkt[150:154]) / 1000
byte_decode(fields=pkt[150 - _offset:154 - _offset]) / 1000
)
sensor_data["ams_reactive_energy_export"] = {
SENSOR_STATE: han_data["reactive_energy_n"],
Expand All @@ -318,7 +336,7 @@ def parse_data(stored, data, swedish = False):
if (list_type is LIST_TYPE_SHORT_1PH or
list_type is LIST_TYPE_LONG_1PH):

han_data["voltage_l1"] = byte_decode(fields=pkt[96:100]) / 10
han_data["voltage_l1"] = byte_decode(fields=pkt[96 - _offset:100 - _offset]) / 10
sensor_data["ams_voltage_l1"] = {
SENSOR_STATE: han_data["voltage_l1"],
SENSOR_ATTR: {
Expand All @@ -333,14 +351,14 @@ def parse_data(stored, data, swedish = False):
}

if list_type == LIST_TYPE_LONG_1PH:
meter_date_time_year = byte_decode(fields=pkt[102:104], count=2)
meter_date_time_month = pkt[104]
meter_date_time_date = pkt[105]
meter_date_time_year = byte_decode(fields=pkt[102 - _offset:104 - _offset], count=2)
meter_date_time_month = pkt[104 - _offset]
meter_date_time_date = pkt[105 - _offset]
han_data[HAN_METER_DAYOFWEEK] = WEEKDAY_MAPPING.get(
pkt[106])
meter_date_time_hour = str(pkt[107]).zfill(2)
meter_date_time_minute = str(pkt[108]).zfill(2)
meter_date_time_seconds = str(pkt[109]).zfill(2)
pkt[106 - _offset])
meter_date_time_hour = str(pkt[107 - _offset]).zfill(2)
meter_date_time_minute = str(pkt[108 - _offset]).zfill(2)
meter_date_time_seconds = str(pkt[109 - _offset]).zfill(2)
han_data[HAN_METER_DATETIME] = (
str(meter_date_time_year)
+ "-"
Expand All @@ -355,7 +373,7 @@ def parse_data(stored, data, swedish = False):
+ meter_date_time_seconds
)
han_data["active_energy_p"] = (
byte_decode(fields=pkt[115:119]) / 1000
byte_decode(fields=pkt[115 - _offset:119 - _offset]) / 1000
)
sensor_data["ams_active_energy_import"] = {
SENSOR_STATE: han_data["active_energy_p"],
Expand All @@ -375,7 +393,7 @@ def parse_data(stored, data, swedish = False):
},
}
han_data["active_energy_n"] = (
byte_decode(fields=pkt[120:124]) / 1000
byte_decode(fields=pkt[120 - _offset:124 - _offset]) / 1000
)
sensor_data["ams_active_energy_export"] = {
SENSOR_STATE: han_data["active_energy_n"],
Expand All @@ -395,7 +413,7 @@ def parse_data(stored, data, swedish = False):
},
}
han_data["reactive_energy_p"] = (
byte_decode(fields=pkt[125:129]) / 1000
byte_decode(fields=pkt[125 - _offset:129 - _offset]) / 1000
)
sensor_data["ams_reactive_energy_import"] = {
SENSOR_STATE: han_data["reactive_energy_p"],
Expand All @@ -415,7 +433,7 @@ def parse_data(stored, data, swedish = False):
},
}
han_data["reactive_energy_n"] = (
byte_decode(fields=pkt[130:134]) / 1000
byte_decode(fields=pkt[130 - _offset:134 - _offset]) / 1000
)
sensor_data["ams_reactive_energy_export"] = {
SENSOR_STATE: han_data["reactive_energy_n"],
Expand Down
12 changes: 8 additions & 4 deletions custom_components/ams/tests/parser_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@
from custom_components.ams import AmsHub
from custom_components.ams.const import DOMAIN

METERTYPE = aidon_se # Input parser to use
METERTYPE = kaifa # Input parser to use
SWEDISH = None
# MA304H4
# MA304H4(SE)
# PACKAGE = [126, 161, 29, 1, 0, 1, 16, 176, 174, 230, 231, 0, 15, 64, 0, 0, 0, 0, 2, 36, 9, 6, 1, 0, 0, 2, 129, 255, 9, 7, 75, 70, 77, 95, 48, 48, 49, 9, 6, 0, 0, 96, 1, 0, 255, 9, 16, 55, 51, 52, 48, 49, 53, 55, 48, 51, 48, 53, 52, 56, 51, 48, 48, 9, 6, 0, 0, 96, 1, 7, 255, 9, 7, 77, 65, 51, 48, 52, 72, 52, 9, 6, 1, 0, 1, 7, 0, 255, 6, 0, 0, 1, 41, 9, 6, 1, 0, 2, 7, 0, 255, 6, 0, 0, 0, 0, 9, 6, 1, 0, 3, 7, 0, 255, 6, 0, 0, 0, 0, 9, 6, 1, 0, 4, 7, 0, 255, 6, 0, 0, 0, 107, 9, 6, 1, 0, 31, 7, 0, 255, 6, 0, 0, 2, 104, 9, 6, 1, 0, 51, 7, 0, 255, 6, 0, 0, 2, 17, 9, 6, 1, 0, 71, 7, 0, 255, 6, 0, 0, 2, 46, 9, 6, 1, 0, 32, 7, 0, 255, 6, 0, 0, 9, 50, 9, 6, 1, 0, 52, 7, 0, 255, 6, 0, 0, 9, 65, 9, 6, 1, 0, 72, 7, 0, 255, 6, 0, 0, 9, 48, 9, 6, 0, 0, 1, 0, 0, 255, 9, 12, 7, 230, 10, 15, 6, 15, 8, 15, 255, 255, 196, 0, 9, 6, 1, 0, 1, 8, 0, 255, 6, 0, 148, 130, 99, 9, 6, 1, 0, 2, 8, 0, 255, 6, 0, 0, 0, 0, 9, 6, 1, 0, 3, 8, 0, 255, 6, 0, 1, 47, 198, 9, 6, 1, 0, 4, 8, 0, 255, 6, 0, 19, 107, 43, 188, 84, 126]
# MA304H4D
# PACKAGE = [126, 160, 155, 1, 0, 1, 16, 86, 27, 230, 231, 0, 15, 64, 0, 0, 0, 9, 12, 7, 230, 9, 18, 7, 14, 56, 15, 255, 128, 0, 0, 2, 18, 9, 7, 75, 70, 77, 95, 48, 48, 49, 9, 16, 55, 51, 52, 48, 49, 53, 55, 48, 49, 49, 50, 55, 52, 53, 51, 50, 9, 8, 77, 65, 51, 48, 52, 72, 52, 68, 6, 0, 0, 6, 54, 6, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6, 0, 0, 1, 208, 6, 0, 0, 2, 212, 6, 0, 0, 16, 217, 6, 0, 0, 9, 187, 6, 0, 0, 8, 235, 6, 0, 0, 9, 2, 6, 0, 0, 8, 251, 9, 12, 7, 230, 9, 18, 7, 14, 56, 15, 255, 128, 0, 0, 6, 8, 166, 101, 185, 6, 0, 0, 0, 0, 6, 2, 217, 43, 105, 6, 0, 34, 14, 106, 197, 201, 126]
PACKAGE = [126, 162, 67, 65, 8, 131, 19, 133, 235, 230, 231, 0, 15, 64, 0, 0, 0, 0, 1, 27, 2, 2, 9, 6, 0, 0, 1, 0, 0, 255, 9, 12, 7, 230, 10, 16, 0, 16, 14, 10, 255, 128, 0, 255, 2, 3, 9, 6, 1, 0, 1, 7, 0, 255, 6, 0, 0, 2, 248, 2, 2, 15, 0, 22, 27, 2, 3, 9, 6, 1, 0, 2, 7, 0, 255, 6, 0, 0, 0, 0, 2, 2, 15, 0, 22, 27, 2, 3, 9, 6, 1, 0, 3, 7, 0, 255, 6, 0, 0, 0, 0, 2, 2, 15, 0, 22, 29, 2, 3, 9, 6, 1, 0, 4, 7, 0, 255, 6, 0, 0, 4, 16, 2, 2, 15, 0, 22, 29, 2, 3, 9, 6, 1, 0, 31, 7, 0, 255, 16, 255, 246, 2, 2, 15, 255, 22, 33, 2, 3, 9, 6, 1, 0, 51, 7, 0, 255, 16, 0, 23, 2, 2, 15, 255, 22, 33, 2, 3, 9, 6, 1, 0, 71, 7, 0, 255, 16, 0, 24, 2, 2, 15, 255, 22, 33, 2, 3, 9, 6, 1, 0, 32, 7, 0, 255, 18, 9, 44, 2, 2, 15, 255, 22, 35, 2, 3, 9, 6, 1, 0, 52, 7, 0, 255, 18, 9, 57, 2, 2, 15, 255, 22, 35, 2, 3, 9, 6, 1, 0, 72, 7, 0, 255, 18, 9, 74, 2, 2, 15, 255, 22, 35, 2, 3, 9, 6, 1, 0, 21, 7, 0, 255, 6, 0, 0, 0, 0, 2, 2, 15, 0, 22, 27, 2, 3, 9, 6, 1, 0, 22, 7, 0, 255, 6, 0, 0, 0, 39, 2, 2, 15, 0, 22, 27, 2, 3, 9, 6, 1, 0, 23, 7, 0, 255, 6, 0, 0, 0, 0, 2, 2, 15, 0, 22, 29, 2, 3, 9, 6, 1, 0, 24, 7, 0, 255, 6, 0, 0, 0, 242, 2, 2, 15, 0, 22, 29, 2, 3, 9, 6, 1, 0, 41, 7, 0, 255, 6, 0, 0, 1, 123, 2, 2, 15, 0, 22, 27, 2, 3, 9, 6, 1, 0, 42, 7, 0, 255, 6, 0, 0, 0, 0, 2, 2, 15, 0, 22, 27, 2, 3, 9, 6, 1, 0, 43, 7, 0, 255, 6, 0, 0, 0, 0, 2, 2, 15, 0, 22, 29, 2, 3, 9, 6, 1, 0, 44, 7, 0, 255, 6, 0, 0, 1, 132, 2, 2, 15, 0, 22, 29, 2, 3, 9, 6, 1, 0, 61, 7, 0, 255, 6, 0, 0, 1, 165, 2, 2, 15, 0, 22, 27, 2, 3, 9, 6, 1, 0, 62, 7, 0, 255, 6, 0, 0, 0, 0, 2, 2, 15, 0, 22, 27, 2, 3, 9, 6, 1, 0, 63, 7, 0, 255, 6, 0, 0, 0, 0, 2, 2, 15, 0, 22, 29, 2, 3, 9, 6, 1, 0, 64, 7, 0, 255, 6, 0, 0, 1, 147, 2, 2, 15, 0, 22, 29, 2, 3, 9, 6, 1, 0, 1, 8, 0, 255, 6, 2, 71, 16, 87, 2, 2, 15, 0, 22, 30, 2, 3, 9, 6, 1, 0, 2, 8, 0, 255, 6, 0, 151, 1, 103, 2, 2, 15, 0, 22, 30, 2, 3, 9, 6, 1, 0, 3, 8, 0, 255, 6, 0, 1, 85, 202, 2, 2, 15, 0, 22, 32, 2, 3, 9, 6, 1, 0, 4, 8, 0, 255, 6, 0, 143, 201, 175, 2, 2, 15, 0, 22, 32, 106, 221, 126]
#PACKAGE = [126, 162, 67, 65, 8, 131, 19, 133, 235, 230, 231, 0, 15, 64, 0, 0, 0, 0, 1, 27, 2, 2, 9, 6, 0, 0, 1, 0, 0, 255, 9, 12, 7, 230, 10, 16, 0, 16, 14, 10, 255, 128, 0, 255, 2, 3, 9, 6, 1, 0, 1, 7, 0, 255, 6, 0, 0, 2, 248, 2, 2, 15, 0, 22, 27, 2, 3, 9, 6, 1, 0, 2, 7, 0, 255, 6, 0, 0, 0, 0, 2, 2, 15, 0, 22, 27, 2, 3, 9, 6, 1, 0, 3, 7, 0, 255, 6, 0, 0, 0, 0, 2, 2, 15, 0, 22, 29, 2, 3, 9, 6, 1, 0, 4, 7, 0, 255, 6, 0, 0, 4, 16, 2, 2, 15, 0, 22, 29, 2, 3, 9, 6, 1, 0, 31, 7, 0, 255, 16, 255, 246, 2, 2, 15, 255, 22, 33, 2, 3, 9, 6, 1, 0, 51, 7, 0, 255, 16, 0, 23, 2, 2, 15, 255, 22, 33, 2, 3, 9, 6, 1, 0, 71, 7, 0, 255, 16, 0, 24, 2, 2, 15, 255, 22, 33, 2, 3, 9, 6, 1, 0, 32, 7, 0, 255, 18, 9, 44, 2, 2, 15, 255, 22, 35, 2, 3, 9, 6, 1, 0, 52, 7, 0, 255, 18, 9, 57, 2, 2, 15, 255, 22, 35, 2, 3, 9, 6, 1, 0, 72, 7, 0, 255, 18, 9, 74, 2, 2, 15, 255, 22, 35, 2, 3, 9, 6, 1, 0, 21, 7, 0, 255, 6, 0, 0, 0, 0, 2, 2, 15, 0, 22, 27, 2, 3, 9, 6, 1, 0, 22, 7, 0, 255, 6, 0, 0, 0, 39, 2, 2, 15, 0, 22, 27, 2, 3, 9, 6, 1, 0, 23, 7, 0, 255, 6, 0, 0, 0, 0, 2, 2, 15, 0, 22, 29, 2, 3, 9, 6, 1, 0, 24, 7, 0, 255, 6, 0, 0, 0, 242, 2, 2, 15, 0, 22, 29, 2, 3, 9, 6, 1, 0, 41, 7, 0, 255, 6, 0, 0, 1, 123, 2, 2, 15, 0, 22, 27, 2, 3, 9, 6, 1, 0, 42, 7, 0, 255, 6, 0, 0, 0, 0, 2, 2, 15, 0, 22, 27, 2, 3, 9, 6, 1, 0, 43, 7, 0, 255, 6, 0, 0, 0, 0, 2, 2, 15, 0, 22, 29, 2, 3, 9, 6, 1, 0, 44, 7, 0, 255, 6, 0, 0, 1, 132, 2, 2, 15, 0, 22, 29, 2, 3, 9, 6, 1, 0, 61, 7, 0, 255, 6, 0, 0, 1, 165, 2, 2, 15, 0, 22, 27, 2, 3, 9, 6, 1, 0, 62, 7, 0, 255, 6, 0, 0, 0, 0, 2, 2, 15, 0, 22, 27, 2, 3, 9, 6, 1, 0, 63, 7, 0, 255, 6, 0, 0, 0, 0, 2, 2, 15, 0, 22, 29, 2, 3, 9, 6, 1, 0, 64, 7, 0, 255, 6, 0, 0, 1, 147, 2, 2, 15, 0, 22, 29, 2, 3, 9, 6, 1, 0, 1, 8, 0, 255, 6, 2, 71, 16, 87, 2, 2, 15, 0, 22, 30, 2, 3, 9, 6, 1, 0, 2, 8, 0, 255, 6, 0, 151, 1, 103, 2, 2, 15, 0, 22, 30, 2, 3, 9, 6, 1, 0, 3, 8, 0, 255, 6, 0, 1, 85, 202, 2, 2, 15, 0, 22, 32, 2, 3, 9, 6, 1, 0, 4, 8, 0, 255, 6, 0, 143, 201, 175, 2, 2, 15, 0, 22, 32, 106, 221, 126]
# MA304H4 (NO)Long
#PACKAGE = [126, 160, 120, 1, 2, 1, 16, 196, 152, 230, 231, 0, 15, 64, 0, 0, 0, 9, 12, 7, 230, 10, 29, 6, 19, 59, 0, 255, 128, 0, 0, 2, 13, 9, 7, 75, 70, 77, 95, 48, 48, 49, 9, 16, 54, 57, 55, 48, 54, 51, 49, 52, 48, 50, 48, 53, 53, 51, 56, 53, 9, 7, 77, 65, 51, 48, 52, 72, 52, 6, 0, 0, 5, 138, 6, 0, 0, 0, 0, 6, 0, 0, 0, 0, 6, 0, 0, 1, 119, 6, 0, 0, 6, 147, 6, 0, 0, 6, 215, 6, 0, 0, 12, 32, 6, 0, 0, 9, 104, 6, 0, 0, 9, 100, 6, 0, 0, 9, 55, 184, 196, 126]
# MA304H4 (NO)Short
PACKAGE = [126, 160, 39, 1, 2, 1, 16, 90, 135, 230, 231, 0, 15, 64, 0, 0, 0, 9, 12, 7, 230, 10, 29, 6, 19, 58, 56, 255, 128, 0, 0, 2, 1, 6, 0, 0, 5, 135, 240, 224, 126]
PKG = []
for item in PACKAGE:
PKG.append(hex(item)[2:].zfill(2))
Expand Down Expand Up @@ -61,7 +65,7 @@
if SWEDISH:
meter_data, _ = METERTYPE.parse_data(sensor_data, PACKAGE, SWEDISH)
else:
meter_data, _ = METERTYPE.parse_data(sensor_data, PACKAGE)
meter_data, _ = METERTYPE.parse_data(sensor_data, PACKAGE, swedish = False)
print("Checking for missing attributes")
print(type(meter_data))
config = {
Expand Down

0 comments on commit 1aa1a7f

Please sign in to comment.