ha-zha-new icon indicating copy to clipboard operation
ha-zha-new copied to clipboard

Please add support for SmartThings Multipurpose Sensor (2018)

Open ericstewart22 opened this issue 6 years ago • 51 comments

Temperature and open/close works, but I bought it primarily for the vibration sensor - any idea how I can get that working? Also, Home Assistant thinks it’s a moisture sensor - any idea how I can fix that?

Here’s the output of bellows -d /dev/ttyUSB1 devices -D /config/zigbee.db: Device: NWK: 0x223a IEEE: 28:6d:97:00:01:00:59:f8 Endpoints: 1: profile=0x104, device_type=DeviceType.IAS_ZONE Input Clusters: Basic (0) Power Configuration (1) Identify (3) Poll Control (32) Temperature Measurement (1026) IAS Zone (1280) Manufacturer Specific (64514) Output Clusters: Identify (3) Ota (25)

ericstewart22 avatar Sep 02 '18 21:09 ericstewart22

can you enable debugging for bellows and zigpy and send me the logs for the time when you shake the sensor thanks

Yoda-x avatar Sep 02 '18 22:09 Yoda-x

Thanks for looking into this! I attached logs and my zigbee.db. Let me know if there's anything else I can do to help.

home-assistant_zha_new.log

zigbee.db.log

ericstewart22 avatar Sep 02 '18 23:09 ericstewart22

Hi Eric,

  1. you use the mainstream zigpy and not my version, this break some things
  2. I see in your log the commands when an alarm is generated. That's good, I need to make some adjustments in the code to catch this up. Please install my version for zigpy. I will come back to you

Yoda-x avatar Sep 03 '18 12:09 Yoda-x

Sorry about that. Please see the attached logs now. One log is after updating bellows and zigpy to your version. The other log and my zigbee.db is after I deleted the old zigbee.db, updated bellows and zigpy to your version, and attempted to pair the device again.

The logs don't look different to my eye. If they are still incorrect then could you tell me what I am doing wrong? Here's what I did:

I used Portainer to get to the console of the Home Assistant docker container and then I ran apt-get update apt-get install git pip3 install --upgrade git+https://github.com/Yoda-x/bellows.git pip3 install --upgrade git+https://github.com/Yoda-x/zigpy.git

running pip3 show bellows and pip3 show zigpy indicate the update was successful.

home-assistant_remove_device_add_device.log

home-assistant_zha_new_zigpy_new_bellows_new.log

zigbee_zha_new_zigpy_new_bellows_new_remove_pair.db.log

ericstewart22 avatar Sep 05 '18 00:09 ericstewart22

if you start hass, it installs the default bellows/zigpy. Threre is a command line option to disable this feature. I added a patch yesterday, that zha_new pulls now my version. Please get a fresh version of zha-new and try again to create logs.

many thanks

Yoda-x avatar Sep 07 '18 14:09 Yoda-x

Please see attached for new logs. Let me know if you need anything else.

home-assistant.log

Thanks! Eric

ericstewart22 avatar Sep 07 '18 22:09 ericstewart22

Hi i added support for this type of sensors. Please update to my preview branch for zha_new bellows and zigpy ( 1. install the zha_new files, 2. install bellows pip3 install --upgrade git+https://github.com/Yoda-x/bellows.git@preview 3. install zippy pip3 install --upgrade git+https://github.com/Yoda-x/zigpy.git@preview

Then please remove the device, restart hass, and pair it again. Please let me know if it works for you. thanks

Yoda-x avatar Sep 10 '18 22:09 Yoda-x

Hello,

It didn't seem to work. Here's a full list of what I did for troubleshooting:

  1. delete everything in custom_components
  2. download zha_new from preview branch and extract to custom_components
  3. open portainer and run in home assistant docker container: 3a: apt-get update 3b: apt-get install git 3c: pip3 install --upgrade git+https://github.com/Yoda-x/bellows.git@preview 3d: pip3 install --upgrade git+https://github.com/Yoda-x/zigpy.git@preview
  4. remove device (press and hold reset button on the device until it flashes alternating green and red)
  5. sudo docker stop homeassistant
  6. delete zigbee.db, home-assistant_v2.db
  7. sudo docker start homeassistant
  8. run zha_new.permit
  9. at this point the device is no longer in pairing mode, so I reset the device so that it is in pairing mode

I attached the logs and zigbee.db following the above steps: home-assistant.log zigbee.db.log

Let me know if you need anything else.

Thanks, Eric

ericstewart22 avatar Sep 10 '18 23:09 ericstewart22

can you please verify the versions for zigpy = 0.1.3-Y-pre bellow = 0.7.2-Y-pre in your container? There is one error in the log, that is fixed in the preview code. Do yo modified the start script in the container to disable the dependency checking inside hass? Otherwise hass checks with every start if the right version is installed and install it if needed. This overwrite my versions. Something I need to fix for the next official release.

Yoda-x avatar Sep 11 '18 11:09 Yoda-x

I modified the zha_new code. It should now load the required bellows/zigpy it self. no need for manual installation with pip. Please refresh the preview zha-code and give it another try. Thanks

Yoda-x avatar Sep 11 '18 22:09 Yoda-x

Thanks for doing that. A couple things - I think you updated the dev branch, not the preview branch. I tried the dev branch and I get the error

valueError: not enough values to unpack (expected 1, got 0)

I think the error occurs because the #bellows== is missing. I tried adding it in and it seems to work fine.

REQUIREMENTS = ['https://github.com/Yoda-x/bellows/archive/preview.zip#bellows==0.7.2-pre', 'https://github.com/Yoda-x/zigpy/archive/preview.zip#zigpy==0.1.3-Y-pre']

I added requirements to dev and preview branches as above and I don't think the sensor is working yet but the logs look a bit different to my uneducated eye. I also tried updating using git commands without restarting the container afterwards and I don't think that worked either.

New logs attached. Please let me know if zigpy and bellows are incorrect. If zigpy and bellows are incorrect then let me know what to look for in the logs to see that I am using the correct version.

home-assistant.log

Eric

ericstewart22 avatar Sep 12 '18 01:09 ericstewart22

I found a bug in the zigpy code and it should be fixed now.
You are right I not updated the preview branch, sorry for the confusion. please refresh zigpy (goto the container, do pip uninstall zigpy and let hass load it again) and do another try. I was testing the requirements without "=" and it worked for me, I appreciate your time to do all the testing. sorry for the iterations...

Yoda-x avatar Sep 12 '18 12:09 Yoda-x

No problem, I am happy to help. Thank you for your help this - you are doing most of the work.

The device now shows in Home Assistant but it's not quite working yet. The binary switch does not update when closed/opened and temperature does not report any values. And I don't see anything from the acceleration sensor.

home-assistant.log zigbee.db.log

Eric

ericstewart22 avatar Sep 13 '18 02:09 ericstewart22

right, I don't see anything coming in from your log. Can you repair the sensor. I assume the sensor is not correctly paired. The init routine runs only when a sensor newly joines, otherwise zha assumes the sensor is already properly configured. please stop hass and remove the zigbee db, then reset the sensor, start hass again and do the paring.

Also please change your debugging to this

logger: 
  default: error
  logs:
    custom_components: debug
    zigpy: debug

Yoda-x avatar Sep 13 '18 07:09 Yoda-x

It worked this time. Sorry about that!

Open/close works, although it shows as "moisture/no moisture" Temperature sensor is there but there's no data. I don't think motion is working, but maybe I'm not looking at the right thing. Any advice?

Thanks again for all your help. I attached log files in case you'd like to have a look.

home-assistant.log zigbee.db.log chrome_2018-09-13_17-29-49 chrome_2018-09-13_17-33-31

ericstewart22 avatar Sep 13 '18 21:09 ericstewart22

Samjin multipurpose sensors returns wrong 'device_class' for whatever reason. Reads as moisture instead of open/close

On Thu, Sep 13, 2018, 17:33 Eric [email protected] wrote:

It worked this time. Sorry about that!

Open/close works, although it shows as "moisture/no moisture" Temperature sensor is there but there's no data. I don't think motion is working, but maybe I'm not looking at the right thing. Any advice?

Thanks again for all your help. I attached log files in case you'd like to have a look.

home-assistant.log https://github.com/Yoda-x/ha-zha-new/files/2381042/home-assistant.log zigbee.db.log https://github.com/Yoda-x/ha-zha-new/files/2381043/zigbee.db.log [image: chrome_2018-09-13_17-29-49] https://user-images.githubusercontent.com/9406402/45517087-13738b80-b77b-11e8-93ab-793fc3aa5181.png [image: chrome_2018-09-13_17-33-31] https://user-images.githubusercontent.com/9406402/45517122-26865b80-b77b-11e8-8bb4-0368b65eb0bf.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Yoda-x/ha-zha-new/issues/46#issuecomment-421160485, or mute the thread https://github.com/notifications/unsubscribe-auth/AFjmcF3fBORlfuBL4UktcAzV0tw_kJ4nks5uas81gaJpZM4WWxKY .

Adminiuga avatar Sep 13 '18 22:09 Adminiuga

From what I see in the logs it generated a plenty of alarms. please create an automation script and then check your logbook.

- alias: click_log
  id: click_log
  initial_state: True
  trigger:
    platform: event
    event_type: alarm
    # optional
  action:
    - service: logbook.log
      data_template:
        name: "click event: "
        message: "Entity {{ trigger.event.data.entity_id  }}, type {{ trigger.event.data.channel}}, command {{ trigger.event.data.command}}, data {{ trigger.event.data.data}} "

you can override the device_class in the customation file

Yoda-x avatar Sep 13 '18 23:09 Yoda-x

I am watching the logs as I test the sensor. I am using tail -f /config/home-assistant.log from the docker container's console.

The alarms are for the door/window sensor only (ALARM 1), I don't see any for movement /vibration of the sensor. Is there a way to get this to work?

Thanks again.

ericstewart22 avatar Sep 14 '18 02:09 ericstewart22

If nothing comes in from the sensor if you shake, it gets difficult. Btw, what sensor you have ? https://support.smartthings.com/hc/en-us/articles/213496343 or https://support.smartthings.com/hc/en-gb/articles/205382174-SmartThings-Multi-Sensor

Yoda-x avatar Sep 14 '18 07:09 Yoda-x

Ps:can you send a log file were you open /close it and another were you shake it only? Just to be sure nothing gets send for it

Yoda-x avatar Sep 14 '18 19:09 Yoda-x

Here's a link to a video where I open and close it while watching home-assistant.log from the console. I don't think there's anything being sent.

https://photos.app.goo.gl/Mmiee8rPkzXZXtkx5 home-assistant.log zigbee .db.log

Thanks again. If it doesn't work then it doesn't work - I knew it might not work when I bought it.

ericstewart22 avatar Sep 14 '18 20:09 ericstewart22

Thanks, yes, very clear. I think I need to disappoint you. Only the 2015 model is listed as vibration and tilt senor. The 2018(yours) and 2016 model are listed only as door and temp sensor.

Yoda-x avatar Sep 14 '18 22:09 Yoda-x

Hm, yes, I see that on their website, but I'm not sure I trust it. I don't have the package anymore, but I'm pretty sure it said vibration sensor on the packaging.

The specific product I ordered was this one which has a nice graphic showing open/close, tilt, vibrate, and temperature. Maybe I'll contact Samsung support to inquire.

https://www.amazon.com/dp/B07F956F3B/ref=sxts_kp_bs_1?pf_rd_m=ATVPDKIKX0DER&pf_rd_p=8778bc68-27e7-403f-8460-de48b6e788fb&pd_rd_wg=abyWw&pf_rd_r=K8VSYAFYXM2HNW9NC2WM&pf_rd_s=desktop-sx-top-slot&pf_rd_t=301&pd_rd_i=B07F956F3B&pd_rd_w=zThp2&pf_rd_i=multipurpose+sensor&pd_rd_r=a08846c1-c9e7-4d35-86e2-760665fff832&ie=UTF8&qid=1536966445&sr=1

71qlmpzskhl sl1500

ericstewart22 avatar Sep 14 '18 23:09 ericstewart22

I don't know what to think. The Amazon store shows it as having tilt and vibration sensor, I thought the box indicated the same. Samsung's website shows that it has vibration sensor, but the product manual doesn't mention anything about it. I found two YouTube videos saying it has tilt and vibration sensor, but I see no proof in the videos. I'm just adding information, I'm not expecting you to make anything of it.

https://www.smartthings.com/products/smartthings-multipurpose-sensor https://youtu.be/AHlrHfiOy2A?t=3m18s https://www.youtube.com/watch?v=AGWf0BEqdMw

The page you linked to is for "M/N: IM6001-MPP02". Mine is "M/N: IM6001-MPP01"

https://fccid.io/2AF4S-IM6001-MPP01/Internal-Photos/Internal-Photo-3814880

ericstewart22 avatar Sep 14 '18 23:09 ericstewart22

Agree, please ask the Smart guys, This gets confusing If you find some information about it, please let me know.

Yoda-x avatar Sep 15 '18 00:09 Yoda-x

Will do. Thanks again for your help, I appreciate it.

ericstewart22 avatar Sep 15 '18 00:09 ericstewart22

argh, I thought I posted my message, but apparently not. I had some partial success with original zigpy:

018-09-15 00:25:39 DEBUG (MainThread) [homeassistant.components.sensor.zha] sensor.samjin_multi_01005e25_1_64514: Attribute update 'Smartthings Accelerometer'[x_axis] = 142
2018-09-15 00:25:39 DEBUG (MainThread) [homeassistant.components.sensor.zha] sensor.samjin_multi_01005e25_1_64514: Attribute update 'Smartthings Accelerometer'[y_axis] = 229
2018-09-15 00:25:39 DEBUG (MainThread) [zigpy.zcl] [0x356c:1:0xfc02] ZCL request 0x000a: [[<Attribute attrid=20 value=<zigpy.zcl.foundation.TypeValue object at 0x7f7e59bf3320>>]]
2018-09-15 00:25:39 DEBUG (MainThread) [zigpy.zcl] [0x356c:1:0xfc02] Attribute report received: 20=-1061
2018-09-15 00:25:39 DEBUG (MainThread) [homeassistant.components.sensor.zha] sensor.samjin_multi_01005e25_1_64514: Attribute update 'Smartthings Accelerometer'[z_axis] = -1061
2018-09-15 00:25:40 DEBUG (MainThread) [zigpy.zcl] [0x356c:1:0xfc02] ZCL request 0x000a: [[<Attribute attrid=18 value=<zigpy.zcl.foundation.TypeValue object at 0x7f7e59bf3320>>, <Attribute attrid=19 value=<zigpy.zcl.foundation.TypeValue object at 0x7f7e59c2c6a0>>]]
2018-09-15 00:25:40 DEBUG (MainThread) [zigpy.zcl] [0x356c:1:0xfc02] Attribute report received: 18=-56, 19=-53
2018-09-15 00:25:40 DEBUG (MainThread) [homeassistant.components.sensor.zha] sensor.samjin_multi_01005e25_1_64514: Attribute update 'Smartthings Accelerometer'[x_axis] = -56
2018-09-15 00:25:40 DEBUG (MainThread) [homeassistant.components.sensor.zha] sensor.samjin_multi_01005e25_1_64514: Attribute update 'Smartthings Accelerometer'[y_axis] = -53
2018-09-15 00:25:40 DEBUG (MainThread) [zigpy.zcl] [0x356c:1:0xfc02] ZCL request 0x000a: [[<Attribute attrid=20 value=<zigpy.zcl.foundation.TypeValue object at 0x7f7e59ce1080>>]]
2018-09-15 00:25:40 DEBUG (MainThread) [zigpy.zcl] [0x356c:1:0xfc02] Attribute report received: 20=-996
2018-09-15 00:25:40 DEBUG (MainThread) [homeassistant.components.sensor.zha] sensor.samjin_multi_01005e25_1_64514: Attribute update 'Smartthings Accelerometer'[z_axis] = -996
2018-09-15 00:25:41 DEBUG (MainThread) [zigpy.zcl] [0x356c:1:0xfc02] ZCL request 0x000a: [[<Attribute attrid=18 value=<zigpy.zcl.foundation.TypeValue object at 0x7f7e59ba39b0>>, <Attribute attrid=19 value=<zigpy.zcl.foundation.TypeValue object at 0x7f7e59c2c4a8>>]]
2018-09-15 00:25:41 DEBUG (MainThread) [zigpy.zcl] [0x356c:1:0xfc02] Attribute report received: 18=-49, 19=-40
2018-09-15 00:25:41 DEBUG (MainThread) [homeassistant.components.sensor.zha] sensor.samjin_multi_01005e25_1_64514: Attribute update 'Smartthings Accelerometer'[x_axis] = -49
2018-09-15 00:25:41 DEBUG (MainThread) [homeassistant.components.sensor.zha] sensor.samjin_multi_01005e25_1_64514: Attribute update 'Smartthings Accelerometer'[y_axis] = -40
2018-09-15 00:25:41 DEBUG (MainThread) [zigpy.zcl] [0x356c:1:0xfc02] ZCL request 0x000a: [[<Attribute attrid=20 value=<zigpy.zcl.foundation.TypeValue object at 0x7f7e59ce1080>>]]
2018-09-15 00:25:41 DEBUG (MainThread) [zigpy.zcl] [0x356c:1:0xfc02] Attribute report received: 20=-990
2018-09-15 00:25:41 DEBUG (MainThread) [homeassistant.components.sensor.zha] sensor.samjin_multi_01005e25_1_64514: Attribute update 'Smartthings Accelerometer'[z_axis] = -990

here's some info:

  1. accelerometer is on 0xfc02 cluster
  2. you do need to configure attribute reporting on 0xfc02 cluster for [0x0010, 0x0012, 0x0013, 0x0014] attributes
  3. configure_reporting needs to use manufacturer id
  4. manufacturer ID must be correct for the specific manufacturer ID. Mine PN is IM6001-MPP01 from Samjin. Based on the older ST DH version i've tried Centralite & ST manufacturer codes and configure_reporting was failing with "unsupported attribute". It wasn't until I put correct manufacturer code for samjn 0x1241 based on newer DH configure_reporting succeeded and I got readings.

Adminiuga avatar Sep 15 '18 04:09 Adminiuga

ok, this needs a more sophisticated device file. let me think about it. @Adminiuga do you created a quirks file for this? @ericstewart22 : you may try the original zha if it works for you...

Yoda-x avatar Sep 18 '18 13:09 Yoda-x

@Yoda-x Yep, created the quirks just for a quick&dirty test whether it worked or not. Quirks just defines the attributes, the real key was a quick fix to add support for manufacturer_id to Cluster.configure_reporting() method. I haven't created any official PRs yet, but even then it would require an update to zigpy, new version of zigpy to pipi and then you would need to add this sensor to HA code and currently I don't know how to cleanly integrate this kind of quirks cluster into general HA zha component layout. So I'm not holding my breath seeing it in upstream zha soon

Adminiuga avatar Sep 18 '18 14:09 Adminiuga

I made some changes to add mfg_id, config_reporting, etc and a new DH file. Please give it a try and update the preview when you find some time. I bumped also the bellows/zigbee versions one up. I hope the upgrade works in dockers. There where many changes for other stuff also.

Yoda-x avatar Sep 20 '18 23:09 Yoda-x