elric91 / homeassistant_zigate

Custom components for Home Assistant
MIT License
22 stars 5 forks source link

No lumens #13

Closed max5962 closed 6 years ago

max5962 commented 6 years ago

hello, There is no lumens indication for XIAOMI aquara body sensor : https://www.gearbest.com/alarm-systems/pp_659226.html

2018-02-21 14:41:57 DEBUG (MainThread) [zigate] RESPONSE 8102 : Attribute Report / Response
2018-02-21 14:41:57 DEBUG (MainThread) [custom_components.zigate.zigate2hass] ZIGATE SIGNAL :
2018-02-21 14:41:57 DEBUG (MainThread) [custom_components.zigate.zigate2hass] - Signal   : zgt_signal_update_e98601
2018-02-21 14:41:57 DEBUG (MainThread) [custom_components.zigate.zigate2hass] - Property : last seen
2018-02-21 14:41:57 DEBUG (MainThread) [custom_components.zigate.zigate2hass] - Data     : 2018-02-21 14:41:57
2018-02-21 14:41:57 DEBUG (MainThread) [custom_components.zigate.zigate2hass] ZIGATE SIGNAL :
2018-02-21 14:41:57 DEBUG (MainThread) [custom_components.zigate.zigate2hass] - Signal   : zgt_signal_update_e98601
2018-02-21 14:41:57 DEBUG (MainThread) [custom_components.zigate.zigate2hass] - Property : event
2018-02-21 14:41:57 DEBUG (MainThread) [custom_components.zigate.zigate2hass] - Data     : presence detected
2018-02-21 14:41:57 DEBUG (MainThread) [zigate]    * Presence detection
2018-02-21 14:41:57 INFO (MainThread) [zigate]   FROM ADDRESS      : b'e986'
2018-02-21 14:41:57 DEBUG (MainThread) [zigate]   - Source EndPoint : b'01'
2018-02-21 14:41:57 DEBUG (MainThread) [zigate]   - Cluster ID      : b'0406'
2018-02-21 14:41:57 DEBUG (MainThread) [zigate]   - Attribute ID    : b'0000'
2018-02-21 14:41:57 DEBUG (MainThread) [zigate]   - Attribute type  : b'18'
2018-02-21 14:41:57 DEBUG (MainThread) [zigate]   - Attribute size  : 1
2018-02-21 14:41:57 DEBUG (MainThread) [zigate]   - Attribute data  : b'01'
2018-02-21 14:41:57 DEBUG (MainThread) [zigate]   # encoded : b'018102120210021e85fbe986021102140216021002100210180210021102118703'
2018-02-21 14:41:57 DEBUG (MainThread) [zigate]   # decoded : 0181 02 00 0E 85 FB E9 86 01 04 06 00 00 00 18 00 01 01 8703
2018-02-21 14:41:57 DEBUG (MainThread) [zigate]   (@timestamp : 14:41:57)
2018-02-21 14:44:08 DEBUG (MainThread) [zigate] --------------------------------------
2018-02-21 14:44:08 DEBUG (MainThread) [zigate] RESPONSE 8102 : Attribute Report / Response
2018-02-21 14:44:08 DEBUG (MainThread) [custom_components.zigate.zigate2hass] ZIGATE SIGNAL :
2018-02-21 14:44:08 DEBUG (MainThread) [custom_components.zigate.zigate2hass] - Signal   : zgt_signal_update_389401
2018-02-21 14:44:08 DEBUG (MainThread) [custom_components.zigate.zigate2hass] - Property : last seen
2018-02-21 14:44:08 DEBUG (MainThread) [custom_components.zigate.zigate2hass] - Data     : 2018-02-21 14:44:08
2018-02-21 14:44:08 DEBUG (MainThread) [custom_components.zigate.zigate2hass] ZIGATE SIGNAL :
2018-02-21 14:44:08 DEBUG (MainThread) [custom_components.zigate.zigate2hass] - Signal   : zgt_signal_update_389401
2018-02-21 14:44:08 DEBUG (MainThread) [custom_components.zigate.zigate2hass] - Property : temperature
2018-02-21 14:44:08 DEBUG (MainThread) [custom_components.zigate.zigate2hass] - Data     : 20.54
2018-02-21 14:44:08 INFO (MainThread) [zigate]   * Measurement: Temperature
2018-02-21 14:44:08 INFO (MainThread) [zigate]   * Value: 20.54 °C
2018-02-21 14:44:08 INFO (MainThread) [zigate]   FROM ADDRESS      : b'3894'
2018-02-21 14:44:08 DEBUG (MainThread) [zigate]   - Source EndPoint : b'01'
2018-02-21 14:44:08 DEBUG (MainThread) [zigate]   - Cluster ID      : b'0402'
2018-02-21 14:44:08 DEBUG (MainThread) [zigate]   - Attribute ID    : b'0000'
2018-02-21 14:44:08 DEBUG (MainThread) [zigate]   - Attribute type  : b'29'
2018-02-21 14:44:08 DEBUG (MainThread) [zigate]   - Attribute size  : 2
2018-02-21 14:44:08 DEBUG (MainThread) [zigate]   - Attribute data  : b'0806'
2018-02-21 14:44:08 DEBUG (MainThread) [zigate]   # encoded : b'018102120210021f228e3894021102140212021002100210290210021202180216ae03'
2018-02-21 14:44:08 DEBUG (MainThread) [zigate]   # decoded : 0181 02 00 0F 22 8E 38 94 01 04 02 00 00 00 29 00 02 08 06 AE03
2018-02-21 14:44:08 DEBUG (MainThread) [zigate]   (@timestamp : 14:44:08)
2018-02-21 14:44:08 DEBUG (MainThread) [zigate] --------------------------------------

Here logs when motion is detected :)

max5962 commented 6 years ago

According https://github.com/sasu-drooz/Domoticz-Zigate there is deviceType : "'lumi.sensor_motion.aq2':{'Ep':{'01':{'0406','0400'}},'Type':'Motion/Lux'},"

It could be awesome having the same config file :)

ISO-B commented 6 years ago

I added handling for Illuminance measurement cluster to zigate.

Next thing is to change ZigateSensor code to support devices with multiple measurements from single endpoint. Probably the best way to do this is add parameter to config so user can specify which parameter is wanted.

max5962 commented 6 years ago

Thanks a lot !

max5962 commented 6 years ago

I upgraded pyzigate code and hass-component, i still don't see illuminance information. is it normal ? thanks

Seems well detected by the zigate code :

"2018-03-08 14:49:52 DEBUG (MainThread) [zigate] --------------------------------------
2018-03-08 14:49:52 DEBUG (MainThread) [zigate] RESPONSE 8102 : Attribute Report / Response
2018-03-08 14:49:52 DEBUG (MainThread) [custom_components.zigate.zigate2hass] ZIGATE SIGNAL :
2018-03-08 14:49:52 DEBUG (MainThread) [custom_components.zigate.zigate2hass] - Signal   : zgt_signal_update_b4b501
2018-03-08 14:49:52 DEBUG (MainThread) [custom_components.zigate.zigate2hass] - Property : last seen
2018-03-08 14:49:52 DEBUG (MainThread) [custom_components.zigate.zigate2hass] - Data     : 2018-03-08 14:49:52
2018-03-08 14:49:52 INFO (MainThread) [zigate]   FROM ADDRESS      : b'b4b5'
2018-03-08 14:49:52 DEBUG (MainThread) [zigate]   - Source EndPoint : b'01'
2018-03-08 14:49:52 DEBUG (MainThread) [zigate]   - Cluster ID      : b'0400'
2018-03-08 14:49:52 DEBUG (MainThread) [zigate]   - Attribute ID    : b'0000'
2018-03-08 14:49:52 DEBUG (MainThread) [zigate]   - Attribute type  : b'21'
2018-03-08 14:49:52 DEBUG (MainThread) [zigate]   - Attribute size  : 2
2018-03-08 14:49:52 DEBUG (MainThread) [zigate]   - Attribute data  : b'0051'
2018-03-08 14:49:52 DEBUG (MainThread) [zigate]   # encoded : b'018102120210021fb271b4b502110214021002100210021021021002120210513903'
2018-03-08 14:49:52 DEBUG (MainThread) [zigate]   # decoded : 0181 02 00 0F B2 71 B4 B5 01 04 00 00 00 00 21 00 02 00 51 3903
2018-03-08 14:49:52 DEBUG (MainThread) [zigate]   (@timestamp : 14:49:52)
2018-03-08 14:49:52 DEBUG (MainThread) [zigate] --------------------------------------
2018-03-08 14:49:52 DEBUG (MainThread) [zigate] RESPONSE 8102 : Attribute Report / Response
2018-03-08 14:49:52 DEBUG (MainThread) [custom_components.zigate.zigate2hass] ZIGATE SIGNAL :
2018-03-08 14:49:52 DEBUG (MainThread) [custom_components.zigate.zigate2hass] - Signal   : zgt_signal_update_b4b501
2018-03-08 14:49:52 DEBUG (MainThread) [custom_components.zigate.zigate2hass] - Property : last seen
2018-03-08 14:49:52 DEBUG (MainThread) [custom_components.zigate.zigate2hass] - Data     : 2018-03-08 14:49:52
2018-03-08 14:49:52 DEBUG (MainThread) [custom_components.zigate.zigate2hass] ZIGATE SIGNAL :
2018-03-08 14:49:52 DEBUG (MainThread) [custom_components.zigate.zigate2hass] - Signal   : zgt_signal_update_b4b501
2018-03-08 14:49:52 DEBUG (MainThread) [custom_components.zigate.zigate2hass] - Property : event
2018-03-08 14:49:52 DEBUG (MainThread) [custom_components.zigate.zigate2hass] - Data     : presence detected
2018-03-08 14:49:52 DEBUG (MainThread) [zigate]    * Presence detection
2018-03-08 14:49:52 INFO (MainThread) [zigate]   FROM ADDRESS      : b'b4b5'
2018-03-08 14:49:52 DEBUG (MainThread) [zigate]   - Source EndPoint : b'01'
2018-03-08 14:49:52 DEBUG (MainThread) [zigate]   - Cluster ID      : b'0406'
2018-03-08 14:49:52 DEBUG (MainThread) [zigate]   - Attribute ID    : b'0000'
2018-03-08 14:49:52 DEBUG (MainThread) [zigate]   - Attribute type  : b'18'
2018-03-08 14:49:52 DEBUG (MainThread) [zigate]   - Attribute size  : 1
2018-03-08 14:49:52 DEBUG (MainThread) [zigate]   - Attribute data  : b'01'
2018-03-08 14:49:52 DEBUG (MainThread) [zigate]   # encoded : b'018102120210021edc72b4b5021102140216021002100210180210021102113903'
2018-03-08 14:49:52 DEBUG (MainThread) [zigate]   # decoded : 0181 02 00 0E DC 72 B4 B5 01 04 06 00 00 00 18 00 01 01 3903
2018-03-08 14:49:52 DEBUG (MainThread) [zigate]   (@timestamp : 14:49:52)
2018-03-08 14:50:06 DEBUG (MainThread) [zigate] --------------------------------------
2018-03-08 14:50:06 DEBUG (MainThread) [zigate] RESPONSE 8102 : Attribute Report / Response
"

But no in the interface ... by the way : my detector are insert as switch

max5962 commented 6 years ago

I'm using influxDB and grafana, if someone need help i may help :)

EDIT : after reinstalling evrything, still no illuminance. I continue to investigate :slight_smile:

EDIT 2 : In my pyzigate folder ( 0.1.3.post1) i have illuminance information :

interface.py:            b'0400': 'Measurement: Illuminance',
zgt_parameters.py:ZGT_ILLUMINANCE_MEASUREMENT = 'illuminance'
attributes_helpers.py:        # Illuminance Measurement
attributes_helpers.py:                illuminance = int.from_bytes(attribute_data, 'big', signed=True)
attributes_helpers.py:                self.set_device_property(device_addr, endpoint, ZGT_ILLUMINANCE_MEASUREMENT, illuminance)

In my custom_component I use the good zigate library :

__init__.py:REQUIREMENTS = ['pyserial-asyncio==0.4', 'pyzigate==0.1.3.post1']

In my log i have information ( cf previous post ) In my switch.yaml ::

- platform: zigate
  name: 'sensor2'
  address: b4b501
  default_state: 'event'
  type: 'momentary' 

In the Web interface, no illuminance information :

switch.sensor2  off last seen: 2018-03-12 15:35:52
                    event: presence detected
                    friendly_name: sensor2 

EDIT 3 : I tried to remove the switch declaration in order to add it as a sensor : same issues ...

Any idea ? :)

max5962 commented 6 years ago

BIG NEWS :+1: Upgraded to the latest version of HASS ( 15.3 ) solved all my issues :

  1. illuminance
  2. RSSI

The ticket can be closed ( and add the information in the README :) ) thanks

elric91 commented 6 years ago

good Still don't get where the issue was, but anyway ... cool :)