OpenGarage › Forums › OpenGarage Firmware › Fork with MQTT, Magnetic Sensor support ,Close if left open at night – misc
- This topic has 81 replies, 7 voices, and was last updated 6 years, 8 months ago by andyss.
-
AuthorPosts
-
August 26, 2017 at 11:41 pm #603
lawrence_jeffParticipantRay (or anyone else)
I forked your 1.0.6 and incorporated the MQTT code floating around in the forum (with some improvements). Also added support for magnetic or contact switches. On the automation side also added a built in function to close the door at a certain time at night.Incorporated everything into option pages (attached) to make it consistent with your design/code. Also tried to use your conventions and match your code where possible. I would be happy to try to pull some of this into your base if you have any interest – I tried to make somewhat modular commits so it would be easy to incorporate any pieces you are interested in.
https://github.com/lawrence-jeff/OpenGarage-FirmwareIf anyone sees any issues with it let me know.
Note – these changes will not show up in the mobile app – only the integrated webpage.- This topic was modified 7 years, 2 months ago by lawrence_jeff.
- This topic was modified 7 years, 2 months ago by lawrence_jeff.
Attachments:
You must be logged in to view attached files.August 31, 2017 at 1:22 pm #615
CuriousGParticipantAm I missing something or do we have to download your whole repository along with all the other prerequisites and compile it in order to get the .bin file?
August 31, 2017 at 8:07 pm #616
lawrence_jeffParticipantIts more geared right now for someone familiar with the development process (especially those who are using some of the other dev MQTT builds). If you are confident in worse case re flashing with the stock firmware over USB I have uploaded a compiled version here
https://github.com/lawrence-jeff/OpenGarage-Firmware/tree/master/CompiledI have noticed some weird things with the pages not updating after update either through the web or USB – so I now flash it with a blank bin first.
September 1, 2017 at 9:58 am #617
CuriousGParticipantAt least you can upload through the web. I’m not looking forward to getting the ladder out, move the car, press the button just so I can flash it. At least with OpenSprinkler it’s on the ground level.
September 2, 2017 at 3:20 pm #618
CuriousGParticipantSo I finally got around to manually updating the firmware by going the USB route since OTA does not work for me. I’m coming from v1.04 to your v1.06 since it appears to have more features than the standard firmware.
Not finding the IFTTT settings within the Android or iOS app threw me for a loop when I was able to find the settings through a web browser then it occurred to me that you took the screenshot from a mobile browser.
After getting Alexa to work through IFTTT and not providing me with satisfactory notifications, I went back to installing the Blynk app just to get notifications I was enjoying with v1.04. Now I find out that you only get notifications if you leave your door open for X amount of minutes. Then I thought leaving the notifications for 0 minutes would be smart but it just kept sending me notifications repeatedly.
September 4, 2017 at 9:31 am #619
lawrence_jeffParticipantSorry I didn’t get an alert for some reason on your post so just saw it a bit ago.
If I understand you correctly, prior to my firmware if you had the Notify or close option selected in the Close door after being open for X minutes section you would also get a Blynk notification each time the door opened and closed (independent of whether it met the criteria for open after X minutes)? Is this correct?I had changed this code a bit because it seemed two unrelated things somewhat co-mingled and I had intended to add a checkbox that allowed you to specify Blynk open and close notifications that was separate from the notify if the door has been open option. I have added that code back in for backwards compatibility and uploaded a compiled binary with that change. Like the original 1.0.6 it does require that you have one of the two options selected under the Close door after X minutes section (the time doesn’t matter)
Be aware that this change is merged in with a number of others so you get some other new things that may or may not be wanted. I don’t forsee any issues with anything else but you never know. This version adds a status graphic to the home page which is only going to work if you do a full upload via arduino so if you just upload the bin it will display a dead picture link if you hit the main page (doesn’t really hurt anything).
Of course just putting the stock 1.0.4 or 1.0.6 back on should fix it as well.
September 5, 2017 at 2:22 pm #626
CuriousGParticipantLet me see if I can clarify. Firmware 1.04 didn’t have any options for notify. It just did it from within Blynk whenever the garage door opened and closed. Also I went straight from 1.04 to your 1.06 so I don’t know the behavior of 1.05 or 1.06.
I’m up to try your updated version just to see what is new. The only problem is I have to get the ladder out to upload by USB again. It’s a PITA that web OTA does not work for my OpenGarage.
FYI, I do like that Blynk is reminding me every X amount of minutes that my garage door is open.
- This reply was modified 7 years, 2 months ago by CuriousG.
September 5, 2017 at 3:16 pm #628
lawrence_jeffParticipantGotcha- From seeing people ask in the forums and looking at the code, in 1.0.6 the notify on change was moved into the function that handles the notify if leave it open for X minutes, so unless you had one of those options selected (notify or auto-close) the notifications aren’t sent. I made it worse by completely turning these off in the version you originally tested, now the behavior is returned to what 1.0.6 stock does where one of those has to be selected for these to be triggered. So either in Stock 1.0.6 or my 1.0.6 you can get them back as long as you select the notify me when left open (or auto-close). Its on my list to expose this separately as co-mingling two unrelated settings doesn’t seem ideal.
Honestly – the main benefits to mine are the MQTT support, support for a magnetic door sensor (for DIY implementations) and improvements to the web based experience. Unless these are of interest you might not get much beyond the stock 1.0.6, especially if you are primarily using the mobile app.
But if you are the experimental type feel free to give it a shot, I’m happy to fix anything else you catch.September 5, 2017 at 3:22 pm #629
CuriousGParticipantI have confirmed that open/close Blynk notifications have returned. I am starting to use Home Assistant so the additional features could be beneficial to me.
I uploaded the blank.bin and then your firmware afterwards using esptool.exe and it is not showing the graphic.
September 5, 2017 at 6:25 pm #630
lawrence_jeffParticipantYes -mentioned above the graphics wouldn’t work unless you use the arduino env to upload the Spiffs file that includes them (this is separate from the code bin). I haven’t tested using another tool but it looks like what it does is upload a second bin to address 00300000. I have uploaded it to the bin folder in my repository you can give it a shot if so inclined, the ESPtool or equivalent should take it with the address and create a new filesystem with the graphic files included. IMPORTANT NOTE: this will erase any existing configuration files so the device will be reset to a factory default and you will have to go through the process again to enter your SSID and all application tokens/config settings.
My choice of graphics was a green closed door when shut and red open door when opened. To me this represented the security of the door but I noticed the official mobile app uses the opposite convention in the logs (green indicates opening and red indicates closing).
In terms of home assistant or other automation software, its not out there in the repo yet but I have tweaked the API code to allow you to submit a close or open request where it will only act if applicable (i.e. it won’t open if already open) in the existing code you send a click and have to hope that the current represented state is correct – this may be useful as it simplifies what an external system needs to do. I haven’t added this logic into the MQTT piece but plan to soon.
September 7, 2017 at 11:13 am #640
CuriousGParticipantThanks for all the changes you’ve incorporated. I have a request if it’s possible to implement. Since OTA web update doesn’t work for me, is it possible to simulate pressing the reset button down for half a second or second upon power so that the device goes into programming mode or some other means to go into programming mode without having to physically press the button? This way I can just use a stool to reach the USB cable and plug into the computer to reprogram rather than climb up on a ladder with the computer and awkwardly hold down the reset button while plugging in the USB cable.
Second you may consider this a bug or oversight. I have the speaker turned off in the settings but your quick beep on status change is not honoring the speaker setting. I don’t mind this short beep at all and the only reason I turned off the speaker was I didn’t like the sounds coming from the original firmware. So you may want an option for the quick beeps to continue as an option (my choice) or honor the speaker settings.
Forgot to mention that Blynk notifications for Android seems to be broken again. It only works for me if the program is running in the foreground. I installed it on an Android tablet in addition to a Nexus 5X that is running Oreo and neither gets notifications. That isn’t your problem but I just want confirmation if it is working for anyone else since the last Blynk update like 3 days ago. On iOS I get all the notifications.
September 7, 2017 at 1:17 pm #644
lawrence_jeffParticipantLet me think about the USB programming question – Any idea why OTA doesn’t work for you? Have you tried with my version lately? I changed how reset works in an earlier update which made it more reliable for me, although I still notice if the wifi signal is weak it still fails. Sometimes trying 2 or 3 times in a row will make it go through. I was going to try to add a system log to help debug these odd ball things that are hard to repro outside of the actual garage.
On the sound – yes I agree the sound option should be honored or selectable in some other way, let me see if that can be easily incorporated, I was originally thinking it should only beep when the door is opening/closing (which is loud by itself) but it still could annoy some people.
September 7, 2017 at 1:22 pm #645
lawrence_jeffParticipantOn your blynk question I will turn this on when I am home to see if I see the same thing, I would try making sure Blynk is set to be excluded from data saver and allowed background network access, it may be Android battery optimization not allowing it to get the notification (when not running in the foreground)
September 7, 2017 at 1:49 pm #646
CuriousGParticipantI have no idea why OTA doesn’t work. No one has suggested a workaround which is why I’m manually updating by USB. I have tried rebooting it through web interface, powering it off. Doesn’t matter how many times, it just never works for me. I just get the Update Failed message. I’ve flashed it with the blank .bin file both times hoping it would make things different. I’ll check what my WiFi signal reports later but I don’t think that is the issue especially with such a small file too. So it has nothing to do with your version since I originally tried with the official v1.06. I started with v1.04 and have not been able to update OTA. Perhaps, the nodemcu version he used (Ray) previously had issues as I bought mine a tad over a year to the date. The last version I tried of yours was when you just added the garage door graphics but didn’t upload the graphic .bin file yet.
On the Blynk issue, I do remember doing something with battery optimization when I updated to Oreo. That isn’t the case for the tablet, however. I’m running Android 7.x whatever the somewhat current build (within a month) of LineageOS.
September 7, 2017 at 4:56 pm #647
CuriousGParticipantSo I just checked my WiFi signal and it varied from -57 to -59dBm from the minute or so I watched it update.
edit: Seems my tablet appears to be receiving Blynk notifications now but the Nexus 5X still does not even though I went through the battery optimization options and turned off optimization for the Blynk app.
- This reply was modified 7 years, 2 months ago by CuriousG.
September 10, 2017 at 10:23 pm #659
RayKeymaster@CuriousG: if you unplug the microUSB cable, then press and hold the pushbutton onboard, then plug in the microUSB cable while holding the button, and then release the button, that will get ESP8266 into programming mode waiting for a new firmware to be uploaded. This is fairly common procedure to program ESP8266.
Note that when auto-closing the door (i.e. due to automation setting), there is a mandatory buzzer beep — this is just to conform with regulations. In case someone is working nearby the garage door, this will notify the person to avoid any potential danger (this is mandatory even though all garage door systems already have sensors to sense blockers).
@lawrence_jeff: I was just responding in another thread that the changes you made are great and will definitely take a look and integrate them into the master branch asap.September 10, 2017 at 11:53 pm #664
CuriousGParticipantRay,
I’m aware on how to get it into programming mode. The question remains why doesn’t OTA work? And for me it’s a hassle since my Opengarage unit is mounted up high with double stick tape. Because the unit is mounted, I have climb up a ladder while bringing up Surface along with me, then I have to hold the USB cable near the port while I hold on to the button as I plug in the USB cable. Certainly not advisable to do and I wouldn’t if I could get OTA to work.
September 20, 2017 at 9:11 am #672
RayKeymaster@CuriousG: does your OG come with a black-colored enclosure, or a brown acrylic enclosure? The black-colored ones used a different ESP8266 chip (WROOM-02) and I don’t quite remember whether OTA update has been tested for that chip — it should work, but perhaps some compilation settings need to be changed to fit that chip.
September 20, 2017 at 1:13 pm #675
CuriousGParticipantIt is the black enclosure. It was purchased 9/5/16 order #6607 if that helps. I do anticipate I will flash it further with Jeff’s firmware changes so if I can get the firmware to work OTA that would help immensely. I can’t be the only older OpenGarage user attempting to flash OTA. I’m open to compile changes to try if you’re so inclined to give me instructions.
Also the wording on this part is confusing from your compilation instructions:
Copy the OpenGarage library to your Arduino’s libraries folder. You also need to update a file in the ESP8266 core and Blynk library. See README.txt in the Modifications folder for details.
In the modifications folder it only makes reference to esp8266. Is that the only file that needs to be replaced or is there one in the Blynk directory also? The folder location is in %appdata%/Arduino15 for those using Windows. That was a hassle to find.
September 20, 2017 at 1:21 pm #676
lawrence_jeffParticipantYes – you only need to change the one file, the instructions probably changed at some point and not all references were updated. I noticed this when making my changes
Jeff
September 20, 2017 at 1:43 pm #677
CuriousGParticipantThanks Jeff.
I tried compiling Ray’s original 1.06 firmware and had errors then switched to your firmware and this is the result I got:
Arduino: 1.6.5 (Windows 7), Board: "Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 115200, 4M (1M SPIFFS), ck, Disabled, None" In file included from C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include/arch/cc.h:39:0, from C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include/lwip/arch.h:43, from C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include/lwip/debug.h:35, from C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include/lwip/opt.h:46, from C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include/lwip/tcp_impl.h:35, from ogMainArduino.ino:22: C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/include/ets_sys.h:168:5: error: previous declaration of 'int atoi(const char*)' with 'C++' linkage int atoi(const char *nptr); ^ In file included from c:\users\User\appdata\roaming\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2\xtensa-lx106-elf\include\stdint.h:12:0, from c:\users\User\appdata\roaming\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2\lib\gcc\xtensa-lx106-elf\4.8.2\include\stdint.h:9, from C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/include/c_types.h:8, from C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include/arch/cc.h:38, from C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include/lwip/arch.h:43, from C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include/lwip/debug.h:35, from C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include/lwip/opt.h:46, from C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include/lwip/tcp_impl.h:35, from ogMainArduino.ino:22: c:\users\User\appdata\roaming\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2\xtensa-lx106-elf\include\stdlib.h:70:5: error: conflicts with new declaration with 'C' linkage int _EXFUN(atoi,(const char *__nptr)); ^ In file included from C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include/arch/cc.h:39:0, from C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include/lwip/arch.h:43, from C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include/lwip/debug.h:35, from C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include/lwip/opt.h:46, from C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include/lwip/tcp_impl.h:35, from ogMainArduino.ino:22: C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/include/ets_sys.h:183:6: error: previous declaration of 'void ets_intr_lock()' with 'C++' linkage void ets_intr_lock(); ^ In file included from C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiClient.h:25:0, from C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/ESP8266WiFi.h:39, from ogMainArduino.ino:23: C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/Arduino.h:137:20: error: conflicts with new declaration with 'C' linkage void ets_intr_lock(); ^ In file included from C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include/arch/cc.h:39:0, from C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include/lwip/arch.h:43, from C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include/lwip/debug.h:35, from C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include/lwip/opt.h:46, from C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/lwip/include/lwip/tcp_impl.h:35, from ogMainArduino.ino:22: C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0/tools/sdk/include/ets_sys.h:184:6: error: previous declaration of 'void ets_intr_unlock()' with 'C++' linkage void ets_intr_unlock(); ^ In file included from C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiClient.h:25:0, from C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/ESP8266WiFi.h:39, from ogMainArduino.ino:23: C:\Users\User\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/Arduino.h:138:22: error: conflicts with new declaration with 'C' linkage void ets_intr_unlock(); ^ Error compiling. This report would have more information with "Show verbose output during compilation" enabled in File > Preferences.
September 20, 2017 at 1:51 pm #678
lawrence_jeffParticipantThat doesn’t ring any bells, do you get the same issue with Ray’s?
Does a basic ESP8266 example compile?I can install it all from scratch on a different machine tonight to see if there are any steps missing but as I recall I just followed the instructions and didn’t have any trouble getting it to compile.
Jeff
September 20, 2017 at 2:04 pm #681
CuriousGParticipantGrrr somehow when editing my last reply it doesn’t show up but it sensed I already had a duplicate post. Here it is again.
After I edited the missing libraries from Ray’s firmware, this is the result
Arduino: 1.6.5 (Windows 7), Board: "Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 115200, 4M (1M SPIFFS), ck, Disabled, None" OpenGarage\main.cpp.o: In function
blynk_count_millis()’:
C:\Users\User\Documents\Arduino\libraries\blynk-library-master\src/Blynk/BlynkEveryN.h:7: multiple definition of `blynk_count_millis()’
ogMainArduino.cpp.o:C:\Users\User\Documents\Arduino\libraries\blynk-library-master\src/Blynk/BlynkEveryN.h:7: first defined here
OpenGarage\main.cpp.o: In function `blynk_count_seconds16()’:
C:\Users\User\Documents\Arduino\libraries\blynk-library-master\src/Blynk/BlynkEveryN.h:12: multiple definition of `blynk_count_seconds16()’
ogMainArduino.cpp.o:C:\Users\User\Documents\Arduino\libraries\blynk-library-master\src/Blynk/BlynkEveryN.h:12: first defined here
OpenGarage\main.cpp.o: In function `blynk_count_minutes16()’:
C:\Users\User\Documents\Arduino\libraries\blynk-library-master\src/Blynk/BlynkEveryN.h:18: multiple definition of `blynk_count_minutes16()’
ogMainArduino.cpp.o:C:\Users\User\Documents\Arduino\libraries\blynk-library-master\src/Blynk/BlynkEveryN.h:18: first defined here
OpenGarage\main.cpp.o: In function `blynk_count_hours8()’:
C:\Users\User\Documents\Arduino\libraries\blynk-library-master\src/Blynk/BlynkEveryN.h:24: multiple definition of `blynk_count_hours8()’
ogMainArduino.cpp.o:C:\Users\User\Documents\Arduino\libraries\blynk-library-master\src/Blynk/BlynkEveryN.h:24: first defined here
OpenGarage\main.cpp.o: In function `std::_Function_handler<void (), void (*)()>::_M_invoke(std::_Any_data const&)’:
c:\users\User\appdata\roaming\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2\xtensa-lx106-elf\include\c++\4.8.2/functional:2031: multiple definition of `Blynk’
ogMainArduino.cpp.o:(.bss.Blynk+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
Error compiling.`I was able to compile the esp8266 Blink example without a hitch. I don’t know if running under Windows is part of the issue.
September 22, 2017 at 12:26 pm #683
lawrence_jeffParticipantOk – finally had a chance to look at this – I took a clean Win10 laptop and went through all the steps successfully. Here is what I did
*Installed Arduino 1.6.13
*Once installed installed 2.3.0 of the arduino esp8266 core via board manager
*Installed the latest Blynk software via Manage Libraries
*Manually added the pubsubclient my version also requires (https://github.com/Imroy/pubsubclient) download and then extract the pubsubclient-master folder to your libaries folder (by default in the my documents/Arduino/Libraries) rename this folder after copy to pubsubclient
*Downloaded my fork via the download option in github and then extracted the opengarage folder to the same libraries folder
* Copied the modifications header file from the zip to the folder in C:\users\YourID\Appdata\Local Settings\Arduino\…… (per the instructions)So at this point if you open your libraries folder you should see
Blynk
OpenGarage
PubSubClientThen go into Opengarage\Examples – open the ino file
In arduino select Generic ESP8266 – 4/1 SpiffsCompile
No issues on my system
- This reply was modified 7 years, 2 months ago by lawrence_jeff.
September 22, 2017 at 12:47 pm #685
lawrence_jeffParticipantI updated the readme’s of my fork to hopefully make this process more clear – reference that instead of this post and let me know if you still have issues
-
AuthorPosts
- You must be logged in to reply to this topic.
OpenGarage › Forums › OpenGarage Firmware › Fork with MQTT, Magnetic Sensor support ,Close if left open at night – misc