Please login or register.

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

Author Topic: Email notification  (Read 3251 times)

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 282
  • Posts: 10497
  • I don't work for X10, I use it successfuly!
Re: Email notification
« Reply #15 on: January 21, 2019, 09:35:53 AM »

it should be possible using the homegenie/automation/CustomAPI in the programcode section of the macro.

However since I've not been able to have any success with that though I've not played much with it. The API call that works for the garage notification from a browser is http://"your HG ip &Port"/api/HomeAutomation.HomeGenie/Automation/Programs.Run/1004

So maybe (and a pi expert can correct me if wrong) you just enter the number of the program to send the which in the case of the garage notification would be 1004
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

bkenobi

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 24
  • Posts: 2081
Re: Email notification
« Reply #16 on: January 21, 2019, 10:00:25 AM »

My Check IP app does a few things that you don't need but it's pretty short C# code.  If you implemented via C#, sending an email is a 1 line command.  I split it into a few just to make the subject, text, and recipient have their own variables (not needed).  AFAIK, you should be able to send an email via the Wizard script too, though.  If so, you simply would hard code your response and set it to the module you want it triggered by.  The only issue might be multiple triggers sending a flood of emails depending on the type of module and how it is triggered.  That can be avoided by coding something with a timeout...but that's a little more complicated than you asked about.

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 282
  • Posts: 10497
  • I don't work for X10, I use it successfuly!
Re: Email notification
« Reply #17 on: January 21, 2019, 10:07:44 AM »

AFAIK, you should be able to send an email via the Wizard script too, though.  If so, you simply would hard code your response and set it to the module you want it triggered by. 
this is where soxfan1966 is at as am I, how do you activate a program from a macro trigger? I've just started to play with this but I'm not having any luck yet.
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

bkenobi

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 24
  • Posts: 2081
Re: Email notification
« Reply #18 on: January 21, 2019, 10:15:53 AM »

I haven't done it myself as I always use C# triggering.  But, I find that approach clumsy for simple tasks.  I have meant to look into it but I've never had a project that needed it, so it has slipped down the priorities.

FWIW - I highly recommend pseudo code for anything more than a single logic statement.  There is NO way I would try to code anything without knowing my overall goal.  Once a logical progression is determined, fleshing it out with real code in whatever language is selected is really easy.  Also, if the code needs to be ported to a different platform (different HA software, different language, etc) you are already 85% of the way there!  I lost my pseudo code for the Advanced Smart Lights (ASL) code which is annoying.  I was considering porting it to Python since I find it easier to code in than Gene's C# implementation.  If I had it still, I'd probably have made something for Home Assistant or Domoticz just to give it a try.

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 282
  • Posts: 10497
  • I don't work for X10, I use it successfuly!
Re: Email notification
« Reply #19 on: January 21, 2019, 10:33:50 AM »

Ok think I have it working now from a simple x10 module status.
once you have your notification program saved (can be based off bkenobi's check IP or the garage notification) take note of the program number HG assigns to it.
In your macro program code add homegenie/program.run/value it the value place the number of the notification programHG asigned it.
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

bkenobi

  • PI Expert
  • Hero Member
  • ******
  • Helpful Post Rating: 24
  • Posts: 2081
Re: Email notification
« Reply #20 on: January 21, 2019, 02:28:56 PM »

I forgot I had a test email program.  Change the extension to "hgx" from "txt", import into HG, and change the variables for subject, message text, and recipients to what you need.  Like I said, it's literally 1 line of code (4 if you make variables).
Pages: 1 [2]
 

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