Been using the Custom Component for some time without issue, must moved over to HACS compatible one, no issues, works great. Thanks.
Thanks everyone for testing! The repository has just been added to HACS, so it will be available without having to add it as a custom repository within the next few hours.
Thank you very much for hacs integration! Working great!
Working all good for me.
However old link is not available and new link is here:
Iâve also forked for failsafe here:
Thatâs the old repo, you should use the dlink_hnap
repo. Or install via HACS.
Iâm new to HASS so forgive me if this is a newbie question.
After a bit of pain, I got this old DCH-S150 connected to my network. Via HACS I installed dlink_hnap and then manually configured the configuration.yaml file. In HASS, the device shows up as Hall Motion with Entity ID binary_sensor.hall_motion. It seems to be working okay because I can see the activity.
My issue comes when I try and use it for some automation. As I understand it, there isnât a GUI so I need to edit as YAML. My trigger looks like this:
platform: dlink_hnap
type: motion
domain: switch
entity_id: binary_sensor.hall_motion
But I get an error Message malformed: Integration âdlink_hnapâ does not provide trigger support
How can I use this as a trigger? Advice appreciated!
This is my configuration.yaml entry:
binary_sensor:
- platform: dlink_hnap
name: dlink sensor
host: 192.168.1.200
type: motion
username: Admin
password: ******
timeout: 35
This is my automation trigger:
- id: â1547840481258â
alias: Hallway Light On if Motion
trigger:- entity_id: binary_sensor.dlink_sensor
from: âoffâ
platform: state
to: âonâ
- entity_id: binary_sensor.dlink_sensor
Thanks Gary. How do I establish the ID?
Ignore that. I think Iâve worked it out.
In Developer Tools > Events > Event to subscribe to I choose * then start listening then trigger the sensor. That gives me some information.
The ID in the Automation is created by the Automation editor in Configuration/Automations. You can use the Automation editor to create Automations for this device once it has an entity, and the configuration.yaml entries create the entity.
Thanks. The automation worked for a few days but now it seems something has gone wrong with the integration. As best I remember, the device used to show on/off state but now it just shows âclearâ.
The IP address hasnât changed and the sensor still seems to be working, judging by the LED light. Any ideas?
You need to check the logs for additional pointers.
Thank you, Pierre. That hadnât occurred to me.
2020-11-03 21:41:17 ERROR (MainThread) [custom_components.dlink_hnap.binary_sensor] failed to update motion sensor
Traceback (most recent call last):
File "/config/custom_components/dlink_hnap/binary_sensor.py", line 113, in async_update
last_trigger = await self._sensor.latest_trigger()
File "/config/custom_components/dlink_hnap/dlink.py", line 174, in latest_trigger
detect_time = resp["LatestDetectTime"]
KeyError: 'LatestDetectTime'
I see that error repeated over and over. Seems to be having a problem getting LatestDetectTime from the device.
EDIT: Seems to be working again now.
I am getting this error when I install this via HACS
This error originated from a custom integration.
Logger: custom_components.dlink_hnap.binary_sensor
Source: custom_components/dlink_hnap/dlink.py:193
Integration: dlink_hnap (documentation, issues)
First occurred: 1:09:24 PM (2118 occurrences)
Last logged: 4:06:11 PM
failed to update motion sensor
Traceback (most recent call last):
File "/config/custom_components/dlink_hnap/binary_sensor.py", line 113, in async_update
last_trigger = await self._sensor.latest_trigger()
File "/config/custom_components/dlink_hnap/dlink.py", line 169, in latest_trigger
await self._cache_soap_actions()
File "/config/custom_components/dlink_hnap/dlink.py", line 193, in _cache_soap_actions
self._soap_actions = resp["ModuleSOAPList"]["SOAPActions"]["Action"]
KeyError: 'ModuleSOAPList'
With great sadness this device is as good as junk now. Support has ended and the dlink myhome app which you use to pair these things cant be downloaded anymore from the app store
Thatâs not enterely true. D-link has shut down the server part of this device but the app is still available on the Play Store. The problem is that not even older versions of this app can configure the device, I guess the app fetches from the web a list of configurable devices and the DCH-S150 is not one of them anymore.
If Iâve read things right, this integrations allow us to directly fetch data from the API endpoint of the device itself, right?
If we can figure out how the app configures the WiFI connection of the device and we can do it ourselves we could avoid to trash a perfectly fine device because someone decides to shut down their serversâŠ
Sure I guess âanythingâ is possible
To clarify:
- Apple App Store app is gone
- The devices are trying to hit an API that no longer exists (I noticed 157k dns requests on my adguard in just under a week)
Just adding to this, Iâm also annoyed that D-Link did not at least give a method that these could still be used and configured off the cloud. I have a few unfortunately they were configured using the iOS App which I still have on my iPhone, but I can no longer login to the App, I actually had a few D-Link devices, 2 WebCams, 5 x Water sensors.
I cannot access any of them, because I do not know the password, Iâve never configured a password, as they were only used by the MyDlink website and app. They are all currently enabled and connected to my WiFi, fear of hardware reset will just scrap them, as no method to configure, I believe originally, there was a QR code which I scanned, which configured and added them to the Cloud, thereâs some mention of a PIN number on the device to login, but I see no pin number.
if you know the password, does this HA âpluginâ operate correctly ?
Yâall are in luck! I have a bunch of DCH-S150 motion detectors sitting around, as well as a couple still that I bought cheap and never activated before the D-Link cloud/app went away. So I got motivated to figure out how to activate them. Not easy, as thereâs just not much information on the HNAP protocol, and in particular, how D-Link devices implement it.
Cutting to the chase, hereâs a Python script that you can use to set the wi-fi access on your device (anyhow, it worked for me): https://raw.githubusercontent.com/UpDryTwist/defogger-dch-s150/master/dch-wifi.py
You can also use this code as a basis to tinker with further, in terms of other HNAP commands (if anyone finds a way to set the detection reset time down shorter than 30 seconds, youâll be my hero!).
Some comments:
-
You can probably ignore the rest of the project itâs in. I initially cloned bmorkâs cool DCS-8000LH defogger (i.e., cloud remover) project, and started tinkering with that, until I remembered that Iâd never been successful setting up my devices using Bluetooth from my phone â so I never got the BTLE stuff to work â and, frankly, you donât need to.
-
You need to connect to the access point the device advertises. Afterwards, itâll probably show up at IP 192.168.0.60. Make sure you can access that cleanly before anything else (you can go try logging in at that IP - wonât accomplish much, but proves you can get there).
-
In theory, this code supports both password-protected wi-fi and open wi-fi. I wrote all the code to work with a password, and debugged it through to the point that the D-Link device was accepting my requests without error, but not connecting to my network . . . and then I finally remembered that I had to set up a whole separate 2.4Ghz open network (filtered by MAC address) for these devices, as they didnât like connecting to my main network. SO . . . if your network is password protected, this may or may not work for you.
-
Super props to Pierre StÄhl (postlund), whose copied code (from his Home Assistant driver) made the whole basis for my D-Link communications.
-
I just got this to work this evening, so havenât cleaned anything up. Unfortunately, Iâve exhausted my tinkering-with-this budget, so canât provide folks much in the way of support or documentation - but hopefully itâs easy-enough to work with or extend.
is it still working for you all?