Skip to content

Allow retrieving values for unknown EPC codes #76

@mjoach

Description

@mjoach

Hi, this is partially related but a distinct issue from the one I opened in the HASS integration repository. I'm new to the Echonet, so apologies if I am confusing some concepts or nomenclature.

I am trying to extract instantaneous energy consumption values from the Multiple Input PCS device (0x02A5) and I realized that it actually hides this information behind an EPC code that is reported by the device but listed as Unknown (0xF5). I had no luck finding any documentation for it in Echonet specs yet, so I am suspecting it may be a device-specific custom field.

Now, the issue is that if I call update() method on the EchonetInstance with the said unlisted 0xF5 code, I will get an empty result, unless this EPC code is explicitly added to epc.py for this device class. This, however, may not be a great idea if it is indeed a manufacturer-specific EPC. So I am wondering if perhaps the update() method should instead be changed to allow for returning responses as long as the EPC code is part of the discovered valid EPC codes? Currently, I got it work by adding the final elif at the bottom, though perhaps it could just entirely replace the elif above it?

** EchonetInstance.py, line 210: **

                elif epc in list(
                    EPC_CODE[self._eojgc][self._eojcc].keys()
                ):  # return hex value if EPC code exists in class but no function found
                    returned_json_data.update(
                        {
                            epc: self._api._state[self._host]["instances"][self._eojgc][
                                self._eojcc
                            ][self._eojci][epc].hex()
                        }
                    )

               #----- added to handle undeclared EPCs ---------
                elif epc in self.getGetProperties(): #return hex value for EPC codes that are Unknown but reported by device
                    returned_json_data.update(
                        {
                            epc: self._api._state[self._host]["instances"][self._eojgc][
                                self._eojcc
                            ][self._eojci][epc].hex()
                        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions