gce-electronics / HA_RFPlayer

RFPlayer plugin for Home assistant
Apache License 2.0
27 stars 9 forks source link

Modification rfpparser.py Pour protocole Oregon, Edisio et OWL #9

Closed Doubledom45 closed 2 years ago

Doubledom45 commented 2 years ago

Bonjour, Est-il possible de tester les modes Oregon et Edisio (OWL) avec le fichier modifié ci-dessous, voir #8 pour oregon rfpparser.py.txt Pour les protocoles qui ont plusieurs valeurs de remontées par le Rfplayer j'ai ajouté à l'ID un "0" data["id"]+= "0" Pour la température de Edisio ETS-100 celle-ci est remontée en centième de degré ( a modifier, ou faire modif dans Yaml). Pour Edisio les values sont tester sur le message["infos"]["subTypeMeaning"]

Fichier modifié:

    # Protocols
    message = json.loads(packet.replace("ZIA33", ""))["frame"]
    data["protocol"] = message["header"]["protocolMeaning"]
    if data["protocol"] in ["BLYSS", "CHACON", "JAMMING"]:
        data["id"] = message["infos"]["id"]
        data["command"] = message["infos"]["subType"]
        data["state"] = message["infos"]["subTypeMeaning"]
        packets_found.append(data)

    elif data["protocol"] in ["OREGON"]:
        data["id"] = message["infos"]["adr_channel"]
        data["hardware"] = message["infos"]["id_PHYMeaning"]
        for measure in message["infos"]["measures"]:
            measure_data = data.copy()
            measure_data["command"] = measure["value"]
            measure_data["state"] = measure["value"]
            measure_data["unit"] = measure["unit"]
            measure_data["type"] = measure["type"]
            data["id"]+= "0"
            packets_found.append(measure_data)

    elif data["protocol"] in ["OWL"]:
        data["id"] = message["infos"]["adr_channel"]
        data["hardware"] = message["infos"]["id_PHYMeaning"]
        for measure in message["infos"]["measures"]:
            measure_data = data.copy()
            measure_data["command"] = measure["value"]
            measure_data["state"] = measure["value"]
            measure_data["unit"] = measure["unit"]
            measure_data["type"] = measure["type"]
            data["id"]+= "0"
            packets_found.append(measure_data)

    elif data["protocol"] in ["EDISIO"]:
        data["id"] = message["infos"]["id"]
        data["hardware"] = message["infos"]["infoMeaning"]
        data["state"] = message["infos"]["subTypeMeaning"]
        if data["state"] in ["SET_TEMPERATURE"]:
            data["command"] = message["infos"]["add0"]
        elif data["state"] in ["TOGGLE"]:
            data["command"] = message["infos"]["qualifier"]
        elif data["state"] in ["DIM-A"]:
            data["command"] = message["infos"]["qualifier"]
        else:
            data["command"] = message["infos"]["subType"]
        packets_found.append(data)

    else:
        data["id"] = message["infos"].get("id")
        data["command"] = message["infos"].get("subType")
        packets_found.append(data)

    return packets_found

Serait-il possible de voir pour autoriser l'envoie d'une trame en mode "raw" pour Edisioframe info ci-dessous : EDISIOFRAME action with or without parameters is used to enable asynchronous receiving of Edisio Frames with ZIA66 header. This enabling isn’t saved during shutdown. Examples : Sending an edision Frame (Edisio regular length is 10 bytes but could be longer): ZIA++ EDISIOFRAME 0x06 0x73 0x69 0x34 0x05 0x01 0x1D 0x01 0x00 0x03 Sending an asynchronous edision Frame: ZIA66 EDISIOFRAME 0x06 0x73 0x69 0x34 0x05 0x01 0x1D 0x01 0x00 0x03 Nota that syntax is the same for transmitting and receiving. Receiving is always in Hexadecimal form (with 0x as prefix at each byte). Transmitting uses decimal or Hexadecimal form (with 0x as prefix at each byte for hexadecimal). See below paragraph upon RFPLAYER Edisio Frame.

@+Dom

Aohzan commented 2 years ago

Hello Hésite pas à créer une pull request avec la code modifié, ça facilite :)

Doubledom45 commented 2 years ago

Slt. Il faudrait pouvoir trouver des testeurs pour ce type de Matos. Je crois qu'il faut aussi autoriser ou modifier le type de "send" sans le protocole pour EDISIOFRAME (si tu as vu l'info au-dessus), et aussi modifier l'origine du protocole qui n'existe pas pour ce type mais qui est directement dans la commande (qui n'est pas défini non plus dans le prog), je pense plus tôt de pouvoir autoriser un mode "raw" brut Assez compliqué de reprendre un prog comme celui-ci qui est une "copie" du Rflink. Je comprends pas trop pourquoi la dernière Api 1.8 est tronquée est-ce volontaire de @gce-electronics ?

   async def async_send_command(call):
        """Send Rfplayer command."""
        _LOGGER.debug("Rfplayer send command for %s", str(call.data))
        if not await hass.data[DOMAIN][RFPLAYER_PROTOCOL].send_command_ack(
            call.data[CONF_PROTOCOL],
            call.data[CONF_COMMAND],
            device_address=call.data.get(CONF_DEVICE_ADDRESS),
            device_id=call.data.get(CONF_DEVICE_ID),
        ):
            _LOGGER.error("Failed Rfplayer command")
        if call.data[CONF_AUTOMATIC_ADD] is True:
            _LOGGER.debug("Add device for %s", str(call.data))
            event_id = "_".join(
                [
                    call.data[CONF_PROTOCOL],
                    call.data.get(CONF_DEVICE_ID) or call.data.get(
                        CONF_DEVICE_ADDRESS),
                ]
            )
            device = {
                CONF_PROTOCOL: call.data[CONF_PROTOCOL],
                CONF_DEVICE_ADDRESS: call.data.get(CONF_DEVICE_ADDRESS),
                CONF_DEVICE_ID: call.data.get(CONF_DEVICE_ID),
                EVENT_KEY_COMMAND: True,
                EVENT_KEY_ID: event_id,

PS: [Bon OK voir Béta 14 en cours]()