Skip to content

Commit

Permalink
Fix #191 some missing properties
Browse files Browse the repository at this point in the history
Get properties value using the EPC_FUNCTIONS definition of each object class in pychonet
  • Loading branch information
nao-pon committed Aug 29, 2024
1 parent 6d20400 commit 078e067
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 87 deletions.
45 changes: 17 additions & 28 deletions custom_components/echonetlite/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
ENL_OP_CODES,
ENL_SUPER_CODES,
ENL_TIMER_SETTING,
EPC_CODES_FOR_UPDATE,
USER_OPTIONS,
TEMP_OPTIONS,
CONF_BATCH_SIZE_MAX,
Expand Down Expand Up @@ -557,33 +556,23 @@ def _make_update_flags_full_list(self):
CONF_ENABLE_SUPER_ENERGY,
ENABLE_SUPER_ENERGY_DEFAULT.get(self._eojgc, {}).get(self._eojcc, True),
)
# Some classes use predefined data (Narrowed down items)
flags = EPC_CODES_FOR_UPDATE.get(self._eojgc, {}).get(self._eojcc, None)
if flags != None:
flags = list(set(flags) | {ENL_STATUS} | set(ENL_SUPER_CODES.keys()))
if not _enabled_super_energy:
flags = list(
set(flags) - {ENL_INSTANTANEOUS_POWER, ENL_CUMULATIVE_POWER}
)
else:
# For classes where it is not defined
flags = [ENL_STATUS, ENL_TIMER_SETTING]
if (
_enabled_super_energy
or ENL_OP_CODES.get(self._eojgc, {})
.get(self._eojcc, {})
.get(ENL_INSTANTANEOUS_POWER)
or ENL_OP_CODES.get(self._eojgc, {})
.get(self._eojcc, {})
.get(ENL_CUMULATIVE_POWER)
):
flags += [ENL_INSTANTANEOUS_POWER, ENL_CUMULATIVE_POWER]
_epc_keys = set((EPC_CODE[self._eojgc][self._eojcc].keys())) - set(
EPC_SUPER.keys()
)
for item in self._getPropertyMap:
if item in _epc_keys:
flags.append(item)
# General purpose data items
flags = [ENL_STATUS, ENL_TIMER_SETTING]
if (
_enabled_super_energy
or ENL_OP_CODES.get(self._eojgc, {})
.get(self._eojcc, {})
.get(ENL_INSTANTANEOUS_POWER)
or ENL_OP_CODES.get(self._eojgc, {})
.get(self._eojcc, {})
.get(ENL_CUMULATIVE_POWER)
):
flags += [ENL_INSTANTANEOUS_POWER, ENL_CUMULATIVE_POWER]
# Get supported EPC_FUNCTIONS in pychonet object class
_epc_keys = set(self._instance.EPC_FUNCTIONS.keys()) - set(EPC_SUPER.keys())
for item in self._getPropertyMap:
if item in _epc_keys:
flags.append(item)

for value in flags:
if value in self._getPropertyMap:
Expand Down
59 changes: 0 additions & 59 deletions custom_components/echonetlite/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -1224,65 +1224,6 @@
},
}

EPC_CODES_FOR_UPDATE = {
0x01: {
0x30: [
ENL_STATUS,
ENL_FANSPEED,
ENL_AUTO_DIRECTION,
ENL_SWING_MODE,
ENL_AIR_VERT,
ENL_AIR_HORZ,
ENL_HVAC_MODE,
ENL_HVAC_SET_TEMP,
ENL_HVAC_SET_HUMIDITY,
ENL_HVAC_ROOM_HUMIDITY,
ENL_HVAC_ROOM_TEMP,
ENL_HVAC_OUT_TEMP,
ENL_HVAC_SILENT_MODE,
],
},
0x02: {
0x7D: [
0xA0,
0xA1,
0xA8,
0xA9,
0xCF,
0xD0,
0xD3,
0xD6,
0xD8,
0xE2,
0xE4,
0xE5,
0xE6,
],
0x87: [
ENL_DPM_ENG_NOR,
ENL_DPM_ENG_REV,
ENL_DPM_ENG_UNIT,
ENL_DPM_DAY_GET_HISTORY,
ENL_DPM_INSTANT_ENG,
ENL_DPM_INSTANT_CUR,
ENL_DPM_INSTANT_VOL,
ENL_DPM_CHANNEL_SIMPLEX_CUMULATIVE_ENG,
ENL_DPM_CHANNEL_SIMPLEX_INSTANT_ENG,
],
0x88: [
ENL_LVSEEM_ENG_NOR,
ENL_LVSEEM_ENG_REV,
ENL_LVSEEM_INSTANT_ENG,
ENL_LVSEEM_INSTANT_CUR,
ENL_LVSEEM_COEF,
ENL_LVSEEM_ENG_UNIT,
],
0x90: [ENL_BRIGHTNESS, ENL_COLOR_TEMP],
0x91: [ENL_BRIGHTNESS],
0xA3: [ENL_SCENE, ENL_SCENE_MAX],
},
}

ATTR_STATE_ON = "on"
ATTR_STATE_OFF = "off"

Expand Down

0 comments on commit 078e067

Please sign in to comment.