Did you include the binary_sensor component and add it to your configuration? It should be available automatically at every start if you have. You can look at packages/motion_sensor.yaml in my repo for inspiration.
@postlund Update: I have it working after reviewing the logs it looks like it was looking for the dlink_new.py file. Everything is good great work!
One last question I am having issues automating the state change im not sure what the value should be i tried ‘Detected’ as well as ‘On’… nothing seems to kick off the automation
- id: motione_lights alias: 'Motion lights' trigger: - platform: state entity_id: binary_sensor.bedroom_sensor to: '1' action: service: light.turn_on entity_id: light.lifx_z_light
Update: i used uncapitalized ‘on’ and ‘off’ state values and that seems to work best
Great that it works! You should use “on” or “off” for binary sensors. Hope that should work for you!
This working great for me. Question…I do have a DLink Sirene S220 (wireless version). Any idea how I could connect the motion sensors and the sirene. I see you reference a sirene in row 245 onwards, but not sure why it is there.
When I run “pip install PySimpleSOAP==1.16” I get the error “Failed building wheel for PySimpleSOAP” any idea what’s causing this? I’m running hassbian, python 3.5.3 and 2.7.13.
Hello. I’m developing a security web app, i want to use this DLink motion sensor to presense purpose. The idea is when the sensor detect any motion I get a http request from the sensor. Can this library help me?
@postlund I believe the more recent updates to HA have broken this component… I was successfully using this the script for 1 and half mouths. Now after a recent update it is throwing lots of errors… I even went out to purchased a brand new dlink sensor thinking maybe mine had gone defective. Anyways HA is able to poll the state for a few hours then it throws endless errors until i unplug the dlink sensor and plug it back in… What is interesting is that the mydlink iOS app will still log detection just fine so i do not believe this is a sensor issue. Here is a break down of the errors i am getting, any help would be much appropriated again.
Mar 25 2018 13:00:44 GMT-0500 (Central Daylight Time) parsed: OrderedDict([('html', OrderedDict([('@xmlns', 'http://www.w3.org/1999/xhtml'), ('@xml:lang', 'en'), ('@lang', 'en'), ('head', OrderedDict([('title', '500 - Internal Server Error')])), ('body', OrderedDict([('h1', '500 - Internal Server Error')]))]))])
Log Details (ERROR) Sun Mar 25 2018 12:51:52 GMT-0500 (Central Daylight Time) failed to update motion sensor Traceback (most recent call last): File "/home/homeassistant/.homeassistant/custom_components/binary_sensor/dlink_new.py", line 105, in call result = yield from self.soap().call(method, **kwargs) File "/home/homeassistant/.homeassistant/custom_components/binary_sensor/dlink_new.py", line 230, in call raise Exception('probably a bad response') Exception: probably a bad response During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/homeassistant/.homeassistant/custom_components/binary_sensor/dlink_motion_sensor.py", line 93, in async_update last_trigger = yield from self._motion_sensor.latest_trigger() File "/home/homeassistant/.homeassistant/custom_components/binary_sensor/dlink_new.py", line 158, in latest_trigger 'GetLatestDetection', ModuleID=self.module_id) File "/home/homeassistant/.homeassistant/custom_components/binary_sensor/dlink_new.py", line 101, in call yield from self.login() File "/home/homeassistant/.homeassistant/custom_components/binary_sensor/dlink_new.py", line 57, in login LoginPassword='', Captcha='') File "/home/homeassistant/.homeassistant/custom_components/binary_sensor/dlink_new.py", line 109, in call self._bad_response() File "/home/homeassistant/.homeassistant/custom_components/binary_sensor/dlink_new.py", line 115, in _bad_response raise Exception('got error response from device') Exception: got error response from device
Log Details (ERROR) Sun Mar 25 2018 12:51:52 GMT-0500 (Central Daylight Time) Got an error, resetting private key
Hmm, this I have not seen. Did you update the software in the sensor (or was is it done automatically)? The app uses their cloud which is a different API. My component talks directly to the device, bypassing the cloud, so I’m not surprised that it works.
@postlund Unless there was an automatic firmware update on the Dlink sensors that i have been unaware of but both sensors are on firmware v1.22. Also I setup the sensors with the mydlink app so it forced the firmware update. Like i mentioned the component works for about an hour or so and then it starts spitting out those errors… I am running Hassbain Homeassistant 0.65.6. If you have any suggestions I would love to try them, I am trying to stay away from z-wave and this is the perfect solution for me.
Firmware External Version: V1.22
Firmware Internal Version: V1.22b06
I am getting this error, too. The device starts to return error code 500 after a very short time. I have the same stack trace as above, I don’t know if these sensors are just flaky or what – the strange thing is it still seems to work despite the errors. The history shows when there was motion and my lights come on (so far) .
It does fill up the logs pretty quick.
HA stops reporting the status once the errors start for me however as mentioned the sensor will continue to work via the mydlink mobile app
I got the same error after a while (auto firmware update?).
I made some modifications to the code and now seems to work.
Also I made some changes to improve stability.
You can find the modified file here:
Ive tried out that new code. It seems to work for a while, and then starts throwing 500 errors again
The 500 error appeared to me as well after a while.
However, It seems to be an error of the sensor, as even the d-link application can not access the sensor, I need to reset it manually…
I’ll let you know if I find a solution.
thanks for the work and investigation on this.
I ended up upgrading my hass.io installation to a new, faster pi, and the 500 errors went away, so it might have been a timeout issue (or just coincidence, as i also had a brownout)
However, after upgrading hass.io to 0.67.1, when i had any reference to this in my config, i get panic errors.
ERROR panic: interface conversion: interface is nil, not string goroutine 1 [running]: panic(0x2c5f60, 0x1077d180) /home/travis/.gimme/versions/go1.7.6.linux.amd64/src/runtime/panic.go:500 +0x33c github.com/home-assistant/hassio-cli/command/helpers.DisplayOutput(0x107de200, 0x24, 0x200, 0x0) /home/travis/gopath/src/github.com/home-assistant/hassio-cli/command/helpers/common.go:118 +0x3c8 github.com/home-assistant/hassio-cli/command/helpers.ExecCommand(0x2f5e63, 0xd, 0x7ee38e53, 0x7, 0x0, 0x0, 0x76000, 0x0, 0x0, 0x0, ...) /home/travis/gopath/src/github.com/home-assistant/hassio-cli/command/helpers/common.go:155 +0x308 github.com/home-assistant/hassio-cli/command.CmdHomeassistant(0x10786420) /home/travis/gopath/src/github.com/home-assistant/hassio-cli/command/homeassistant.go:48 +0x540 github.com/urfave/cli.HandleAction(0x2ae6d8, 0x323754, 0x10786420, 0x0, 0x0) /home/travis/gopath/src/github.com/urfave/cli/app.go:503 +0xf0 github.com/urfave/cli.Command.Run(0x2f5e63, 0xd, 0x0, 0x0, 0x409d10, 0x1, 0x1, 0x300cfa, 0x2f, 0x0, ...) /home/travis/gopath/src/github.com/urfave/cli/command.go:165 +0x6b8 github.com/urfave/cli.(*App).Run(0x107b2380, 0x1070a160, 0x3, 0x4, 0x0, 0x0) /home/travis/gopath/src/github.com/urfave/cli/app.go:259 +0x8b0 main.main() /home/travis/gopath/src/github.com/home-assistant/hassio-cli/main.go:22 +0x108
Ive got that section of my config commented out, along with some automations that use it, and everything else works OK.
Thanks, I’ll test the new hass version.
In the meantime, I applied a workaround to my code to force the sensor to reboot every 3 hours, that solved the problem for me (you can find the code in my repo).
I updated again today to 0.68 and that particular issue went away.
Im now not 100% sure i didnt have a dodgy whitespace character in my config somewhere.
I do still seem to get the occasional 500 error, but after a sensor reboot its back up and running again. Ill try your new code with the force reboot. Seems like a good workaround for the moment!
Do we have any update on the custom component for the D-Link DCH-S150 motion detector? I just purchased 2 and want to try to get them to interface with 0.70.1 Hassbian.