-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Any chance of HC-SR501 PIR motion detector support? #13
Comments
Hi Michal, as SR501 behave more or less like a wall switch(aka high when triggered), you can actually just use the standard wall switch method. You can also split the power and trigger using a different button topic. |
Thanks! The first pet I figured, but I was not aware I could plait power and trigger. I'll have a look at that when I get home. I really wish there was an additional platform supported (ie Generic 8266), which let me have access to all the I/O as this glorious firmware works perfectly well on any module but within the limitations of the Sonoff I/O's. |
Unfortunately I cannot test this for at least a week as I'd need to take a working Sonoff and try to mod it and I only get one day off work a week. Currently using an Adafruit Feather Huzzah for prototyping the functionality/automation and it just so happens that it doesn't break out GPIO#3 so I'm all out off luck after using 5 and 6 for I2C. https://learn.adafruit.com/adafruit-feather-huzzah-esp8266/pinouts EDIT: I get the feeling that it might be possible to define your own device via sonoff_template.h ?? Not sure if it would all flow through and enable what I mentioned earlier though. Any tips appreciated. |
Yes, it is possible. Just edit last position of mytmplt modules in sonoff_template.h. |
I thought this would be where it would be done, but it's not clear to me what the format of these entries is. Is it documented somewhere? |
It's easy to figure it out : 17 positions from GPIO0 to GPIO16, on each position you define what it does : KEY, LED, RELAY etc. |
And the 0's are what? Not connected? |
Or not used. |
The HC-SR501's I ordered arrived today. I hope to try hooking one up to an ESP-01 this weekend. I'll share my results. |
I've added the following to the bottom but it's complaining about too many initialisers:
Not seeing where I'm messing up. EDIT: I can see where I'm messing up now.. The name is counted as one of the items in the array and I totally missed that. Does this mean that GPIO16 is unsupported? EDIT2: Scratch that. It doesn't seem to matter what I do it still complains that there are too many initialisers:
Doesn't like this either. |
Hint: Perhaps you need to change something on line 58 too... BTW I do not support so many GPIO_USER pins as the sensor code is not re-entrant. YMMV. |
DOH!! Thank you! I totally missed that.. Compiling fine now. I don't see myself using more than I2C plus a motion sensor at this stage. It's more a matter of choosing the GPIo's they go on than anything. Looking forward to trying this out. |
Well up until now things were working fine, but are no longer working fine.. I updated via USB.. perhaps the cause of the problems? And after updating it started to use the default project wifi access point settings.. So I changed (both) to my access point and re-uploaded.. STILL trying to use the old ones.. Not sure WTF I've done but hopefully I can figure it out. Any tips are welcome. EDIT: IT insists on doing this even though these strings do not exist in the firmware and I've written other programs to the device trying to clear it:
Now obviously this isn't a problem with the firmware but with the differences in the device I am using.. But I suspect that there must be a way to clear the SPIFFS filesystem of any remnant configurations? |
For a good start just use GPIO_KEY1, GPIO_KEY2, GPIO_LED1, GPIO_LED2 etc and leave other as GPIO_NONE and see if it works.. |
It doesn't matter what I do.. It's permanently stuck on the old default access points and then commits suicide. Used to work fine for me too but after adding it to the module types it's not working anymore and even if I revert to the original code the problem persists.
|
Hint 1: CFG_HOLDER |
Thank you! CFG_HOLDER was the key. I'd never needed to use it before so it seems it sort of became invisible to me. Still falls over if I try to switch to my Huzzah template so I will try KPK75's suggestion to simplify the number of GPIO's I make available. |
I can't get my defined Huzzah module to work. Whenever I choose it It crashes the firmware and then restarts with Sonoff Basic preselected. As an example here's a log of Me choosing User Test Module, which works fine, and then Huzzah which crashes and resets to Sonoff Basic:
And here's my definition of Huzzah:
I'm certain that there must be something I am overlooking. |
I can reproduce and will investigate...... Quick solution is change line 2069 in |
3.9.11 20170204 * Fix command I2Cscan * Fix not allowed spaces in Topic, ButtonTopic and SwitchTopic * Make all TELEMETRY, STATUS and COMMAND message topics unique (#4) * Advertise command topic to be used by iobroker (#299) * Fix butten (non)detection if no GPIO_KEY1 is defined (#13) * Change WeMo serialnumber from 7 decimal chars to 8 hexadecimal chars (#18) * Update web page with Build Date/Time, Emulation and mDNS Discovery and Advertise information (#21)
3.9.11 20170204 * Fix command I2Cscan * Fix not allowed spaces in Topic, ButtonTopic and SwitchTopic * Make all TELEMETRY, STATUS and COMMAND message topics unique (#4) * Advertise command topic to be used by iobroker (#299) * Fix butten (non)detection if no GPIO_KEY1 is defined (#13) * Change WeMo serialnumber from 7 decimal chars to 8 hexadecimal chars (#18) * Update web page with Build Date/Time, Emulation and mDNS Discovery and Advertise information (#21)
You sir are a champion of the people! It all works perfectly :) And splitting up the STATE and SENSOR is very helpful too. |
3.9.11 20170204 * Fix command I2Cscan * Fix not allowed spaces in Topic, ButtonTopic and SwitchTopic * Make all TELEMETRY, STATUS and COMMAND message topics unique (arendst#4) * Advertise command topic to be used by iobroker (arendst#299) * Fix butten (non)detection if no GPIO_KEY1 is defined (arendst#13) * Change WeMo serialnumber from 7 decimal chars to 8 hexadecimal chars (arendst#18) * Update web page with Build Date/Time, Emulation and mDNS Discovery and Advertise information (arendst#21)
3.9.11 20170204 * Fix command I2Cscan * Fix not allowed spaces in Topic, ButtonTopic and SwitchTopic * Make all TELEMETRY, STATUS and COMMAND message topics unique (arendst#4) * Advertise command topic to be used by iobroker (arendst#299) * Fix butten (non)detection if no GPIO_KEY1 is defined (arendst#13) * Change WeMo serialnumber from 7 decimal chars to 8 hexadecimal chars (arendst#18) * Update web page with Build Date/Time, Emulation and mDNS Discovery and Advertise information (arendst#21)
Although specified as requiring at least 5V it is possible to run them at 3.3V without any problems as per http://techgurka.blogspot.com.au/2013/05/cheap-pyroelectric-infrared-pir-motion.html
Publishing state changes via MQTT would allow for all sorts of interesting automation.
Regards,
Michal
The text was updated successfully, but these errors were encountered: