Journey with Confidence RV GPS App RV Trip Planner RV LIFE Campground Reviews RV Maintenance Take a Speed Test Free 7 Day Trial ×
Jayco RV Owners Forum
 


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 07-23-2018, 04:37 PM   #1
Site Team
 
Mustang65's Avatar
 
Join Date: Nov 2012
Location: Clearwater, FL area
Posts: 5,196
IOT - Electronics and RVING

There is a new Social Group for those interested in the Internet of Things (IOT) Electronics and RVing. Since the Social Community only allows for a MAXIMUM of 1000 characters in a post and most IOT scripts/discussions are greater than 1K characters, we can post the scripts/discussions here in the forum.

As norty1 mentioned, we can use the IOT ELECTRONICS and RVing thread in the Social Group as the index. I would recommend that we start each new "Title" with the letters "IOT - " and then your topic. This will help when doing a search.

Maybe, we do not use the Social Group and only Post things here, or maybe post the SCRIPTS on GitHub.... not sure

Your thoughts on how to move forward with this will be greatly appreciated.

Don
My Registry

RVing with SOLAR
__________________
2013 Jayco Eagle 284BHS
2012 Ford F150XLT, EcoBoost w/3.73,Max Tow Pkg.
Our Solar Album https://www.jaycoowners.com/album.php?albumid=329
Mustang65 is offline   Reply With Quote
Old 07-23-2018, 04:41 PM   #2
Site Team
 
Mustang65's Avatar
 
Join Date: Nov 2012
Location: Clearwater, FL area
Posts: 5,196
IOT - Email notification of HOME Public IP address change

Here is a script that I use to be notified if my ISP changes my Public IP address while on the road. Granted, it does not happen very often (hurricane last year) but it is needed so I can access all my Home Automation, Energy Management and Security cameras and dB, while on the road.

--------------------------------------------------------------------------
# Raspberry Pi
#IOT - Email notification of HOME Public IP address change

# Hourly check to see if the Public IP address was changed,
# It stores the existing IP address in a text file "last_ip.txt"
# It goes out and checks what the internet shows for the curent Public IP address
# and compares it to the ip address in "last_ip.txt", if different it sends email
# I used email and not a text msg because if the pgm screws up I would rather
# get a bunch of email than my iPhone constantly dinging, has been working perfectly
# You can test the pgm by altering the last digit in the "last_ip.txt address.
# Using CRON you can select how often to run the program, I use 1 hour for CRON
# to automatically run the program

# -----

from urllib.request import urlopen # in python3
import re
import smtplib

# Setup our login credentials
from_address = "xxxxxxxxxxx@gmail.com" # newly created gmail account
to_address = "xxxxxxxxxxx@xxxxxxxx.com" # your regular email account
subject = "RPi3 IP" # You can enter any subject you want here
username = "xxxxxxxxxx@gmail.com" # username of your newly created gmail account
password = "xxxxxxxxxx" # password of your newly created gmail account.
# I used a new gmail account because the Yahoo email account did not work properly

# Setup where we will get our IP address
url = "http://checkip.dyndns.com"
print ("Our chosen IP address service is:", url)

# Open up the url, then read the content, and take away to IP address
request = urlopen(url).read().decode("utf-8")

# -----

# Extract the IP address only
ourIP = re.findall("\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}", request)
ourIP = str(ourIP)
print ("Our IP address is:", ourIP)

def send_email(ourIP):
# Body of the email
body_text = ourIP + " is our NEW IP address"
msg = "rn".join(["To: %s" % to_address,
"From: %s" % from_address,
"Subject: %s" % subject,
"", body_text])

# Actually send the email!
server = smtplib.SMTP("smtp.gmail.com:587")
server.starttls() # Our security for transmission of credentials
server.login(username, password)
# -----

request = urlopen(url).read().decode("utf-8")

# Extract the IP address only
ourIP = re.findall("\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}", request)
ourIP = str(ourIP)
print ("Our IP address is:", ourIP)

def send_email(ourIP):
# Body of the email
body_text = ourIP + " is our NEW IP address"
msg = "rn".join(["To: %s" % to_address,
"From: %s" % from_address,
"Subject: %s" % subject,
"", body_text])

# Actually send the email!
server = smtplib.SMTP("smtp.gmail.com:587")
# -----
server.starttls() # Our security for transmission of credentials
server.login(username, password)
server.sendmail(from_address, to_address, msg)
server.quit()
print ("Our email has been sent!")

# send_email(ourIP)

# Open up last_ip.txt, and extract the contents
with open("/home/pi/ipemail/last_ip.txt", "rt") as last_ip:
last_ip = last_ip.read() # Read the text file

# Check to see if our IP address has really changed
if last_ip == ourIP:
print ("Our IP address has not changed.")
else:
print ("We have a new IP address.")
-----
with open("/home/pi/ipemail/last_ip.txt", "wt") as last_ip:
last_ip.write(ourIP)
print ("We have written the new IP adddress to the text file.")
send_email(ourIP)# Hourly check to see if the Public IP address was changed,
__________________
2013 Jayco Eagle 284BHS
2012 Ford F150XLT, EcoBoost w/3.73,Max Tow Pkg.
Our Solar Album https://www.jaycoowners.com/album.php?albumid=329
Mustang65 is offline   Reply With Quote
Old 07-23-2018, 05:18 PM   #3
Senior Member
 
Cosmik Debris's Avatar
 
Join Date: Aug 2013
Location: Missoula, Montana
Posts: 704
Changed IP

To deal with this I created an account at changeip.com. It's free and once you set up your home router all is automated.
__________________
"I might be movin' to Montana soon..."

2020 Outdoors RV Glacier Peak Titanium
2013 Eagle 29.5RKS (traded in)
2013 Ford 6.7L diesel F350
Cosmik Debris is offline   Reply With Quote
Old 07-23-2018, 06:01 PM   #4
Site Team
 
Mustang65's Avatar
 
Join Date: Nov 2012
Location: Clearwater, FL area
Posts: 5,196
Hopefully they are better at this than in years gone by. I have gone through 3 over the years, 2 went south and one decided to start charging a monthly DNS fee. That is when I did my first bat/exe (now I am dating myself), moved to VBA and now the Pi (Python). Most of my things are using VPN for my remote access. Keeps the Home Automation/Energy Management/Security camera stuff a LOT more secure. I have narrowed my system down to one cloud service (portal), but I can not get rid of that one.

Don
My Registry

RVing with SOLAR
__________________
2013 Jayco Eagle 284BHS
2012 Ford F150XLT, EcoBoost w/3.73,Max Tow Pkg.
Our Solar Album https://www.jaycoowners.com/album.php?albumid=329
Mustang65 is offline   Reply With Quote
Old 07-24-2018, 07:51 AM   #5
Senior Member
 
Join Date: May 2013
Location: Dale Hollow Lake Tn/Ky
Posts: 2,525
Admitting that I am not a techie, this is all way over my pay grade. My home set up consists of a router, 2 printers, and who ever has my PW. When I go out in the rv, I get info about what's going on at home via email from friends. My need to know is pretty low on stuff like this.
Bassdogs is offline   Reply With Quote
Old 07-24-2018, 09:31 AM   #6
Site Team
 
Mustang65's Avatar
 
Join Date: Nov 2012
Location: Clearwater, FL area
Posts: 5,196
Quote:
Originally Posted by Bassdogs View Post
…..Admitting that I am not a techie, this is all way over my pay grade.....
No better time to start than now!!!!

It does not cost a lot! You do not have to know how to program, just ask on the electronics forums and they will walk you through it. Most programming now days is just cut (from websites), paste, compile and run. You will amaze your friends with some of the things you can do with electronics.

Don

My Registry

RVing with SOLAR
__________________
2013 Jayco Eagle 284BHS
2012 Ford F150XLT, EcoBoost w/3.73,Max Tow Pkg.
Our Solar Album https://www.jaycoowners.com/album.php?albumid=329
Mustang65 is offline   Reply With Quote
Old 11-30-2018, 07:25 PM   #7
Senior Member
 
Join Date: Aug 2015
Location: kaml
Posts: 1,285
Just found this thread.

What do people have installed in their RV's?

Mine currently has 1 Arduino. 2 ESp8266's, a Pi2 & a Pi3.

System is in flux but right now the Pi2 is the latest setup (Pi3 was already running Win-IOT) and it monitors the solar CC and gets shunt data from one of the 8266's. The other 8266 will be doing tank levels (hopefully). Works on the bench but I need to get to where I can fill & dump to test further. The Aurduino used to talk to the old CC and the shunt and has a touch screen attached. The Pi3 was being used for display of a UI of trailer info, not sure what it does next as the display of info has moved to a Web interface I can view on my phone.
PlayersZ28 is offline   Reply With Quote
Old 11-30-2018, 08:26 PM   #8
Senior Member
 
WeRJuliian's Avatar
 
Join Date: Mar 2017
Location: Sarasota
Posts: 742
Quote:
Originally Posted by Mustang65 View Post
Most programming now days is just cut (from websites), paste, compile and run.
OK..old-style programmer and code junkie, here...(I cut my coding teeth on symbolic assembler and paper tape

I'd have to put that differently... "Most cut and paste programming is really inefficient and wasteful..."
Not to mention being really annoying to debug after it's been repurposed through a dozen sets of hands.

(The Lady From Little Rock just added a valid point.. If you don't understand the code, how do you know what other, nefarious tricks might be tucked away in there ?)
WeRJuliian is offline   Reply With Quote
Old 11-30-2018, 10:26 PM   #9
Senior Member
 
Join Date: Jun 2016
Location: Denver
Posts: 4,245
Quote:
Originally Posted by WeRJuliian View Post
OK..old-style programmer and code junkie, here...(I cut my coding teeth on symbolic assembler and paper tape

I'd have to put that differently... "Most cut and paste programming is really inefficient and wasteful..."
Not to mention being really annoying to debug after it's been repurposed through a dozen sets of hands.

(The Lady From Little Rock just added a valid point.. If you don't understand the code, how do you know what other, nefarious tricks might be tucked away in there ?)
Oh my goodness - I couldn't disagree more!

I've been coding for 35+ years. These days it's 60% Java, 30% C, 10% Python.
I couldn't imagine getting thru anything without cutting and pasting a snippet from Google, Stackoverflow, Github.



Anyway - RPi's in my motorhome.
I just figured out how to interface to the EPSolar controller.

https://donotfreezesoftware.blogspot...ompletely.html

and

https://donotfreezesoftware.blogspot...ontroller.html
__________________
2016 Greyhawk 31FK
pconroy is offline   Reply With Quote
Old 12-01-2018, 06:42 AM   #10
Senior Member
 
Join Date: Aug 2015
Location: kaml
Posts: 1,285
I first wrote code back in '75 using WATFIV at UofW. Did it for a job for many years, now I do it for fun. I also code with my son on things we find interesting. The Internet lets you crib code snippets from places but you still have to know what it does and be able to understand it. Just saves the time of writing it from scratch. If you don't know how it works then you're like a mechanic that changes parts until the problem goes away, never knowing hat the actual problem was. Python is getting a lot more popular as it's being taught in schools.

My CC is a Renogy Rover (EPsolar/Epever the same) and I'm using libmodbus w/C++ and a SQL db.
PlayersZ28 is offline   Reply With Quote
Old 12-01-2018, 09:27 AM   #11
Site Team
 
Mustang65's Avatar
 
Join Date: Nov 2012
Location: Clearwater, FL area
Posts: 5,196
Quote:
Originally Posted by WeRJuliian View Post
OK..old-style programmer and code junkie, here...(I cut my coding teeth on symbolic assembler and paper tape

I'd have to put that differently... "Most cut and paste programming is really inefficient and wasteful..."
Not to mention being really annoying to debug after it's been repurposed through a dozen sets of hands.

(The Lady From Little Rock just added a valid point.. If you don't understand the code, how do you know what other, nefarious tricks might be tucked away in there ?)
All valid points in the "OLD DAYS". Today, IE GitHub and Arduino/Pi forums, there are hundreds of thousands of members that specialize in the Arduino, Raspberry Pi, and other microcontrollers, that update the code (Python, "C"....) you put up to make it more efficient. Unlike the days when you had code on the main-frame from 1 or 2 programmers that may not have been to efficient at writing code, and as a LAST resort you would cut/paste it, and re-do it later if you had time.

OK, so I was a mainframe COBOL programmer (70s-80s) that used calls to assembler to get things done faster (a lot faster). I even had a PC COBOL program at home that controlled some of my Home Automation stuff in the early 80' and would print out issues on my home printer.

Now that little Arduino $5 micro-controller knows when there is a leak, shuts down the city water supply, and texts me when/if there is a leak. It automatically closes/opens the city water valve once a week so that the valve does not get stuck in the open position over time.

Times have changed... for the better in this area...
Don

My Registry

RVing with SOLAR
__________________
2013 Jayco Eagle 284BHS
2012 Ford F150XLT, EcoBoost w/3.73,Max Tow Pkg.
Our Solar Album https://www.jaycoowners.com/album.php?albumid=329
Mustang65 is offline   Reply With Quote
Old 12-01-2018, 04:19 PM   #12
Senior Member
 
SloPoke's Avatar
 
Join Date: Apr 2016
Location: Kingman AZ and where our Seneca is today.
Posts: 3,118
Quote:
Originally Posted by Mustang65 View Post
As norty1 mentioned, we can use the IOT ELECTRONICS and RVing thread in the Social Group as the index. I would recommend that we start each new "Title" with the letters "IOT - " and then your topic. This will help when doing a search.

Maybe, we do not use the Social Group and only Post things here, or maybe post the SCRIPTS on GitHub.... not sure
oh goodness... this thread is all over the place already!!!

...so I will try to stay with the OP first - I agree with "No code" on the forum idea - GitHub is designed for that, let the contributor upload the project with their tested code and we can discuss on the forum. If you like the enhancement / bug-fix then you can cut/paste for your personal consumption all you wish.


Quote:
Originally Posted by Mustang65 View Post
Most of my things are using VPN for my remote access. Keeps the Home Automation/Energy Management/Security camera stuff a LOT more secure. I have narrowed my system down to one cloud service (portal), but I can not get rid of that one.
In today's plethora of unsecured appliances and applications that run on them, We put every IOT node on our home/work network on a separate VLAN. A separate VLAN for cameras, another VLAN for Nest, Roku, Ring, Ecobee... and two other VLAN's for our wireless phones and another for a guest WiFi. None can talk to each other


Quote:
Originally Posted by PlayersZ28 View Post
Just found this thread.

What do people have installed in their RV's?

Mine currently has 1 Arduino. 2 ESp8266's, a Pi2 & a Pi3.
Our network in our Seneca is strictly to support DW and I to be able to work full time wherever whe happen to be. Our network is 100% Mikrotik powered POE from our Seneca's house batteries. Internal network is a MT SPF NAT configured router with 3-VLAN's and two interfaces on the WAN side that connect to a MT-SXT 2.4 / 5ghz CPE for connecting to public(untrusted) networks including RV park WiFi (which generally sucks beyond imagination, but we often purchase their premium WiFi that we can work off of). The other input is a wAP-LTE we have on a mast that works as a wired HotSpot.


Quote:
Originally Posted by pconroy View Post
Oh my goodness - I couldn't disagree more!

I've been coding for 35+ years. These days it's 60% Java, 30% C, 10% Python.
I couldn't imagine getting thru anything without cutting and pasting a snippet from Google, Stackoverflow, Github.

I'm going on 39 years with the same company, don't write code anymore, but get to facilitate code-reviews for everything my team writes. 60% .net, 30% Java and the rest is scripting and COBOL.
Agree with the cut/paste methodology is the new norm with the new generation of coders. I can google their code and tease them the next day about where they found it!


Quote:
Originally Posted by Mustang65 View Post
Unlike the days when you had code on the main-frame from 1 or 2 programmers that may not have been to efficient at writing code, and as a LAST resort you would cut/paste it, and re-do it later if you had time.

OK, so I was a mainframe COBOL programmer (70s-80s) that used calls to assembler to get things done faster (a lot faster).
Isn't it interesting that after all these years... there are still millions of lines of code that are running right now, still running mission critical business programs and have not abended in years. I just sunsetted my last COBOL application last month - the last time we had torn it apart was for Y2K!
__________________
Steve & Stacy with Jasper (Australian Cattle dog)
2015 Seneca 36FK
Custom 27' flatbed trailer hauling:
07 Toyota FJC & Yamaha Kodiak 400 ATV

SloPoke is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


» Featured Campgrounds

Reviews provided by

Powered by vBadvanced CMPS v3.2.3
Disclaimer:

This website is not affiliated with or endorsed by Jayco, Inc. or any of its affiliates. This is an independent, unofficial site.


All times are GMT -6. The time now is 06:27 PM.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2016 Social Knowledge, LLC All Rights Reserved.