doudz / homeassistant-zigate

zigate component for Home Assistant
MIT License
48 stars 15 forks source link

Konke devices misqualified #66

Open palmitoto opened 4 years ago

palmitoto commented 4 years ago

Hi everybody,

first thanks you @doudz for your amazing work!

Folllowing akila article's (cf article ), i bought several Konke devices (motion sensor, Door Windows sensor, Switch and Temerature sensor).

I configured zigate to communicate on channel 15. Zigate firmware version : 3.1a lib version : 0.32.1 zigate.json -> Link

Capture-d-e-cran-2019-08-09-a-09-12-37

I completed pairing, but devices are misqualified :

Is it possible to requalify manually the sensor behaviour's ?

Thanks you !

palmitoto commented 4 years ago

Ouch, maybe linked to https://github.com/doudz/zigate/issues/141 ...

doudz commented 4 years ago
  • Door sensor -> zone status (Toogle between "Dangereux" and "Sécurisé")

So ? it's ok ?

  • Motion sensor -> zone status (Always on "Dangereux" status, but a trame is received when i move around the device)

Could you provide debug log ?

  • Switch -> onoff (Always on ON)

I suppose it's inverted (like XIAOMI switch) and when you push the switch I think it change to OFF then ON very fast, so you can't see it on the UI, you could check using debug log If you want to make an automation, use event zigate.attribute_updated instead of sensor trigger

  • Temperature sensor -> Broken when click on reset button -1

I don't see it ?

palmitoto commented 4 years ago
  • Door sensor -> zone status (Toogle between "Dangereux" and "Sécurisé")

So ? it's ok ?

My aqara door sensor module have different behavior: work like onoff button and show me status like "Ouvert" or "Fermé". Moreover the icon used in the interface is a door closed or open depending the status.

  • Motion sensor -> zone status (Always on "Dangereux" status, but a trame is received when i move around the device)

Could you provide debug log ?

No problem, tonight !

  • Switch -> onoff (Always on ON)

I suppose it's inverted (like XIAOMI switch) and when you push the switch I think it change to OFF then ON very fast, so you can't see it on the UI, you could check using debug log If you want to make an automation, use event zigate.attribute_updated instead of sensor trigger

OK

  • Temperature sensor -> Broken when click on reset button -1

I don't see it ?

No because, I tore off the button when I pressed the reset button :-(

doudz commented 4 years ago

My aqara door sensor module have different behavior: work like onoff button and show me status like "Ouvert" or "Fermé". Moreover the icon used in the interface is a door closed or open depending the status.

you could change the appearance in the customize section in HA

No because, I tore off the button when I pressed the reset button :-(

Not sure I understand... sorry. If you pushed the reset button of the sensor, so the sensor is no more linked to zigate

doudz commented 4 years ago

To change appearance : enable advanced mode image go to configuration image then customize image and then override the device class image

palmitoto commented 4 years ago

My aqara door sensor module have different behavior: work like onoff button and show me status like "Ouvert" or "Fermé". Moreover the icon used in the interface is a door closed or open depending the status.

you could change the appearance in the customize section in HA

No because, I tore off the button when I pressed the reset button :-(

Not sure I understand... sorry. If you pushed the reset button of the sensor, so the sensor is no more linked to zigate

-> :-) je disais juste qu'en voulant appairer le module, j'ai arraché le bouton reset en appuyant dessus avec un trombone ! Grosse qualité !

palmitoto commented 4 years ago

Pour la personnalisation, j'avais essayé mais ca ne fonctionnait pas. Après avoir regardé de plus près , les modules apparaissent en double. Une fois dans le groupe zigate, une fois dans binary_sensor.

Je ne sais pas si c'est normal, en tout cas la personnalisation sur binary_sensor semble fonctionner.

palmitoto commented 4 years ago

Concernant la partie automation, tu parles d'utiliser zigate.attribute_updated. Peux tu m'en dire plus sur les champs attendus dans le trigger ? Actuellement j'ai mis çà, mais j'ai aucune idée des champs attendus ?

trigger: platform: event event_type: zigate.attribute_updated event_data: entity_id: zigate.086bd7fffebfe2d9

Ca fonctionne, mais comment différencier le simple clic, du clic long ?

palmitoto commented 4 years ago

Pour le détecteur de mouvement, j'ai toujours la même chose :

2019-08-11 00:33:40 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_ATTRIBUTE_UPDATED 2019-08-11 00:33:40 DEBUG (ZiGate-Decode data) [custom_components.zigate] Update attribute for device Konke 3AFE14010402000D (8815) 086bd7fffe91566e {'endpoint': 1, 'cluster': 1280, 'addr': '8815', 'attribute': 0, 'data': '0000000000000001', 'name': 'zone_status', 'value': {'alarm1': True, 'alarm2': False, 'tamper': False, 'low_battery': False, 'supervision': False, 'restore': False, 'trouble': False, 'ac_fault': False, 'test_mode': False, 'battery_defect': False}} 2019-08-11 00:33:40 DEBUG (ZiGate-Decode data) [zigate] Dispatch ZIGATE_RESPONSE_RECEIVED 2019-08-11 00:33:40 DEBUG (SyncWorker_4) [custom_components.zigate.binary_sensor] Event received: {'endpoint': 1, 'cluster': 1280, 'addr': '8815', 'attribute': 0, 'data': '0000000000000001', 'name': 'zone_status', 'value': {'alarm1': True, 'alarm2': False, 'tamper': False, 'low_battery': False, 'supervision': False, 'restore': False, 'trouble': False, 'ac_fault': False, 'test_mode': False, 'battery_defect': False}, 'ieee': '086bd7fffe91566e', 'device_type': '3AFE14010402000D', 'entity_id': 'zigate.086bd7fffe91566e'}

Mais pareil avec l'event attribute_updated je peux détecter un mouvement, mais je ne peux pas jouer sur l'état. Par exemple : si pas de détection de présence depuis 5 min éteindre la lumière.

Pour info, la fiche du produit sur le site de la zigate : lien Ce module utilise un nouveau cluster, je ne sais pas si ça peux jouer sur ton module ?

palmitoto commented 4 years ago

Bonjour @doudz,

ce serait cool d'avoir un retour sur la partie zigate.attribute_updated.

Par avance merci.

doudz commented 4 years ago

L'automation sur l'event va permettre de déclencher une action, par exemple allumer la lumière voici un exemple

- id: '1519236220899'
  alias: ouverture_portail
  trigger:
  - event_data:
      attribute: 0
      cluster: 6
      endpoint: 1
      ieee: 00158d00016c487e
      value: true
    event_type: zigate.attribute_updated
    platform: event
  action:
  - data:
      entity_id: cover.portail
    service: cover.open_cover
  - data:
      entity_id: media_player.sejour
      message: Ouverture du portail
    service: tts.picotts_say

Pour pouvoir éteindre la lumière au bout de 5 min sans détection, on ne peut utiliser l'évènement zigate.attribute_updated puisque ce n'est pas un "sensor", juste un évènement. Pour cela il faut utiliser un ou plusieurs Timer, voici un exemple https://community.home-assistant.io/t/automatic-switch-off-light-with-cancel-option/134451

Si on avait un binary_sensor qui passe à "on" quand il détecte qqc et à "off" quand il ne détecte rien, on pourrait utiliser l'exemple suivant :

- id: '1565295467926'
  alias: Turn off
  trigger:
  - entity_id: binary_sensor.detection
    for: 00:10:00
    from: 'on'
    platform: state
    to: 'off'
  condition: []
  action:
  - data:
      entity_id: light.outdoor
    service: light.turn_off
palmitoto commented 4 years ago

Merci pour ces précisions.

Reste la dernière question, peut-on filtrer sur les attribute data ? Je veux différencier le muticlic du clic court ou clic long, d'après les infos sur le site de la zigate :

Nom : Bouton multiclic Marque : Konke Endpoint 0: 0x01

Simple clic Cluster ID: 0x0006 (General: On/Off) Attribute ID: 0x0000 Attribute Data: 0x80

Appuie long Cluster ID: 0x0006 (General: On/Off) Attribute ID: 0x0000 Attribute Data: 0x82

Peux on rajouter cette info comme ceci :

- event_data:
      attribute: 0
      attribute_data: 80
      cluster: 6
      endpoint: 1
      ieee: 00158d00016c487e
      value: true

Merci

doudz commented 4 years ago

il faut voir dans le log comment il se comporte. Je pense que ce n'est pas attribute_data (qui n'existe pas) mais value qui va changer Par ailleurs, ça me surprend un peu ces valeurs, car normalement c'est un booléen donc 0x00 ou 0x01 si réellement le capteur envoie 0x80 et 0x82, je vais devoir faire des ajustements car ça risque de ne pas fonctionner, value sera peut-être toujours à true

palmitoto commented 4 years ago

Ok, merci je vais tester çà ce soir. Par contre dans mes souvenirs les traces dans les logs étaient strictement identiques. Je clôture ce ticket. J'en ouvrirai un autre si ce que tu dis se confirme.

Merci et bonne journée.

doudz commented 4 years ago

Normalement tu dois pouvoir voir les changements dans la variable data A noter que 0x80=128, 0x81=129, 0x82=130

palmitoto commented 4 years ago

Je reçois bien qu'un booléen :

2019-09-04 10:12:02 DEBUG (ZiGate-Decode data) [custom_components.zigate] Update attribute for device Konke 3AFE170100510001 (d067) 086bd7fffebfe2d9 {'endpoint': 1, 'cluster': 6, 'addr': 'd067', 'attribute': 0, 'data': True, 'name': 'onoff', 'type': <class 'bool'>, 'value': True}

2019-09-04 10:12:02 DEBUG (SyncWorker_2) [custom_components.zigate.binary_sensor] Event received: {'endpoint': 1, 'cluster': 6, 'addr': 'd067', 'attribute': 0, 'data': True, 'name': 'onoff', 'type': 'bool', 'value': True, 'ieee': '086bd7fffebfe2d9', 'device_type': '3AFE170100510001', 'entity_id': 'zigate.086bd7fffebfe2d9'}

Je crée une nouvelle issue ?

doudz commented 4 years ago

Non c'est bon, on garde ce ticket

doudz commented 4 years ago

est-ce que je pourrais avoir le contenu du fichier zigate.json pour voir comment est reconnu l'équipement KONKE ?

palmitoto commented 4 years ago

https://pastebin.com/1YMF3rLW

C'est le premier device dans le fichier.

doudz commented 4 years ago

ça doit fonctionner maintenant ?

palmitoto commented 4 years ago

Désolé, je n'étais plus trop sur le projet ces derniers temps. Merci pour ta release, je teste çà dès que je peux et je te fais un rretour.