tuya / tuya-iot-python-sdk

Tuya IoT Python SDK for Tuya Open API.
MIT License
117 stars 47 forks source link

Returns the modified DPcode #77

Closed Asceticmonk007 closed 11 months ago

Asceticmonk007 commented 11 months ago
def __update_device(self, device: TuyaDevice, DPcode: str, value):
    # await hass.bus.async_fire(event_name, event_data)
    for listener in self.device_listeners:
        listener.update_device(device)     #Returns the modified DPcode

def _on_device_report(self, device_id: str, status: list):
    device = self.device_map.get(device_id, None)
    if not device:
        return
    logger.debug(f"mq _on_device_report-> {status}")
    for item in status:
        if "code" in item and "value" in item:
            code = item["code"]
            value = item["value"]
            device.status[code] = value

    self.__update_device(device)
Asceticmonk007 commented 11 months ago

I think this step should return the modified DPcode and value

Asceticmonk007 commented 11 months ago

I used “tuya_mq.add_message_listener(on_message)” to get out of trouble