Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property value in the EPC_FUNCTIONS constant #67

Closed
nao-pon opened this issue Jan 29, 2024 · 0 comments
Closed

Property value in the EPC_FUNCTIONS constant #67

nao-pon opened this issue Jan 29, 2024 · 0 comments

Comments

@nao-pon
Copy link
Collaborator

nao-pon commented Jan 29, 2024

I'm working on including a property value in the EPC_FUNCTIONS constant.

It is possible to simplify the ENL_OP_CODES definition by referencing EPC_FUNCTIONS on the echonetlite integration side.

for example. . .

  • pychonet/ElectricBlind.py
class ElectricBlind(EchonetInstance):
    EPC_FUNCTIONS = {
        0xE0: [
            _int,
            {
                0x41: "open",
                0x42: "close",
                0x43: "stop",
            },
        ],
    }
  • echonetlite/const.py
            0xE0: {
                CONF_ICON: "mdi:roller-shade",
                CONF_ICONS: {
                    OPEN: "mdi:roller-shade",
                    CLOSE: "mdi:roller-shade-closed",
                    STOP: "mdi:roller-shade",
                },
                # TYPE_SELECT: {OPEN: 0x41, CLOSE: 0x42, STOP: 0x43},
                TYPE_SELECT: True,
            }
  • echonetlite/select.py
        if type(options[TYPE_SELECT]) == dict:
            self._options = options[TYPE_SELECT]
        else:
            # Read from _instance.EPC FUNCTIONS definition
            # Swap key, value of _instance.EPC_FUNCTIONS[opc][1]
            self._options = {
                v: k for k, v in connector._instance.EPC_FUNCTIONS[code][1].items()
            }
nao-pon added a commit to nao-pon/pychonet that referenced this issue Jan 30, 2024
nao-pon added a commit to nao-pon/pychonet that referenced this issue Jan 31, 2024
nao-pon added a commit that referenced this issue Feb 3, 2024
* Property value in the EPC_FUNCTIONS constant

Rel. #67

* Adjustment of status wording
nao-pon added a commit that referenced this issue Feb 3, 2024
@nao-pon nao-pon closed this as completed Feb 3, 2024
nao-pon added a commit to nao-pon/pychonet that referenced this issue Feb 23, 2024
nao-pon added a commit that referenced this issue Feb 23, 2024
rel. #67, EPC_SUPER_FUNCTION too process
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant