X10 Community Forum

📱🖥️PiX10Hub => 💬General Discussion => 📝User created HG Scripts (programs/macros/widgets) => Topic started by: Tuicemen on February 22, 2019, 08:29:12 AM

Title: 📧HG Smart E-mailer
Post by: Tuicemen on February 22, 2019, 08:29:12 AM
mike inspired me to create this which essentially gets rid of 95% of my email scripts. :)%
Thanks mike!
This adds the option to email the specified email addresses (yes you can specify as many as you like) when the module is switched on.
This works for all HG device types (Lights, Switches, Dimmers, Sensors, Door/Window, Sirens…..)
I've tested this with X10, Zwave, Philps Hue, WeMo, Virtal Devices, and Ha-Bridge configured devices. So virtually anything you wish to be informed of when turned on, opened or switches to a status of 1, is now just a few simple clicks to setup. ;)
Download and rename the attached txt file to E-mailer.zip and unzip then from HG Messaging and Social click actions and import program.
browse to the unzipped E-mailer folder and click on 1016-Smart_E-mailer.hgx to install it.
if you have any Ideas to expand on this programs possibilities feel free to suggest them or If your into coding add them your self.
However if you do modify please share your improvements or fixes.
Questions are never to dumb so ask away! ;)
Use at your own risk! I can't be responsible for you spamming your self or others! rofl
Note: The link for version 2 which includes more options can be found further down in this thread http://forums.x10.com/index.php?topic=30881.msg181710#msg181710 >!
Title: Re: HG Smart E-mailer
Post by: mike on February 22, 2019, 10:42:58 AM
looks great!  I unremarked your debug line as I want to see what it is trying to send (especially now since my send does not work).

but I have an issue... after importing it & enabling it, I have lost ability to go to my 9 of my 11 groups;  click on them and HG just hangs until I pick one of the 2 of 11 that DO open...

One of my fan modules is gone from both those working screens too;  just erased off the pages!...   AND that A16 module is gone from the x10 module list, and so my two schedulers (one to turn it on, the other to turn it off) do not show it any longer under modules...

Under config, the non opening groups hang also and do not open - like they do not exist any longer?

programs won't open to let me turn the emailer off...

most other config windows are locked also...

reboot of pi next...





Title: Re: HG Smart E-mailer
Post by: Tuicemen on February 22, 2019, 10:51:32 AM
The program does take a bit to load as it has to find all devices in HG and add the options to each device.
A reboot may help with that.
The debug just states what the program is attempting to send for a message it will not show you problems with your email.
Also not having the required program for solar time will cause the dusk dawn condition not to work.
I suspect everything else will work if the dusk dawn setting isn't selected.
Title: Re: HG Smart E-mailer
Post by: Tuicemen on March 10, 2019, 08:02:51 PM
I've been thinking of adding some improvements to this.
Currently it sends a standard message of the Time and the module name that was turned on or opened, so I'm thinking of adding a custom message option which would over ride the default one if entered.
The custom message would be be preceded by the time the device was triggered.

I also had considered adding specific email recipients addresses for each, but I think that just adds more to setup for each modules emailer. ::)

Title: Get a Text when a module is turned on!
Post by: Tuicemen on March 10, 2019, 08:26:17 PM
Some may already know this, but for those that don't, this will send a text notification to your phone if the address is entered in the email options.
A SMS is just a simple e-mail using your phone number followed by your carriers @ info!
I posted a list of carrier address info some time ago which may have the info required.
http://forums.x10.com/index.php?topic=17747.msg115065#msg115065
Google may have a newer more up to date list of carriers sms info.
>!
Title: Re: HG Smart E-mailer
Post by: bkenobi on March 11, 2019, 11:37:25 AM
Email to SMS does work well and I've done that through HG in the past so it's definitely possible with Verizon at least.
Title: Re: HG Smart E-mailer
Post by: Tuicemen on March 11, 2019, 12:05:11 PM
I've done it in the past with Rogers as well as Telus Mobility.
I can confirm it works with Telus Mobility in HG
 >!
Title: Re: HG Smart E-mailer
Post by: mike on March 11, 2019, 12:24:37 PM
Email to SMS does work well and I've done that through HG in the past so it's definitely possible with Verizon at least.

You need HG email working first though.  I still cannot get simple email to send from HG.  HG remembers one email account setting and won't change it on my pi's.  The account data is stored in some obscure location I have not yet found so I cannot delete it.
Title: Re: HG Smart E-mailer
Post by: bkenobi on March 11, 2019, 03:39:10 PM
If I remember correctly, Gene used Base64 encryption to store some sensitive data.  It's not security, but at least it keeps things from being directly searched for I suppose.  On the other hand, it means that you can't easily locate some things that I think should be exposed (scheduler events used to be done this way but may not any more).  I don't know where the settings for things are located anymore, but a lot of your config should be in the main HG folder.
Title: Re: HG Smart E-mailer
Post by: Tuicemen on March 12, 2019, 10:50:33 AM
I've been playing over some scenarios in my head for using this.
I do see times when I may wish a text instead of a email or the other way around for a particular module turning on.

It might be best to have a optional recipient input field which would over ride the other email recipients listed saved.
Any thoughts on this?
Title: Re: HG Smart E-mailer
Post by: mike on March 12, 2019, 11:24:44 AM
You're doing wonderful things with this tuicemen.  I hope to be able to try your module update to include emailing soon!

bKenobi, thanks.  That makes sense and is surely it.  I have now been able to see the 'correct' email account settings (in base64 code) in systemconf.xml file, compared them to the non changing ones in my working HG pi file.  I copied them from the working pi file to non working pi - and still no send.  But at least they show correctly now in settings- Options.  Next to check log again for why it is still not sending...
Title: Re: HG Smart E-mailer
Post by: mike on March 12, 2019, 11:43:24 AM
I'm going to circle back soon and try your new email notification adder to modules!  My HG is emailing finally!  Yahoo!  Copying the account data over did not fix it after restarts and reboots.  BUT UPGRADING HG FROM STABLE.37 TO STABLE.39 DID FIX IT! 
Title: Re: HG Smart E-mailer
Post by: Tuicemen on March 12, 2019, 01:08:08 PM
I've not update this yet, thought I do have options I've commented on thus far running to test how well they'll perform.
I've also fixed the warnings about outdated code so going forward HG shouldn't have a issue.
I may add other options prior to the next release build if I or anyone else thinks of something useful. ;) ;)
 >!
Title: Re: HG Smart E-mailer
Post by: mike on March 14, 2019, 09:01:28 AM
If you want a tester send me a copy to install.  If not, post as soon as you can;  I will wait.  Thanks.
Title: Re: HG Smart E-mailer
Post by: Tuicemen on March 14, 2019, 09:11:02 AM
Thanks Mike, I realy don't need any testers what I have now works!
I doubt I'll get anything posted till next week now, this is one reason why I asked for option suggestions.
I don't plan to continue adding to this once I've posted the next version and I've ran out of ideas. ::) :'
 >!
Title: Re: HG Smart E-mailer
Post by: mike on March 15, 2019, 08:29:26 AM
Just wanted to report back:  I imported your smart emailer last night, used it on all my door sensors with send if door opened.  Alarm set and I made it thru the night with no emails.  This morning, alarm turned off automatically as normal, then we went thru 2 of the doors:  I got emails each time!  GREAT!  THANK YOU!

Now I just need to see where you decide if the alarm is set or not;  without looking yet, I assume you watch the HG built in alarm arm.  Of course I am not using that as I use a module that sends HA-bridge command to send RF security ARM command to my SC1200.  I assume it will be easy to find that IF line and change it to look at my module instead.

EDIT:  just peeked.  So you use Arm.IsOn & Arm.IsOff...   I would like to use my arm module that sends habridge command instead...

As an aside, is there any reason to try to incorporate the HG security console instead/also?
Title: Re: HG Smart E-mailer
Post by: mike on March 17, 2019, 02:56:20 PM
I just thought of your dusk/dawn routine choice...  so I turned it on;  it thinks dusk begins at 2pm haha!  I neglected to put in lat/long.  ANYWAY, I suspect this choice will be sufficient to match up close enough to my use of turning on/off the ARM alarm.  THANKS again!  If it works tonight, I am sending you a nice donation my friend!
Title: Re: HG Smart E-mailer
Post by: Tuicemen on March 19, 2019, 02:13:07 PM
Now I just need to see where you decide if the alarm is set or not;  without looking yet, I assume you watch the HG built in alarm arm.  Of course I am not using that as I use a module that sends HA-bridge command to send RF security ARM command to my SC1200.  I assume it will be easy to find that IF line and change it to look at my module instead.

EDIT:  just peeked.  So you use Arm.IsOn & Arm.IsOff...   I would like to use my arm module that sends habridge command instead...

As an aside, is there any reason to try to incorporate the HG security console instead/also?
I use a HA-Bridge command to arm my ds7000 however I also have a script that when the arm signal is seen it arms the HG security.
This allows me to see the condition of my security system when not home, as well I can watch the condition of my security system to trigger other events. For example sending me snap shoots from all my IP cameras if my security system is tripped.
Or you could send only snap shots from a camera watching a door  if opened but only when your system is armed.
 There are lots more reasons to have the HG security module setup, but I can only think of one reason not to have it setup.
Title: Re: HG Smart E-mailer
Post by: mike on March 20, 2019, 09:32:46 AM

I also have a script that when the arm signal is seen it arms the HG security.

Sounds like good way to go.  Mind sharing your script?  I am thinking it is a little program?
Title: Re: HG Smart E-mailer
Post by: Tuicemen on March 20, 2019, 09:56:49 AM
the scripts are simple wizard scripts that arms and disarms the security system simular to these: http://forums.x10.com/index.php?topic=30855.msg180780#msg180780
instead of watching for the arm/disarm status I watch for the Raw RF.
If you used a Keyflob for setting up your Broadlink use it if you used the sh24 use its code.
Title: Re: HG Smart E-mailer
Post by: Tuicemen on March 21, 2019, 08:33:51 AM
Here is version 2 that adds some extra optional custom message options which override other settings if used.
Use the same install directions as Originally posted.
Updated: to fix arm/disarm time sends
  >!
Title: Re: HG Smart E-mailer
Post by: mike on March 21, 2019, 10:11:44 AM
Thanks.  Is there an easy way to UPDATE the old one already installed?  Will IMPORT override and update or do I need to delete present and then import the new version?  I just don't want to loose the present settings on each of my DS10 switches...
Title: Re: HG Smart E-mailer
Post by: bkenobi on March 21, 2019, 11:00:32 AM
When you import a program, it will be given an ID.  That ID is how HG references things internally.  So, if you import a new version rather than updating the code, you will have to change the settings on your modules.  It is technically possible to modify the settings file from the command line/nano in order to redirect HG to use the new ID.  With your skill level, I would not recommend that.  Either copy/paste the code in your existing program or import the new module and set up the modules to use the new APP.
Title: Re: HG Smart E-mailer
Post by: mike on March 21, 2019, 11:15:31 AM
Thanks.  I am comfortable copy/paste the new code in place of the old. 
Title: Re: HG Smart E-mailer
Post by: Tuicemen on March 21, 2019, 12:09:35 PM
I had no issues just deleting the old version and then adding the new version all my settings remained.
Copy and pasting the code is probably just as easy, less can go wrong.
Title: Re: HG Smart E-mailer
Post by: mike on March 21, 2019, 02:01:57 PM
I thought changing the .hgx name would change the prog name but it did not;  so I have two now, my active one and the  new one.  I cc/pasted prog and startup over; it complained - you reverted back to the obsolete input instead of options lines I think.  But still should work...
Title: Re: HG Smart E-mailer
Post by: Tuicemen on March 21, 2019, 02:33:26 PM
In order to rename the program it must be done in HG after intalling.

I also tried removing (deleting) the old Smart E-mailer in another PI then installing the new one and settings were not maintained  ::) :'. it probably has something to do with what was installed last. ???
Cut & paste is the best option for a large setup.
Title: Re: HG Smart E-mailer
Post by: mike on March 21, 2019, 02:58:33 PM
I imported it, copied from it and pasted into my active Smart Emailer program, and never activated the new imported one - just used it to easily cut/paste.

Now none of X10 stuff works.   I tell you, if I can break it I will!

I tried restarting HG from maint menu, no change.  No x10 RF seen by HG. 

Rebooted pi...   looking like all back to working!  WHEW!
Title: Re: HG Smart E-mailer
Post by: mike on March 21, 2019, 03:02:25 PM
Curious:  why is there a choice to enable emailings?  All my  sensors have it unchecked now after cc/paste.  I had checked them AND dusk/dawn.  Now only duck/dawn is checked.  Does this mean they will not send email anymore?

Title: Re: HG Smart E-mailer
Post by: Tuicemen on March 21, 2019, 03:10:23 PM
The enable emailing check box tells the program to run when the module is switched on. If unchecked emails will not be sent. All other check boxes and text inputs are optional.
You must go to settings then smart e-mailer to set a universal email address to send to if you only have the enable emailing checked. The option tab also should appear in the summary screen (bottom left) if program is enabled.
Title: Re: HG Smart E-mailer
Post by: mike on March 21, 2019, 04:23:23 PM
the scripts are simple wizard scripts that arms and disarms the security system simular to these: http://forums.x10.com/index.php?topic=30855.msg180780#msg180780
instead of watching for the arm/disarm status I watch for the Raw RF.
If you used a Keyflob for setting up your Broadlink use it if you used the sh24 use its code.

Wow my Canadian friend.  In the last couple weeks you have taken my HG to new levels, to which I can hardly keep up.

I now have emails when security things are triggers (little FYI - I get 2-3-4-5 emails when it happens - but at least it happens so I am tickled pink!)

I now have the HG internal security thing arming and disarming from my x10 remotes so I can eliminate the 30-50 minute dawn times it emails me AFTER I turn off the SC1200 (we must open doors 30-50 minutes BEFORE dawn to feed the animals).

This HG alarm seems to open the doors to triggering from OTHER than x10 devices also!  I am a big fan of Wyzecam.com cameras.  I am in their alpha and beta program and thus testing door sensors & IR motion sensors that work with their $ 20.00 wifi/internet/1080p/pan-tilt motion detecting cameras.  These can be accessed thru cell phone, IFFT.  And RTSP is coming soon to add them to my wired and other wifi DVR cameras on HD drives and BlueIris.  I can see a day when all this can be incorporated into HG...

Go have a beer/wine/adult-beverage on me my friend.  I will pay for it via paypal soon!

Title: Re: HG Smart E-mailer
Post by: Tuicemen on March 21, 2019, 06:01:53 PM
Glad to see you enjoy the Smart E-mailer program and it is working well for you. :)%
I created it so you can trigger e-mails from virtually any device configured in HG even virtual devices (not just security sensors).
With a little creativity I'm sure you can get your emails down two just one per event.
I've been playing with Wemo devices and the HG code for those devices using this emailer. Originally it was triggering every status update check but no longer so I suspect other device code may also need some tweaking to prevent false email alerts.

The custom recipient and message options allows you to send more personal emails or texts messages to different devices from different module "On" event trips.
I'm sure other Options may present themselves down the road for this but I currently have no plans for a version 3.
 >!
Title: Re: HG Smart E-mailer
Post by: bkenobi on March 22, 2019, 10:51:33 AM
Taking nothing away from Tiuicemen's emailer, but the reason it works is because Gene spent a good chunk of the last few years developing HG with no job and no charge for the code (it's open source).  If anyone deserves gratitude, I'd highly recommend at least thanking the creator of the HA software that Tuicemen's script works within.  Writing a script is somewhat time consuming for a non-coder, so the emailer is not insignificant but it only works because the backbone is there to let it function with all of the hardware around it.

 >!
Title: Re: HG Smart E-mailer
Post by: Tuicemen on March 22, 2019, 10:56:00 AM
Taking nothing away from Tiuicemen's emailer, but the reason it works is because Gene spent a good chunk of the last few years developing HG with no job and no charge for the code (it's open source).  If anyone deserves gratitude, I'd highly recommend at least thanking the creator of the HA software that Tuicemen's script works within.  Writing a script is somewhat time consuming for a non-coder, so the emailer is not insignificant but it only works because the backbone is there to let it function with all of the hardware around it.

 >!
I agree,  Gene deserves credit for creating the backbone for which all the script (programs) are handled!
Title: Re: HG Smart E-mailer
Post by: mike on March 24, 2019, 10:51:19 AM
Tuicemen, I think I have seen you have commented a couple times you think the SH624 is more secure than the KR10A keyfob?  Isn't that backwards?  keyfob is only 24bit code while SH624 is 32bit, no?
Title: Re: HG Smart E-mailer
Post by: mike on March 24, 2019, 10:56:25 AM
I have added OR to trigger on arm/disarm scripts (programs) so different devices can be used depending on where I am.  Also one matches my HAbridge send that is on timer for automatic arm/disarm.  Altho my HAbridge arm/disarm is 100% reliable with the SC1200 alarm console, the disarm script seems less than consistent.  It seems no matter which remote I use to send disarm signal, HG sees the raw rf data fine, but the script either does not run or the HG security module ignores the disarm command.  Time will tell if it is just random missing of disarm command or if it really is inconsistent.  I will know if disarm does not 'take' as then I will get door open emails every hour from all my sensors during the day!
Title: Re: HG Smart E-mailer
Post by: mike on March 24, 2019, 11:27:49 AM
I believe the SmartEmail.Arm & SmartEmail.DisArm may not be working as expected.  dusk to dawn on and off checkmark enables emails or disables if not night, but email is sent everytime whether I check either arm or disarmed choice or not.  Ie., the only time emails are NOT sent is if dusk/dawn checked and it is daytime;  all other times email is sent no matter the condition of the HG security module.  Of course if enable email is not checked no email is sent also.

I will turn on your debug comments later and test some more to see which routine(s) are setting Sendmail = true;
Title: Re: HG Smart E-mailer
Post by: Tuicemen on March 24, 2019, 12:36:00 PM
Tuicemen, I think I have seen you have commented a couple times you think the SH624 is more secure than the KR10A keyfob?  Isn't that backwards?  keyfob is only 24bit code while SH624 is 32bit, no?
I may have stated that though I don't remember ::) :' the SH624 doesn't show up in HG as a security remote like the KR10A does so only a SH624 that is configured in HG will work for HG unlike the KR10A.
Currently once you have a Kr10A setup in HG any KR10A is seen by HG as the configured Keyflob so they aren't as secure in a HG setup. I've raised this issue with Gene on GitHub and it is marked as a enhancement. Current HG code technically removes any security the KR10A has. Even if your using the Broadlink to transmit a learned KR10A it is seen as a Keyflob.
Title: Re: HG Smart E-mailer
Post by: Tuicemen on March 24, 2019, 12:43:45 PM
I believe the SmartEmail.Arm & SmartEmail.DisArm may not be working as expected.  dusk to dawn on and off checkmark enables emails or disables if not night, but email is sent everytime whether I check either arm or disarmed choice or not.  Ie., the only time emails are NOT sent is if dusk/dawn checked and it is daytime;  all other times email is sent no matter the condition of the HG security module.  Of course if enable email is not checked no email is sent also.

I will turn on your debug comments later and test some more to see which routine(s) are setting Sendmail = true;
It has been a number of HG versions ago that this was written and tested. I don't use any special setting at my city place but do at my off grid place (I believe it is running 1.2-stable.34) the newest 1.3-beta.3 may have some issues with dusk dawn as my Open Weather program which has replaced WU in HG is way off.
I don't believe I changed the order conditions were looked at with the latest smart e-mailer build but as Soon as I get time I'll play with the settings again to be sure they are working correctly.
Title: Re: HG Smart E-mailer
Post by: mike on March 24, 2019, 03:32:40 PM
Yes, I too confirmed all kr10a units work on same code.  Yes, I confirmed SH624 (less secure 24bit encoding) does NOT show up in HG as a device.  I put kr10 device OR raw.rf from my sh624 as arm/disarm units for more ease of use for me.

dusk/dawn work swell here at my lat/long on stable.39.  Changing to new beta 1,2,or3 is more cplex than just pushing an update button so I am not going there until it becomes easy again.

I will uncover your comment lines to try to see why dusk/dawn & arm/disarm do not work here as expected. 
Title: Re: HG Smart E-mailer
Post by: Tuicemen on March 24, 2019, 08:57:42 PM
I had a chance to have a quick look at the code and do some quick tests. I do see the same issues as you mike, not sure why it worked prior but not now. In any case I'll play with a bit and get it worked out looks like it is  ignoring an else statement ??? so I'll redo with else if statements and nail down the ifs with more details to watch for before tripping the email.
 >!
Title: Re: HG Smart E-mailer
Post by: mike on March 25, 2019, 09:13:52 AM
Thanks, you got it!  Enjoy  a case of your favorite beer (or wine) on me (sent via paypal).

Title: Re: HG Smart E-mailer
Post by: Tuicemen on March 25, 2019, 10:46:26 AM
Thanks, you got it!  Enjoy  a case of your favorite beer (or wine) on me (sent via paypal).
That realy wasn't necessary! But thank you!

I'll wait till you &/or I can test after dusk to be sure I nailed that part down too, before I update the link for others. ;)
Title: Re: HG Smart E-mailer
Post by: dhouston on March 25, 2019, 02:59:55 PM
Tuicemen, I think I have seen you have commented a couple times you think the SH624 is more secure than the KR10A keyfob?  Isn't that backwards?  keyfob is only 24bit code while SH624 is 32bit, no?
While it has been several years since I did hands-on testing of various X10 RF devices, IIRC, both standard and security RF devices send 32 bits. The only difference is detailed in my X-10 RF Protocol article at https://www.laser.com/dhouston/rf.html (https://www.laser.com/dhouston/rf.html)
Quote
X-10 security transmitters use a similar protocol but only one nybble of the first two bytes are bitwise complementary while the last two bytes follow the same pattern as standard X-10 RF codes.
The complementary bytes (or nybbles) are used for error checking but neither code is more secure than the other.

All RF codes (even if encrypted) are basically insecure as all a bad guy need do is capture the code and then replay it as is being done by the latest car thieves. The only RF codes that are reasonably secure are the rolling codes used with garage door remotes.
Title: Re: HG Smart E-mailer
Post by: mike on March 25, 2019, 03:18:49 PM
Hi dhouston,  glad to hear from you!

The keyfob actually sends 32 bits while the SH624 sends only 24bit code I am pretty sure.  Must be true as I read it on the internet once.   :)

But in HG it shows that code sent & it is indeed longer with the keyfox - another 2 bytes...

Anyway, we actually USE that car thief scheme to duplicate and resend the security codes with a cool little mpnkey see-monkey-do device called a Broadlink RM+ box:  gives HG non & security RF sending capability.   If a bad guy is sophisticated enough to do that at my house he deserves what he gets, whether that is my stuff, an AR-15 full of lead, Glock 45 lead, or dog bites.  My insurance swears to me they will replace any stuff he gets.
Title: Re: HG Smart E-mailer
Post by: bkenobi on March 25, 2019, 04:46:10 PM
All RF codes (even if encrypted) are basically insecure as all a bad guy need do is capture the code and then replay it as is being done by the latest car thieves. The only RF codes that are reasonably secure are the rolling codes used with garage door remotes.

I've read that it's possible to defeat rolling codes too if someone is dedicated enough to build a jammer that can save the first code sent and require the operator to send a second one.  The first is saved for later use by the criminal since the door never heard it thus making it still a valid signal.
Title: Re: HG Smart E-mailer
Post by: Tuicemen on March 27, 2019, 06:40:10 AM
The smart emailer was just updated to fix issues with sending times for armed/disarmed see post #20 for the link. ;)
http://forums.x10.com/index.php?topic=30881.msg181710#msg181710
@mike this is the version you were testing so no need for you to update.
 >!
Title: Re: HG Smart E-mailer
Post by: mike on April 03, 2019, 10:27:42 AM
Just wanted to report back that the smart emailer is working wonderfully!  I have it set to only send email when security device triggered AND alarm is ARMED.

Yesterday when I left my office I bumped my TEST DS10 sitting on my desk, opening it...  it is a module in HG for testing but not in my actual X10 alarm.

Promptly after the alarm was armed last night, and every hour on the hour thereafter, I was sent an email stating the TEST DS10 door was open!  Until the alarm disarmed this morning and the hourly emails stopped.

SWEET!

Title: Re: 📧HG Smart E-mailer
Post by: mike on April 07, 2019, 03:27:44 PM
Now that I had HG stop talking to my HAbridge, and not wanting to loose everything since only  my old non mart-email backups worked again, I updated to latest HG version and got HG talking to HA again, and smart email installed and most parameters manual put back in.  2 hours.  Only thing not working now is:  smart emailer.  Yes, it calls itself properly when sensor seen, but fails - due to JKutil not populating dusk/dawn info.   I tried 3 other API keys i have, not seem to work properly;  Looks like all times are London, UK.  I cannot seem to make an API key to show my location. 

Any clues where I should look next?
Title: Re: 📧HG Smart E-mailer
Post by: Tuicemen on April 09, 2019, 01:36:23 PM
Configure/Settings/JKutil-Solar Altitude/options set your latitude and longitude
Title: Re: 📧HG Smart E-mailer
Post by: mike on April 09, 2019, 02:52:22 PM
Configure/Settings/JKutil-Solar Altitude/options set your latitude and longitude

I do recall setting those in the past...  but there is noplace to set them now!  the options does not offer place to enter them.  I assumed having them entered on HG maint page should be sufficient but obviously not.

I assume your smart emailer is looking for verification long/lat numbers are entered in jkutil and not seeing them is reason it is failing to run. 

the default ones in jkutil somewhere are sufficient to give UTC values for all the parameters.  Not sure why smart email is not happy with these Greenland values...
Title: Re: 📧HG Smart E-mailer
Post by: Tuicemen on April 09, 2019, 03:05:45 PM
Remember you need JKutil-Solar Altitude not JKutil-OpenWeather Data there is a difference
Title: Re: 📧HG Smart E-mailer
Post by: mike on April 09, 2019, 03:18:56 PM
hahaha!  Time for me to use your head knocker!    http://forums.x10.com/Smileys/default/headbanging.gif

You probably solved it!   Yes, I am now the proud owner of Openwheather data one, NOT solar!

HG newest version update replaced it unbeknownst to me!   Was interesting to watch the latest HG installer/updater work:  it DELETED most of my programs then INSTALLED them later again.  Guess Gene's list did not keep track that I had solar and instead put back openwheather one!

THANKS yet again!
Title: Re: 📧HG Smart E-mailer
Post by: mike on April 09, 2019, 03:26:15 PM
Can't find where I downloaded JKutil-solar Altitude from...
Title: Re: 📧HG Smart E-mailer
Post by: Tuicemen on April 09, 2019, 03:29:56 PM
 configure/maintenance/Package manager
then scroll down to weather and environment click on Solar Altitude then install package
Title: Re: 📧HG Smart E-mailer
Post by: mike on April 10, 2019, 08:52:04 AM
Thanks again.  That fixed it.  I am now on ver v1.3-beta.2 and all is back to working.
Title: Re: 📧HG Smart E-mailer
Post by: mike on April 10, 2019, 12:12:24 PM
haha...  That fixed YOUR smart emailer program, it did not fix actually sending email.  Your program says "email sent" but no email arrives.  I have a quick email tester program, it says no email sent.  My gmail account shows no email  sent either.  I have re-entered email parameters into HG email program (from screen shot of WORKING HG) and it still does not work.  So it appears this new HG fw update has broken the email send capability at least for now.   I have not had time yet to go to the log to see if it gives any clue why.  maybe tomorrow will have time...
Title: Re: 📧HG Smart E-mailer
Post by: Tuicemen on April 10, 2019, 12:54:09 PM
It is possible the beta HG messed with your settings I know I totally lost all my settings at my off grid place.
One RPi here got totally screwed while the other updated with out any issues. B:(
Title: Re: 📧HG Smart E-mailer
Post by: mike on April 11, 2019, 09:40:45 AM
not lost; they were still populated with my correct values.  I am afraid it is again a case of HG ignoring the entered data if not a totally fresh install.  I have not had time to go look at the log yet to confirm...
Title: Re: 📧HG Smart E-mailer
Post by: Tuicemen on May 17, 2019, 07:14:07 AM
Since day one of my HG use I had emails sent to me which contained 3 pictures each from 3 IP cameras with an alarm trip. Since all my cameras had pre set capabilities I soon created a script to turn them. With the current Pro IP camera addon ( http://forums.x10.com/index.php?topic=30983.0 ) I can move to presets and take a snapshot emailing that to me.

 My thinking now is to some how add the move camera and send picture to Smart Emailer. This would eliminate several scripts i currently use and eliminate the need to create more if I add a new camera.
 
Title: Re: 📧HG Smart E-mailer
Post by: mike on May 17, 2019, 07:56:03 AM
Neat idea!  I do like KISS principal;  hopefully adding preset move, snap, send does not add too much complexity.
Title: Re: 📧HG Smart E-mailer
Post by: Tuicemen on May 17, 2019, 08:03:07 AM
I'm hoping I can implement Kiss and keep the complex stuff in the script it's self so the end user only has to type camera# or name and preset#
 >!
Title: Re: 📧HG Smart E-mailer
Post by: soxfan1966 on January 29, 2020, 12:16:55 PM
Good afternoon,

Among some other testing I have been doing I was trying to get this to work as well.  I did have to install the jkutils, which I did, but the emails are not getting sent even though it seems like they should be.

In the Event History, it appears it sent the email but I'm not receiving them (in the attached image I blurred out my email address).

I also have the E-Mail Account program setup with my outgoing email info, I thought that is what it used for that.  Perhaps I am missing something ?
Title: Re: 📧HG Smart E-mailer
Post by: mike on January 29, 2020, 01:53:30 PM
I proved mine out by using a new door sensor on my computer desk so I could toggle it easy for testing anytime...

Perhaps your issue is you are not turning on the built in HG security alarm?  Tuicemen's auto emailer works with it IIRC.  So you have to set it on so the sensors send email.   Although there is a choice in tuicemens routine to send even if that is off - good for testing with the test dorr switch on your desk.

I made a simple email program also so I could verify email was working and going to the accounts I listed.  I am trying to get screen shots to attach here in case they help?    issues...   will send in a bit.
Title: Re: 📧HG Smart E-mailer
Post by: soxfan1966 on January 29, 2020, 01:56:57 PM
I do not have the Security Program installed nor active, sounds like that make be the issue ?
Title: Re: 📧HG Smart E-mailer
Post by: mike on January 29, 2020, 02:12:18 PM
depends...   ok, thank you for posting!  Turns out my Pi  USB power cord was knocked loose this morning by a cat on the desk!  So thank you for letting me know!   

so.  first.  goto a sensor, preferably the easy to trigger test on your desk, click on the top right gear, change from security alarm system to smart_E-mailer, then enable email mailing (if enabled you get blue check mark end of that line), then click BOTH emails when sec armed and when security disarmed.

trigger it and see if you get email.  If not, time to make a simple email program to test the email on demand function...

let me know and I will try to go next step with u?
Title: Re: 📧HG Smart E-mailer
Post by: Tuicemen on January 29, 2020, 02:14:17 PM
Users that set this up in the passed and had issues had installed the wrong JkUtils Solar Altitudes not the open weather I don't believe you need the security system enabled.
Title: Re: 📧HG Smart E-mailer
Post by: soxfan1966 on January 29, 2020, 02:15:44 PM
I do not have the security system installed - but I did have the Smart Email enabled, that is what was generating the event in the image.  But it does not seem to be sending an email - I am not sure where the outgoing email info is defined.
Title: Re: 📧HG Smart E-mailer
Post by: mike on January 29, 2020, 02:20:08 PM
1.jpg:  you gottsa have tuicemens "smart_E-mailer program installed and running... (check mark on right)
1.jpg: you gottsa have E-Mail Account setup and running
1.jpg:  you might want a TEST email on demand program like this "Send Test E-mail"

Inside test email program:

PROGRAM CODE:    cc and paste:
// CSharp Automation Program Plugin
// when the switch ON is pressed, a test e-mail is sent

var subject = "HomeGenie Test E-Mail";
var recipients = Program.InputField("Email.Recipients").Value;
var messageText = Program.InputField("Email.Message").Value;

if ((recipients != "") && (messageText != ""))
{
  Program.RunAsyncTask(() => {
   if (Net.SendMessage(recipients, subject, messageText) == true)
      Program.Notify("E-Mail Test", "SUCCESS! Test E-Mail sent.");
    else Program.Notify("E-Mail Test", "ERROR: Test E-Mail **NOT** sent.");
  });
}
else
  Program.Notify("E-Mail Test", "ERROR: Missing input field(s) - recipients and/or message text.");

STARTUP CODE:  cc/paste:

// Put your trigger code logic here.
// To execute the Code To Run,
// use a 'return true' or 'return false' otherwise.

Program.AddInputField("Email.Recipients", "", "Comma separated list of recipients e-mails that will get a test e-mail");
Program.AddInputField("Email.Message", "Just a HomeGenie Test", "E-mail message");

// add a push button widget - push it once and the e-mail is sent
Program.UseWidget("homegenie/generic/program");

// this program will NOT be running in background
return false;

------------------------------------   then you can RUN this test program anytime by clicking on ACTIONS bottom right and pick RUN
Title: Re: 📧HG Smart E-mailer
Post by: mike on January 29, 2020, 02:25:10 PM
good lord...   somehow MY email account info decided to disappear!  So it is not sending me emails either.  AGAIN, thanks for making me test this!  I had to retype in all my email data...   Luckily in the 6 months or so since I last saw this work we have not had a break in so did not need to know which door was the culprit.  It is always nice when going outside in a rob at 2 am armed to see why a door sensor triggered to know WHICH door sensor...
Title: Re: 📧HG Smart E-mailer
Post by: soxfan1966 on January 29, 2020, 02:27:52 PM
I do have the Email Account setup and active but will need to check the info and then try a test as you suggested.  Will follow up after I do that.
Title: Re: 📧HG Smart E-mailer
Post by: mike on January 29, 2020, 02:44:33 PM
Well, I appear to be back at square one too;  no email sending.  i had this issue and fought it for months a year ago...  posted about it here...  IIRC the only solution was to completely reinstall HG as it has some bug that refuses to let changes to email settings be accepted...  What a waste of time!!!!

If I find a short cut that allows HG to erase bad info or insert new email info I will post it, but I am too tired today to continue fighting it... 

anyone find a better replacement for HG yet?
Title: Re: 📧HG Smart E-mailer
Post by: soxfan1966 on January 29, 2020, 02:48:33 PM
I am definitely not looking to replace HG, I like it and it works great for me.  Sometimes trying to implement new things can be a bit finicky but its usually because I am doing something wrong, not a deficiency in HG.
Title: Re: 📧HG Smart E-mailer
Post by: soxfan1966 on January 29, 2020, 03:20:18 PM
The Smart Email program has some Program.Notify("debug", "text"); calls in it that you can uncomment for debugging.  In my case, I think its my email setup that is the issue.
Title: Re: 📧HG Smart E-mailer
Post by: soxfan1966 on January 29, 2020, 03:29:16 PM
So for the the Smart Emailer is running and thinks it sent the email.  However the:
Net.SendMessage(recipients, subject, messagetext)

does not seem to actually be sending it.  Not sure but still suspect its a setup of my outgoing email
Title: Re: 📧HG Smart E-mailer
Post by: Tuicemen on January 29, 2020, 03:35:18 PM
I'm wondering if this may be a mono issue rearing its head again ::) :'
Title: Re: 📧HG Smart E-mailer
Post by: soxfan1966 on January 29, 2020, 03:56:41 PM
I tried 3 different email accounts (including using gmail from aspmx.l.google.com which seems to not require authentication).  All get reported from HG as being sent but I never get anything.
Title: Re: 📧HG Smart E-mailer
Post by: petera on January 29, 2020, 04:26:28 PM
I tried 3 different email accounts (including using gmail from aspmx.l.google.com which seems to not require authentication).  All get reported from HG as being sent but I never get anything.

I was loathe to comment on this but when I saw mentioned that a Mono problem may be rearing it's head I wanted to assure HG users in the Raspbian environment that this is not the case.

Google and GMX to mention a few free email providers do not want Apps like this using it's services and by this I mean piggybacking of its SMTP server. I suggested to one user before that they use the SMTP server settings of his IP and this resolved his problem permanently.

Surely you guys can obtain the SMTP settings from your IP and resolve this matter for once and for all. Typically your notifications using the above email providers will allow a few notifications through. Their server then starts flagging then as spam or such like and will not process them . They may end up in your spam folder at first and then are not forwarded on at all.

You can spend hours trying to figure this one out or take the advice above and save yourself hours of your time. This is nothing to do with Mono or Linux or anything else relating to your Raspberry Pi. If your really want to resolve this I suggest taking a copy of your HG log and post it on the Homegenie Club where a number of HG experts can cast an eye over them in their own good time.
Title: Re: 📧HG Smart E-mailer
Post by: soxfan1966 on January 29, 2020, 04:31:53 PM
I did try my internet provider, as well as Gmail, and none worked.  I used the same settings from my internet provider that do work from my wifi cameras and do send emails.  So whatever the issue is appears to be within HG and whatever the Net.SendMessage is doing - wether that is mono or something else I do not know.
Title: Re: 📧HG Smart E-mailer
Post by: petera on January 29, 2020, 04:49:18 PM
I did try my internet provider, as well as Gmail, and none worked.  I used the same settings from my internet provider that do work from my wifi cameras and do send emails.  So whatever the issue is appears to be within HG and whatever the Net.SendMessage is doing - wether that is mono or something else I do not know.

How familiar are you with Linux
Title: Re: 📧HG Smart E-mailer
Post by: soxfan1966 on January 29, 2020, 04:50:38 PM
A little bit.   I can run some basic commands etc whke connected to the pi via putty.
Title: Re: 📧HG Smart E-mailer
Post by: petera on January 29, 2020, 04:53:43 PM
A little bit.   I can run some basic commands etc whke connected to the pi via putty.

If you want to continue troubleshooting this send me a PM
Title: Re: 📧HG Smart E-mailer
Post by: mike on January 29, 2020, 06:05:44 PM
Keep in mind as others suggest gmail may not work, or gmx, or....  it is not an issue with them.  I was able to verify during my painful similar issue that HG refuses to change the email parameters to any new ones entered.  So if you do not get them right the very first time on a new install, HG has a heck of time (if ever) changing them again.  I found that before, and I find it again today.  Also know it is not a mono issue, it is internal HG:  designer admited once to us that sometimes HG does not update the email info when changed....
Title: Re: 📧HG Smart E-mailer
Post by: bkenobi on January 29, 2020, 08:21:39 PM
There has never been a problem with mono in regards to email notification.  The problem that has been seen over and over is that mono needs to have the security certificates updated. The reason for this is as peters stated...the free email providers are intentionally updating things which will break your setup.

The issue may be that they dont like you getting a free lunch. It may also be that they are trying to stem spam that is being paid for by gmail and yahoo via their open/free smtp servers.  Either way, this is NOT a HG or Mono issue.  I was able to get my Buster RPi to send emails a couple weeks back but it will break again.
Title: Re: 📧HG Smart E-mailer
Post by: brobin on January 29, 2020, 08:44:55 PM
A few years ago I ran into a similar problem with my Stargate no longer sending emails since it was produced before TLS/SSL was a thing and the email providers required it.  I found smtp2go.com which offers free accounts with an allowance of up to 1000 emails/month and TLS/SSL is optional.  I don't know if that's the answer to the HG issue but might be worth a look.  I've been using it for several years without any issues. 
Title: Re: 📧HG Smart E-mailer
Post by: petera on January 29, 2020, 09:07:06 PM
Myself and @bkenobi have had our fair share of problems with email notifications in HG over the years but we know where to look to sort out the problem.

Just because my bus is going in your direction it doesn't mean you can hop on for free. Choose an IP provider that offers SMTP facilities if you want a guarantee that email notification will work for you. There's no free lunch in the IT sector these days.
Title: Re: 📧HG Smart E-mailer
Post by: brobin on January 30, 2020, 12:52:44 AM
Choose an IP provider that offers SMTP facilities if you want a guarantee that email notification will work for you. There's no free lunch in the IT sector these days.

Well, at least for now, SMTP2go does just that and invites users who can live within the 1000/month limit to stay on the free plan as long as they like. Three+ years for me so far. No ads, no nags, it just works.  But if you prefer to pay they'll be happy to take your money.
Title: Re: 📧HG Smart E-mailer
Post by: petera on January 30, 2020, 07:40:01 AM
Choose an IP provider that offers SMTP facilities if you want a guarantee that email notification will work for you. There's no free lunch in the IT sector these days.

Well, at least for now, SMTP2go does just that and invites users who can live within the 1000/month limit to stay on the free plan as long as they like. Three+ years for me so far. No ads, no nags, it just works.  But if you prefer to pay they'll be happy to take your money.

The magic words “at least for now”. That’s exactly what users have experienced. Works today, doesn’t work tomorrow. Not ideal for a reliable notification system.
Title: Re: 📧HG Smart E-mailer
Post by: Tuicemen on January 30, 2020, 09:33:36 AM
I'm wondering if this may be a mono issue rearing its head again ::) :'
when I made this statement I didn't mean to imply mono was corrupt or mono was a problem. The statment was to get mike and soxsofan1966 looking in the right direction. My statment didn't  mention the certificates  mainly due to me failing to remember the exact issue.
There has never been a problem with mono in regards to email notification.  The problem that has been seen over and over is that mono needs to have the security certificates updated.
Myself and @bkenobi have had our fair share of problems with email notifications in HG over the years but we know where to look to sort out the problem.

Perhaps a tutorial in the help and trouble shooting section should be created for this. Since this apears to be an issue which seems to be continualy popping up. Users could simply be pointed to it instead of instucting each new user that experiances this individualy.
Title: Re: 📧HG Smart E-mailer
Post by: mike on January 30, 2020, 09:47:17 AM
That's a great idea Tuicemen.  MY issue is MY HG refuses to accept the changes made in email settings; I see that in the log.  I have half a dozen email accounts, most of which are SMTP, some with SSL, some without. With HG not accepting changes I have impossible time trying different accounts to find a good open one.   I suspect this is really the issue when trying smtp accounts that do not upset a certificate thing.
Title: Re: 📧HG Smart E-mailer
Post by: bkenobi on January 30, 2020, 10:48:42 AM
SMTP2GO may not be a final solution, but if it works for now it would possibly help users who are stuck with gmail/yahoomail.  My ISP is my cell company and they don't even give me an external IP so I can no longer connect to my RPi remotely.  In my case, I believe the only option if I want to have a server at home is sign up for a VPN that gives that kind of access.  If I were P2P these days, it would be a no brainer but I haven't done that in years.

As for the email, I would recommend finding a permanent solution but good to know that SMTP2GO works as a temporary step.
Title: Re: 📧HG Smart E-mailer
Post by: mike on January 30, 2020, 11:01:19 AM
In my trying 4 different email accounts today and none sending, after I added the email test send when I change "E-MailAccount" program, it started working;  last set of parameters I had in it was my gmx.com account with mail.gmx.com, port 465, SSL   so I am leaving them.   No changes but adding test email to email parameters program made it work for me...
Title: Re: 📧HG Smart E-mailer
Post by: soxfan1966 on February 03, 2020, 09:00:13 AM
OK, here is the latest update after testing things over the last few days.

With help from petera, tuicemen and mike I at least have my emails sending.

Petera had informed of where the email account settings were stored - they are supposed to be in a file called systemconfig.xml (NOTE: if you decide to muck around with that yourself please make a backup of it first).

I manually edited the settings in that file to be what my ISP defined.  I even tested them with an external tool on my pc called SMPT Diag Tool.

So what is strange is that the info I had manually edited in the systemconfig.xml file did not seem to be reflected in the "E-Mail Account" HG program (which I used mike's update to trigger an email on changing each field - this was most helpful).

Petera had suggested deleting each setting in the E-Mail Account Program (from the Options) one by one, then putting back in my real settings.  I tried this a few times with no luck.

Finally this morning I tried this:
delete a setting, hit return, wait 30 seconds
tab to the next field
repeat to delete each field
when finished, Exit the Options

I then checked my systemconfig.xml file and nothing had changed - so not really sure what fields the E-Mail Account program is using vs what the systemconfig.xml file is storing and what the difference is.

Then I went back into the E-mail Account Options and did this:
enter in a value for the E-mail address field, hit enter and wait 30 seconds.
with mike's change to that program I got a notification that an email was not sent.

I tabbed to the SMTP mail server address field
entered in my value, hit return and waited 30 seconds
this time I got an email sent notification and after a few seconds I did receive an email

I checked my systemconfig.xml file and nothing in it had changed - all the fields still had the same values as before.

Then I tabbed to the next field (SMTP username) and entered  a value, hit enter and waited 30 seconds.  No notification about an email sent or not, and no email received.

I decided to try the remaining fields - entering a value and waiting 30 seconds between each.  Nope - still no notification and no email.

checked the systemconfig.xml file again, all my fields still have the same values.

At this point I was thinking I should have just stopped once I received an email :(

So back to step one again.

Cleared out each of the fields in the E-Mail Account Options, one by one deleting the field and waiting 30 seconds then tab to the next field and did the same.

Exited the Options.

Went back into Options,

Entered in my email address, hit return, waited 30 seconds.  Got notification that email was not sent
tabbed to the SMTP server address field.  Entered in my value, hit enter, waited 30 seconds.  Got notification that email was sent and after a few seconds I did receive the email.

Then I stopped - exited the Options screen.  Which at this point only has my email address and SMTP server address - all the other fields are blank.

checked the systemconfig.xml file again - all the fields have values (even the ones that are blank in the E-Mail Account Options screen).

I then inactivated the E-Mail Account program (it is not running) and activated the Smart_Emailer program.

Went to the Dashboard in HG, opened the settings for one of my lights and checked the Enable Emails setting, saved.  Turned the light on from HG and got the email :)


Not sure why the systemconfig.xml settings and the E-Mail Account options do not match, nor why my email sends with only the email account and smtp server address defined in the Email Account Options but it is working now.

Good time to make a back up.

Thanks for everyone's help.



Title: Re: 📧HG Smart E-mailer
Post by: petera on February 03, 2020, 09:59:20 AM
Make sure that backup is a full SD card image.

One piece of advice too. If you are ever editing a Program ensure you disable it first and when finished editing enable it again for obvious reasons.

On the email settings issue, assuming your smtp server allows you to forward emails ensure that the last box enabling ssl in the settings is ticked and you can clearly see that tick and you use the correct port number.

Finally I really do advise running HG in debug mode to monitor all processes when troubleshooting an issue. For those who are not sure how to do this

sudo systemctl stop homegenie.service

cd

cd /home/pi/homegenie

sudo mono HomeGenie.exe --log

When finished running in debug mode just press Ctrl-c and type

cd

sudo systemctrl start homegenie.service

to restart HG

Glad to hear your email notification is working again. A bit of hard work to get there but at least you are a little more knowledgeable of the system files.
Title: Re: 📧HG Smart E-mailer
Post by: mike on February 03, 2020, 10:17:38 AM
Great!   

I enjoyed reading your bit about "I then checked my systemconfig.xml file and nothing had changed - so not really sure what fields the E-Mail Account program is using vs what the systemconfig.xml file is storing and what the difference is."   Hahaha!!!   I went that road too!  So frustrating to find where the data is supposed to be then see it not changing!

Interesting you saying you disabled the email program (where your email info is stored)...   For some reason I thought that had to be running for email to work...  Guess not.  Great to know!

For kicks I turned on email notifications on a few of  my plaini X10 eagle eye sensor triggered light switches...  Found my Barn light, which I cannot see, is turning on and off 5-6 times a day!  middle of the night, day, etc!  How neat to learn!!!!  Might be ground hogs moving around inside...
Title: Re: 📧HG Smart E-mailer
Post by: mike on February 03, 2020, 10:19:18 AM
Perhaps Petera hit on something big here:  disable a program before making changes then re enable after...

Wonder if THAT would have made the email changes take affect properly?    I will never know because I AIN'T TOUCHING IT AGAIN UNTIL IT BREAKS AGAIN!
Title: Re: 📧HG Smart E-mailer
Post by: bkenobi on February 03, 2020, 11:08:58 AM
If HG is running with the app enabled, I suspect changing values in the xml file won't be picked up.  I assume that the values in the xml file will only be read on load of the app.  Also, I'd assume that values in the app will be written to the xml on shutdown/stopping of the app.  If so, then making changes to the xml will be of no use unless you first stop either the app or HG service and then starting it again after modifying values.
Title: Re: 📧HG Smart E-mailer
Post by: petera on February 03, 2020, 01:09:38 PM
If HG is running with the app enabled, I suspect changing values in the xml file won't be picked up.  I assume that the values in the xml file will only be read on load of the app.  Also, I'd assume that values in the app will be written to the xml on shutdown/stopping of the app.  If so, then making changes to the xml will be of no use unless you first stop either the app or HG service and then starting it again after modifying values.

That's pretty much it.

If anyone wants to examine the XML files just import them into something like Excel (I chose that for the windows users) and examine them that way. This is a copy of the base systemconfig.xml for comparison purposes. 

https://github.com/genielabs/HomeGenie/blob/master/BaseFiles/Common/systemconfig.xml

Depending on how file locking is handled in HG, as you say it's unlikely any changes made "on the fly" will keep once you exit the editing session. You'll see a similar incidence of this if you try and edit a service daemon while the service is running. At least the OS reminds you to reload the service daemon before the edited service daemon takes effect.

As I mentioned before I don't experience this problem but I don't run HG on a Pi Zero. I don't want to get too deeply into further discussion on this but suffice to say a Pi Zero fully loaded is going to struggle. Maybe users who constantly experience this problem should invest in a Raspberry Pi 3b+ and try for themselves.
Title: Re: 📧HG Smart E-mailer
Post by: soxfan1966 on February 04, 2020, 11:39:25 AM
So now that I have the emails working I noticed I was getting an email (or actually a text message, as I am using the ability to email as a text message) four times each time the light was turned on.

I took a look at the Smart_Emailer program and made a tweak which I think fixes this, though it may (or may not) be specific to my usage.  I do not have the security feature installed so I do not use the Arm / Disarm, just the notification as part of a light being turned on.

What I did was add a variable called lastmodule which stores the last module that was processed.  Then I modified one of the first conditions to check if the current module being processed was different that the lastmodule - if so, proceed, else do not.  In both cases, the lastmodule variable should get updated so that the check can be made again on the next trigger.

I have attached the update program if anyone is interested.  I also did some formatting to align the { and }, hope that is OK :)
Note: 1033-Smart_E-mailer.hgx was renamed as a .txt file, so you will need to rename before importing and you may want to back up your current version first.

Thanks
Title: Re: 📧HG Smart E-mailer
Post by: Tuicemen on February 04, 2020, 11:51:52 AM
 #:) the HG Smart E-mailer was intended as something to be modified, tweaked and improved on by others.
As with all the programs I posted, I had hoped others would expand on them and share their works so everyone could benefit.
Users that state their programs are too personalized to share is BS.
Title: Re: 📧HG Smart E-mailer
Post by: mike on February 04, 2020, 01:43:26 PM
THANKS soxfan!  I used to get multi emails also like that.   I thought mine stopped I think (maybe not)...  I should not say they stopped repeat 2 or 4x as my HG stopped reading all my DS10's for some reason.  Not a big deal to me as my x10 alarm sees them fine and all I really use HG for is to arm & disarm the real x10 alarm.  That said, it was nice to have all DS10 sensors live in HG so they could send an email stating which one triggered!  Only happened one time at 2am in the snowy night and I was able to go directly to that door to find out why...  I plan to reinstall all DS10's into HG again but no time yet.  So I will keep your improvement for that day!

As for having to turnoff a program before modifying its options...  Never saw that written anywhere, and it certainly is not true for all programs I have and change data on real time - except perhaps it is true for the e-mail program...
Title: Re: 📧HG Smart E-mailer
Post by: mike on February 04, 2020, 01:46:41 PM
I might add that since I turned on smart emailer for my non alarm switches, they are reporting only 1x when they go from 0 to 1...
Title: Re: 📧HG Smart E-mailer
Post by: Tuicemen on February 04, 2020, 02:25:58 PM
I believe why soxfan1966 gets multi confirmation emails for some of his x10 devices is the fact that other RF transceivers are in his setup.
I never accounted for that when I originally coded this.
Title: Re: 📧HG Smart E-mailer
Post by: mike on February 04, 2020, 03:38:23 PM
sounds feasible;  I too have XTBR 220v repeater and must have multiple TM751's around as needed...   To me multiple emails for an event is not devastating;  it is 10000% better than no email alternative.