Well for two nights I've tried this and it is clear that I just can't 
figure it out and the doc isn't too clear for me.  If someone could help me 
get moving again, I'd really appreciate it.

I have put a file called Raspberry_Pi.py in /usr

pi@wx-rpi:/usr $ ls -l Rasp*
-rw-r--r-- 1 pi pi 2664 Jun 20 21:17 Raspberry_Pi.py

I have what I believe is the proper code in the config file. Under Station 
I have:


    station_type = Raspberry_Pi

Then I have:

[Raspberry_Pi]
    loop_interval = 5
    driver = usr.Raspberry_Pi


When I start it, this is in the log:

Jun 20 21:17:30 wx-rpi systemd[1]: Starting LSB: weewx weather system...
Jun 20 21:17:30 wx-rpi weewx[24463]: engine: Initializing weewx version 3.7.
1
Jun 20 21:17:30 wx-rpi weewx[24463]: engine: Using Python 2.7.9 (default, 
Sep 17 2016, 20:26:04) #012[GCC 4.9.2]
Jun 20 21:17:30 wx-rpi weewx[24463]: engine: Platform Linux-4.9.24-v7+-
armv7l-with-debian-8.0
Jun 20 21:17:30 wx-rpi weewx[24463]: engine: Locale is 'en_US.UTF-8'
Jun 20 21:17:30 wx-rpi weewx[24463]: engine: pid file is /var/run/weewx.pid
Jun 20 21:17:30 wx-rpi weewx[24453]: Starting weewx weather system: weewx.
Jun 20 21:17:30 wx-rpi systemd[1]: Started LSB: weewx weather system.
Jun 20 21:17:30 wx-rpi weewx[24467]: engine: Using configuration file /etc/
weewx/weewx.conf
Jun 20 21:17:30 wx-rpi weewx[24467]: engine: Loading station type 
Raspberry_Pi (usr.Raspberry_Pi)
Jun 20 21:17:30 wx-rpi weewx[24467]: engine: Caught unrecoverable exception 
in engine:
Jun 20 21:17:30 wx-rpi weewx[24467]:     ****  No module named usr.
Raspberry_Pi
Jun 20 21:17:30 wx-rpi weewx[24467]:     ****  Traceback (most recent call 
last):
Jun 20 21:17:30 wx-rpi weewx[24467]:     ****    File 
"/usr/share/weewx/weewx/engine.py", line 865, in main
Jun 20 21:17:30 wx-rpi weewx[24467]:     ****      engine = engine_class(
config_dict)
Jun 20 21:17:30 wx-rpi weewx[24467]:     ****    File 
"/usr/share/weewx/weewx/engine.py", line 71, in __init__
Jun 20 21:17:30 wx-rpi weewx[24467]:     ****      self.setupStation(
config_dict)
Jun 20 21:17:30 wx-rpi weewx[24467]:     ****    File 
"/usr/share/weewx/weewx/engine.py", line 95, in setupStation
Jun 20 21:17:30 wx-rpi weewx[24467]:     ****      __import__(driver)
Jun 20 21:17:30 wx-rpi weewx[24467]:     ****  ImportError: No module named 
usr.Raspberry_Pi
Jun 20 21:17:30 wx-rpi weewx[24467]:     ****  Exiting.

Here is the driver file I am trying to use.

#
#    $Revision: 1 $
#    $Author: Nickolas McColl $
#    $Date: 2014-08-16 $
#
"""Raspberry Pi driver for the weewx weather system"""


from __future__ import with_statement
# import math
import time
#import weedb
#import weeutil.weeutil
import weewx.abstractstation
import weewx.wxformulas




def loader(config_dict, engine):
    import weewx.units
    altitude_m = weewx.units.getAltitudeM(config_dict)


    station = Raspberry_Pi(altitude = altitude_m, **config_dict[
'Raspberry_Pi'])


    return station


class Raspberry_Pi(weewx.abstractstation.AbstractStation):
    """Station using Raspberry Pi"""


    def __init__(self, **stn_dict):
        self.altitude = stn_dict['altitude']
        self.loop_interval = float(stn_dict.get('loop_interval'))


    def genLoopPackets(self):
        import weewx.units


        while True:
            start_time = time.time()


            # Create Loop packet
            f = open('/var/tmp/weewx/bin/wxdata.csv')
            input = f.readline()
            f.close()
            data = input.split(',')
            if len(data) == 13: # data line is complete, process
                for i in range(1, (len(data))):
                    try:
                        data[i] = float(data[i])
                    except ValueError:
                        data[i] = None


                raw_time =time.strptime(data[0], "%Y-%m-%d %H:%M:%S")


                _packet = {'dateTime': int(time.mktime(raw_time)),
                           'usUnits' : weewx.METRIC,
                           'pressure' : data[1],
                           'outTemp' : data[4],
                           'outHumidity' : data[5]}


                _packet['dewpoint']  = weewx.wxformulas.dewpointC(_packet[
'outTemp'], _packet['outHumidity'])
                _packet['barometer'] = weewx.wxformulas.
sealevel_pressure_Metric(_packet['pressure'], self.altitude, _packet[
'outTemp'])
                _packet['altimeter'] = weewx.wxformulas.
altimeter_pressure_Metric(_packet['pressure'], self.altitude)
                _packet['heatdeg'] = weewx.wxformulas.heating_degrees(
_packet['outTemp'], 18.333)
                _packet['cooldeg'] = weewx.wxformulas.cooling_degrees(
_packet['outTemp'], 18.333)
                _packet['heatindex'] = weewx.wxformulas.heatindexC(_packet[
'outTemp'], _packet['outHumidity'])


                yield _packet


            sleep_time = (start_time - time.time()) + self.loop_interval
            if sleep_time > 0:
                  time.sleep(sleep_time)


    def hardware_name(self):
        return "Raspberry_Pi"


-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to