About home.newts.org

      No Comments on About home.newts.org

home.newts.org is a tiny Raspberry Pi Linux computer. Currently it runs pyweather to connect my Davis Vantage Pro2 weather station to wunderground.com. It also runs my tf mud client in a screen session and has a Cherokee web server that consolidates some information about the house and the solar power generation.


The page uses python to get XML data from the Vera Z-wave controller and thermostat and HTML data from the Enphase Envoy gateway controller.

import xml.etree.ElementTree as ET
import urllib2
import re
from bs4 import BeautifulSoup
import time
page = open('index.html').read()
now = time.localtime(time.time())
day = now.tm_mday
year = now.tm_year
month = now.tm_mon
# get the inside temperature
vera = ''
vera_xml_data = urllib2.urlopen(vera).read()
root = ET.fromstring(vera_xml_data)
units = root.findall(".")[0].attrib['temperature']
thermostat = root.findall(".//devices/device[@name='Thermostat']")[0]
temperature = thermostat.attrib['temperature']
setting = thermostat.attrib['heatsp']
inside_temperature = 'Temperature = %s°%s Thermostat = %s°%s' % (temperature,units,setting,units)
# Get the solar production data
solar_home_page =  urllib2.urlopen('').read()
solar_production_page = urllib2.urlopen('').read()
solar_re = re.compile(r'<!-- START MAIN PAGE CONTENT -->.*<!-- END MAIN PAGE CONTENT -->', re.MULTILINE+re.DOTALL)
solar_home = solar_re.findall(solar_home_page)[0]
solar_production = solar_re.findall(solar_production_page)[0]
soup = BeautifulSoup(solar_home)
tables = soup.find_all('table')
solar_statistics = tables[1]
solar_data = """
""" % (solar_statistics,solar_production)
\n%s' % (time.asctime(now),graph_data) 
print 'Content-type: text/html\n\n' print page % (graph_data,inside_temperature,solar_data)

Leave a Reply