Please login or register.

Login with username, password and session length
Pages: 1 2 3 [4] 5

Author Topic: Email Script Help  (Read 13710 times)

mike

  • Hero Member
  • *****
  • Helpful Post Rating: 14
  • Posts: 1057
Re: Email Script Help
« Reply #45 on: February 21, 2019, 09:47:49 AM »

So frustrating having to use experimentation to find out how things work in HG!  I want a simple program with a single C+ line:

Net.SendMessage("cc@cc.com", "test subject", "hi Bob");

I can make the program, compile it (not sure that is required when there is a save button on bottom right that seems to do the same thing), but go to a group and try to add it as a module and it does not exist!   I have tried all kind of experminieting but cannot figure out why some programs show up (in apparent random places to boot) in the add module list and others do not.

What is the secret to adding a button to test this program?
Logged

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 283
  • Posts: 10509
  • I don't work for X10, I use it successfuly!
Re: Email Script Help
« Reply #46 on: February 21, 2019, 09:52:05 AM »

This should help explain some things
https://genielabs.github.io/HomeGenie/#/develop/programs
The documentation is out there, it is just knowing where to look, which can be frustrating B:(
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 283
  • Posts: 10509
  • I don't work for X10, I use it successfuly!
Re: Email Script Help
« Reply #47 on: February 21, 2019, 09:54:10 AM »

Also just because you compile it or save it doesn't mean it is activated so you have to do that in some cases. ::) :'
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

mike

  • Hero Member
  • *****
  • Helpful Post Rating: 14
  • Posts: 1057
Re: Email Script Help
« Reply #48 on: February 21, 2019, 09:55:48 AM »

thanks.  that link does not work for me.  I like

https://genielabs.github.io/HomeGenie/api/ape/index.html

But its search feature cannot find the commands so it is frustrating time waster to search each are until I find the one I want explained...

Not sure why   Program.UseWidget("homegenie/generic/program");   did not show the module in the add module list before but I just tried it again and it now shows...  so I can test more.
Logged

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 283
  • Posts: 10509
  • I don't work for X10, I use it successfuly!
Re: Email Script Help
« Reply #49 on: February 21, 2019, 10:01:19 AM »

Not sure why   Program.UseWidget("homegenie/generic/program");   did not show the module in the add module list before but I just tried it again and it now shows...  so I can test more.
Ya I found HG slow to add new modules to the list but running this on a Zero W that can be expected I guess. ::) :'
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

mike

  • Hero Member
  • *****
  • Helpful Post Rating: 14
  • Posts: 1057
Re: Email Script Help
« Reply #50 on: February 21, 2019, 10:11:49 AM »

My peck and test method of trying to make something i know little about work is beginning to make me believe the command

Net.SendMessage("cc@cc.com", "test subject", "HiBob messageText")

does NOT actually send an email.  My log shows this program is running but shows nothing of email sending.  So the only one actually trying to send is your version;  I assume the actual send is this that I do not understand as I cannot find docs on the words:

 Program.RunAsyncTask(() => {
    byte[] img;
    for (int x=0; x<3; x++) {
       
     
        Pause(1);
    }

Do you know if there is a simple single line C+ code that SENDS an email?
Logged

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 283
  • Posts: 10509
  • I don't work for X10, I use it successfuly!
Re: Email Script Help
« Reply #51 on: February 21, 2019, 10:27:01 AM »

The line you use is what I use
Net.SendMessage( "YOUR EMAIL ADDRESS", "YOUR SUBJECT", "YOUR Message" );

HomeGenie uses C# not C+ though simular finding info may be difficult if searching the wrong programing language.
HomeGenie can also use Javascript - Jint, Python - IronPython, Ruby - IronRuby so if your more familiar with one of those try them.
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

bkenobi

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 24
  • Posts: 2082
Re: Email Script Help
« Reply #52 on: February 21, 2019, 11:20:12 AM »

Just to make sure you completed all the steps, did you set up certificates for your specific email host?

I don't have my install script in front of me, but part of the setup process is getting certificates set up.  I believe the line you need to verify is:

Code: [Select]
certmgr -ssl smtps://smtp.gmail.com:465
I know I've posted the script somewhere, but don't remember which forums.  It's at home and on my flash drive (which is at home).  The command above was found by asking google about "raspberry mono certificate gmail" in case you need more info.  My script also has a line that can be used to test if the certificates are correctly installed, but I don't recall what that command is.  Google should be able to help.

mike

  • Hero Member
  • *****
  • Helpful Post Rating: 14
  • Posts: 1057
Re: Email Script Help
« Reply #53 on: February 21, 2019, 12:00:08 PM »

I am beginning to see that one cannot send emails from HG without also doing more background stuff with this mono thing...

I found:
https://www.mono-project.com/docs/faq/security/

It is heavy into stuff it appears must be manually done before any email can ever be sent! 

Beknobi, your line  certmgr -ssl smtps://smtp.gmail.com:465 is similar to what is reported in the mono security write up...  when I type it into putty it just makes my pi mad: it sits there and does nothing until I 'end' it with ctl-x

I have been researching email and pi and HG for a couple hours.  I see tidbits here and there about the certificate issues and such, but nowhere yet any definitive 'fix' to make HG send an email, with or without SSL.
Logged

mike

  • Hero Member
  • *****
  • Helpful Post Rating: 14
  • Posts: 1057
Re: Email Script Help
« Reply #54 on: February 21, 2019, 01:09:10 PM »

Tuiceman, using my last backup SD I just found that Habridge indeed broke again.  I will have to search for how I fixed it before...  something to do with the SD card name changing IIRC.  I may just put my SD card back in that worked last week and go from there...
Logged

bkenobi

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 24
  • Posts: 2082
Re: Email Script Help
« Reply #55 on: February 21, 2019, 02:09:38 PM »

I am beginning to see that one cannot send emails from HG without also doing more background stuff with this mono thing...

Correct.  I don't have an approach that is fully hands off setup and will work indefinitely without intervention.  As a result, I have notifications working less than they don't work.  I don't have anything set up to notify other than for loss of power which only happens 2-3 times a year and I generally already know about it.

mike

  • Hero Member
  • *****
  • Helpful Post Rating: 14
  • Posts: 1057
Re: Email Script Help
« Reply #56 on: February 21, 2019, 03:14:37 PM »

I put back my working SD card and got HAbridge back.  I updated and upgraded it.  Gotta remember to make a new backup SD card...

Bkenobi, it seems I read there is a way to make the certificate work forever in the doc:

https://www.mono-project.com/docs/faq/security/

One of the 4 'ways to fix this certificate issue.'  But I won't swear to it. 

I am putting my email from HG on the sideburner for now;  not enough time in the day to experiment pecking at the keyboard on a topic I don't grasp enough. 

If you would not mind reposting for this dumby here your step by step you have at home sometime, I would be very greatful.  I see a HG scheduler crone event to remind to do that thing again in 3 months (* * * 3 *).  If it is definable in a C-something code, then it might even be automatic.   :)

thanks.
Logged

mike

  • Hero Member
  • *****
  • Helpful Post Rating: 14
  • Posts: 1057
Re: Email Script Help
« Reply #57 on: February 21, 2019, 03:51:22 PM »

Meanwhile I encourage you Tuicemen to continue on your great idea of adding email capability to security devices!  Thank you!
Logged

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 283
  • Posts: 10509
  • I don't work for X10, I use it successfuly!
Re: Email Script Help
« Reply #58 on: February 21, 2019, 04:29:19 PM »

Mike I'm still plugging away at it.
right now it is ignoring my conditions, B:( I'll soon be dizzy again today. rofl
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 283
  • Posts: 10509
  • I don't work for X10, I use it successfuly!
Re: Email Script Help
« Reply #59 on: February 21, 2019, 04:51:29 PM »

OK, got everything but the Email when security is Disarmed and a module changes to On or status 1
I'm not sure if that is needed but I'll attempt to add it. ;)
Logged
Please Read Topic:
General Forum Etiquette
Before you post!
Pages: 1 2 3 [4] 5
 

X10.com | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 X10.com All rights reserved.