Skip to content

Wake&smtp updates#20

Open
zephyrus9MA wants to merge 7 commits into
morrisonbrett:masterfrom
zephyrus9MA:wake&SMTP_updates
Open

Wake&smtp updates#20
zephyrus9MA wants to merge 7 commits into
morrisonbrett:masterfrom
zephyrus9MA:wake&SMTP_updates

Conversation

@zephyrus9MA
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown
Owner

@morrisonbrett morrisonbrett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work and thanks for contributing! A few changes and I'll take another look, and then merge.

Comment thread TeslaCommand.go Outdated
}
//
// Brett Morrison, Februrary 2016
// Lee Elson. June 2020 Modified to add Tesla wake up call with sleep time and to have a complete TO:, FROM:, SUBJECT:,MSG
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be:

// Lee Elson, June 2020
// Modified...

Comment thread TeslaCommand.go Outdated
//
// Brett Morrison, Februrary 2016
// Lee Elson. June 2020 Modified to add Tesla wake up call with sleep time and to have a complete TO:, FROM:, SUBJECT:,MSG
// in the message portion of the sendmail. This is necessary for some SMPT servers. Also commented out texting portion
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: SMTP.

Comment thread TeslaCommand.go
flag.StringVar(&mailServerLogin, "mailServerLogin", "", "SMTP Server login username")
flag.StringVar(&mailServerPassword, "mailServerPassword", "", "SMTP Server password")
flag.StringVar(&fromAddress, "fromAddress", "", "Alert send from email")
flag.StringVar(&toAddress1, "toAddress1", "", "Alert send to email1") //LSE mod to add second email address
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove all // LSE comments. They won't age well. The nature of Git / GitHub history tells the story.

Comment thread TeslaCommand.go Outdated
logger.Println(err)
os.Exit(1)
}
time.Sleep(60 * time.Second) //Give it a chance to wake up LSE
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove LSE from all comments except at the top

Comment thread TeslaCommand.go Outdated
}

// Need to set this flag for every time vehicle exits and enters GeoFence (so we don't send repeated alerts)
// LSEingeofenceandstopped := false
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove line

Comment thread TeslaCommand.go Outdated

// If the distance is outside the radius, that means vehicle is outside the GeoFence. Ok to get out
if distance > float64(radius) {
// LSEingeofenceandstopped = false
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

Comment thread TeslaCommand.go

// The following code was removed in order to make loop do the whole test each time, including sending email if disconnected LSE
// This is to prevent the below logic, if it's already executed, no need to keep doing it
// LSEif ingeofenceandstopped == true {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If within the geofence and disconnected, second+ time through will not send notification with this code in place. I want long check intervals (to prevent battery decline) with a message each time.

Comment thread TeslaCommand.go Outdated
logger.Println(err)
}

//LSE // Send text
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this code in place, the program writes an error message unless the user has a twilio account. I don't, so the error message (at least) has to be skipped.

Comment thread lib/NotifyLib/Mail.go Outdated
return nil
}
package NotifyLib
// Add second to address. Most mail servers require a FROM: address. This was added to the message by Lee Elson on 6/29/20
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

Comment thread lib/NotifyLib/Mail.go
to := []string{toAddress}
msg := []byte("To: " + toAddress + "\r\nSubject: " + subj + "\r\n\r\n" + body + "\r\n")
serverPort := mailServer + ":" + strconv.Itoa(mailServerPort)
logger.Printf("Sending mail via server %s\n", serverPort)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove this line?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants