Yoda-x / ha-zha-new

update of the zha component
56 stars 10 forks source link

Support for HA version of NYCE sensors? #47

Closed MYeager1967 closed 5 years ago

MYeager1967 commented 6 years ago

Any chance this will allow the use of NYCE tilt and hinge sensors? They are the HA versions and not the Iris ones...

MYeager1967 commented 6 years ago

Great! I wasn't sure what was involved as I haven't even had time to look at your code and begin to try to digest how it does what it does. I'm fairly competent with Python, but I'm not really an object oriented programmer. Having actual battery reporting would be great but seeing as it isn't currently there, I was more interested in pursuing a method of knowing when it died. Always better to have it work properly, but I'm not in a position to accomplish that. Once again, great work on this. I have two hinge sensors and the tilt sensor and they are working flawlessly. Much more reliable than they were on the Vera and it no longer takes a minute for them to update into HA. Enjoy your vacation!!!

Yoda-x commented 6 years ago

I added the battery cluster and temperature cluster to the binary_sensors. both update the "last seen" attribute. Battery can report "Battery_Voltage" and "battery level", please update the preview branch of zha_new. If it not works please provide the log message for the battery message you see. Thanks for being a beta tester, I have no option to really test it.

I started python programming at the beginning of this year. I would not call me a python programmer ;-)

MYeager1967 commented 6 years ago

Just updated the git pull and copied over the changed file. Will let you know when the sensors update again. Right now I have this for information:

last seen: 2018-10-12T16:00:27.058577-04:00 rssi: -67 path: direct manufacturer: NYCE SUPERVISION_REPORTS: 1 BATTERY_DEF: 0 model: 3010 ALARM1: 0 TEST: 0 TAMPER: 0 last detection: 2018-10-12T16:00:27.059015-04:00 nwk: 34259 lqi: 255 friendly_name: Front Door Sensor TROUBLE: 0 BATTERY: 0 AC_MAINS: 0 ALARM2: 0 RESTORE_REPORTS: 1

And it updated right after I submitted the comment...

Yoda-x commented 6 years ago

this means you see some battery stats? Cool. First time a change works without fixing 10 typos afterwards :smiley:

MYeager1967 commented 6 years ago

I'm not sure what was there before I updated it other than the AC_MAINS line. There's a lot of data here that I don't know what it's for. Battery 0 doesn't look too good though...

Yoda-x commented 6 years ago

nothing to worry about, BATTERY:0 means your Battery is ok, 1 means low. All the UPPER_CASE attribtutes come from the IAS (0x0500) cluster and not the power (0x0002) cluster. If you don't see a Battery_voltage or battery_level attribute. You not receive battery updates.

MYeager1967 commented 6 years ago

How often should the battery updates come in? As of now, I still have nothing for voltage or level. I haven't activated any logging other than what HA starts out with, so if you need any logs, you'll have to point me to what you need. Great work so far. For only having been using Python for a short time, you're way ahead of me. I just tinker for various home control projects, not into the object oriented style at all...

Yoda-x commented 6 years ago

not sure if they come automatic. the smartthings device handler sets them. you can try to add this to your zha config and then repair the device, please replace the mac address with you device mac:

zha_new:
    device_config: 
      "00:15:8d:00:01:14:82:aa-1":
        type: binary_sensor
        config_report:
          - [0x0001, 0x0020, 60, 3600, 5]
          - [0x0001, 0x0021, 60, 3600, 5]

This requests the attribute reports for battery voltage and remaining percentage from the device, if available. you find the mac address of the sensor in the zigbee.db, the "-1" is for the endpoint. otherwise I can create a device file, which you can copy to custom_components/device

MYeager1967 commented 6 years ago

I'll look into adding this to the config file. Why would you need to pair the device again? Wouldn't adding the command kick it off on the next restart? How would the device file act any different unless it would automatically pick up multiple sensors?

Yoda-x commented 6 years ago

Attribute reporting request are only written to the sensor during pairing. After pairing the battery powered sensor goes to sleep and you don't know when it wakes up. So if you want to tell the device to send attribute reports you have to re-pair it.

Configuration.yaml vs device files: in the configation file you modify the device based on it's hw address and endpoint ID. This includes devices type, clusters to use, and also the attribute reporting. The device handler file can do the same and much more based on the model name (3010). It is a more generic approach. No need to configure every device in the config. My code discovers the model name and checks if a matching file is available and configures all your nyce 3010 devices. If you have 3014 devices you can also easily reuse the 3010 file The only thing at a restart, is that you don't see a status, until the sensor sends an update. As it is now.

MYeager1967 commented 6 years ago

In that case, device files are probably the way to go. I have both 3010 and 3014 devices.

MYeager1967 commented 6 years ago

Ok, I got around to removing and repairing my garage door sensor with the changes to the config file. We shall see if it changes anything. :-)

MYeager1967 commented 6 years ago

Ok, here we are, a week later, and I have no additional data for the device having anything to do with battery. At least removing and repairing on these devices under Home Assistant doesn't break everything as it did on my previous controller. Any chance you'd want to take on adding support for the last device I have on Vera?

Yoda-x commented 6 years ago

I lost my crystal ball. What you have left?Just open another ticket, provide some logs and the data from zigbee.db and lets see ...

MYeager1967 commented 6 years ago

The last device I have tied to Vera is a Z-Wave device. It's a ZWN-SC7 scene controller. I asked as more of a joke as I've been trying to find support for it for months and I've found nothing. As for the rest of the last message, I added the lines to the zhanew config to configure battery reports on the 3014 tilt sensor device. Doesn't look as though it worked as I still have no additional battery data. Honestly though, it's not a massive issue as these things have been rock solid under your code and they were hit and miss at best on the Vera...

Yoda-x commented 5 years ago

no worries. homeassistant is a serious topic :wink:. Did you tried to open a ticket within github for homeassistant/zwave to add the device? I think they guys developing z-wave will catch it up, same way I did.

MYeager1967 commented 5 years ago

I wasn't aware that there was a github for it. I guess I should have known as there seems to be one for everything these days. I'll search for it and see if I can find it. I still have the scene controller on Vera and a dimmer (because I'm using Vera for my Alexa integration at the moment). I'm ok with this arrangement though as the Vera is actually stable when there isn't much on it...

Yoda-x commented 5 years ago

closing this ticket as it seems ok now,