Git Product home page Git Product logo

Comments (4)

csacre avatar csacre commented on July 28, 2024

Extract with Trace

2020-07-11 16:58:55 DEBUG (ZiGate-Listen) [zigate] Raw packet received, b'\x01\x81\x02\x12\x02\x10,\x88\x8f\x19k\x02\x11\x02\x10\x02\x10\xff\x02\x11\x02\x10B\x02\x10\x1f\x02\x11!\x9f\x02\x1b\x02\x14!\xa8\x13\x02\x15!\x02\x1d\x02\x10\x02\x16$\x02\x12\x02\x10\x02\x10\x02\x10\x02\x10d)\x93\x02\x18e!E\x18\x02\x1a!5\xb5?\x03'

2020-07-11 16:58:55 DEBUG (ZiGate-Event Loop) [zigate] Dispatch ZIGATE_PACKET_RECEIVED
2020-07-11 16:58:55 DEBUG (ZiGate-Decode data) [zigate] Received response 0x8102: b'8f196b010000ff010042001f01219f0b0421a81305210d000624020000000064299308652145180a2135b5'
2020-07-11 16:58:55 DEBUG (ZiGate-Decode data) [zigate] RESPONSE 0x8102 - Individual Attribute Report : sequence:143, addr:196b, endpoint:1, cluster:0, attribute:65281, status:0, data_type:66, size:31, data:01219f0b0421a81305210d000624020000000064299308652145180a2135b5, lqi:63
2020-07-11 16:58:55 DEBUG (ZiGate-Decode data) [zigate] Acquire Lock on device LUMI lumi.sensor_ht (196b) 00158d00034f8c03
2020-07-11 16:58:55 DEBUG (ZiGate-Decode data) [zigate] Release Lock on device LUMI lumi.sensor_ht (196b) 00158d00034f8c03
2020-07-11 16:58:55 DEBUG (ZiGate-Decode data) [zigate] Acquire Lock on device LUMI lumi.sensor_ht (196b) 00158d00034f8c03
2020-07-11 16:58:55 DEBUG (ZiGate-Decode data) [zigate] Release Lock on device LUMI lumi.sensor_ht (196b) 00158d00034f8c03
2020-07-11 16:58:55 DEBUG (ZiGate-Decode data) [zigate] Acquire Lock on device LUMI lumi.sensor_ht (196b) 00158d00034f8c03
2020-07-11 16:58:55 DEBUG (ZiGate-Decode data) [zigate] Release Lock on device LUMI lumi.sensor_ht (196b) 00158d00034f8c03
2020-07-11 16:58:55 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_ATTRIBUTE_UPDATED
2020-07-11 16:58:55 DEBUG (ZiGate-Decode data) [zigate] Handle special xiaomi attribute {'endpoint': 1, 'cluster': 0, 'addr': '196b', 'attribute': 65281, 'data': '01219f0b0421a81305210d000624020000000064299308652145180a2135b5', 'name': 'xiaomi', 'type': <class 'dict'>, 'value': {1: 2975, 4: 5032, 5: 13, 6: b'\x02\x00\x00\x00\x00', 100: 2195, 101: 6213, 10: 46389}}
2020-07-11 16:58:55 DEBUG (ZiGate-Decode data) [zigate] Acquire Lock on device LUMI lumi.sensor_ht (196b) 00158d00034f8c03
2020-07-11 16:58:55 DEBUG (ZiGate-Decode data) [zigate] Release Lock on device LUMI lumi.sensor_ht (196b) 00158d00034f8c03
2020-07-11 16:58:55 DEBUG (ZiGate-Decode data) [zigate] Acquire Lock on device LUMI lumi.sensor_ht (196b) 00158d00034f8c03
2020-07-11 16:58:55 DEBUG (ZiGate-Decode data) [zigate] Release Lock on device LUMI lumi.sensor_ht (196b) 00158d00034f8c03
2020-07-11 16:58:55 DEBUG (ZiGate-Decode data) [zigate] Acquire Lock on device LUMI lumi.sensor_ht (196b) 00158d00034f8c03
2020-07-11 16:58:55 DEBUG (ZiGate-Decode data) [zigate] Release Lock on device LUMI lumi.sensor_ht (196b) 00158d00034f8c03
2020-07-11 16:58:55 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_ATTRIBUTE_UPDATED
2020-07-11 16:58:55 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED
2020-07-11 16:58:55 WARNING (Recorder) [homeassistant.components.recorder] Event is not JSON serializable: <Event zigate.attribute_updated[L]: endpoint=1, cluster=0, addr=196b, attribute=65281, data=01219f0b0421a81305210d000624020000000064299308652145180a2135b5, name=xiaomi, type=dict, value=1=2975, 4=5032, 5=13, 6=b'\x02\x00\x00\x00\x00', 100=2195, 101=6213, 10=46389, ieee=00158d00034f8c03, device_type=lumi.sensor_ht, entity_id=zigate.00158d00034f8c03>
2020-07-11 16:58:55 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1670276688] Unable to serialize to JSON. Bad data found at $.event.data.value.6=b'\x02\x00\x00\x00\x00'(<class 'bytes'>

from zigate.

csacre avatar csacre commented on July 28, 2024

Problem is coming when updating XIAOMI specific attribute 65281 as the "value" is not serializable in JSON as it contains json attributes as numeric value and not as string.

'value': {1: 2975, 4: 5032, 5: 13, 6: b'\x02\x00\x00\x00\x00', 100: 2195, 101: 6213, 10: 46389}

To fix this temporarily, I have changed my copy of init.py
I am not sure of the consequence but for a few days now it seems to work correctly.

 def attribute_updated(**kwargs):
    device = kwargs['device']
    ieee = device.ieee
    attribute = kwargs['attribute']
    _LOGGER.debug('Update attribute for device {} {}'.format(device,
                                                             attribute))
    entity = hass.data[DATA_ZIGATE_DEVICES].get(ieee)
    event_data = attribute.copy()
    if type(event_data.get('type')) == type:
        event_data['type'] = event_data['type'].__name__
    event_data['ieee'] = device.ieee
    event_data['addr'] = device.addr
    event_data['device_type'] = device.get_property_value('type')
    if entity:
        event_data['entity_id'] = entity.entity_id
    #CS temp fix
    if str(event_data['attribute']) != "65281":
        hass.bus.fire('zigate.attribute_updated', event_data)
    else:
        _LOGGER.warning('ZIGATE CS SKIP ATTRIBUTE 65281')

from zigate.

doudz avatar doudz commented on July 28, 2024

it should be fixed in 0.40.1

from zigate.

csacre avatar csacre commented on July 28, 2024

It works! Thank you!

from zigate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.