copying util/import/cumulus-example.conf -> /home/weewx/util/import
copying util/launchd/com.weewx.weewxd.plist -> /home/weewx/util/launchd
creating /home/weewx/util/default
copying util/default/weewx -> /home/weewx/util/default
running install_egg_info
Writing /home/weewx/bin/weewx-4.0.0.egg-info
Traceback (most recent call last):
File "/home/weewx/bin/wee_config", line 12, in <module>
import weeutil.logger
File "/home/weewx/bin/weeutil/logger.py", line 14, in <module>
import configobj
ImportError: No module named 'configobj'
pi@raspberrypi:~ $ sudo systemctl status weewx
● weewx.service - LSB: weewx weather system
Loaded: loaded (/etc/init.d/weewx)
Active: failed (Result: exit-code) since Thu 2020-05-21 14:41:54 AEST; 50s ago
Process: 422 ExecStart=/etc/init.d/weewx start (code=exited, status=1/FAILURE)
May 21 14:41:54 raspberrypi weewx[422]: Starting weewx weather system: weewxTraceback (most recent call last):
May 21 14:41:54 raspberrypi weewx[422]: File "/home/weewx/bin/weewxd", line 21, in <module>
May 21 14:41:54 raspberrypi weewx[422]: import weecfg
May 21 14:41:54 raspberrypi weewx[422]: File "/home/weewx/bin/weecfg/__init__.py", line 22, in <module>
May 21 14:41:54 raspberrypi weewx[422]: import configobj
May 21 14:41:54 raspberrypi weewx[422]: ImportError: No module named 'configobj'
May 21 14:41:54 raspberrypi weewx[422]: failed!
May 21 14:41:54 raspberrypi systemd[1]: weewx.service: control process exited, code=exited status=1
May 21 14:41:54 raspberrypi systemd[1]: Failed to start LSB: weewx weather system.
May 21 14:41:54 raspberrypi systemd[1]: Unit weewx.service entered failed state.
$ sudo apt install python3-configobj$ sudo apt install python-configobjst login: Thu May 21 14:42:32 2020 from 192.168.0.54
pi@raspberrypi:~ $ sudo systemctl status weewx
● weewx.service - LSB: weewx weather system
Loaded: loaded (/etc/init.d/weewx)
Active: active (exited) since Thu 2020-05-21 15:18:36 AEST; 54s ago
Process: 419 ExecStart=/etc/init.d/weewx start (code=exited, status=0/SUCCESS)
May 21 15:18:36 raspberrypi weewxd[557]: weewx[557] CRITICAL __main__: **** File "/home/weewx/bin/weewx/engine.py", line 72, in __init__
May 21 15:18:36 raspberrypi weewxd[557]: weewx[557] CRITICAL __main__: **** self.preLoadServices(config_dict)
May 21 15:18:36 raspberrypi weewxd[557]: weewx[557] CRITICAL __main__: **** File "/home/weewx/bin/weewx/engine.py", line 112, in preLoadServices
May 21 15:18:36 raspberrypi weewxd[557]: weewx[557] CRITICAL __main__: **** self.stn_info = weewx.station.StationInfo(self.console, **conf...tation'])
May 21 15:18:36 raspberrypi weewxd[557]: weewx[557] CRITICAL __main__: **** File "/home/weewx/bin/weewx/station.py", line 41, in __init__
May 21 15:18:36 raspberrypi weewxd[557]: weewx[557] CRITICAL __main__: **** if console and hasattr(console, 'hardware_name'):
May 21 15:18:36 raspberrypi weewxd[557]: weewx[557] CRITICAL __main__: **** File "/home/weewx/bin/weewx/drivers/__init__.py", line 17, in hardware_name
May 21 15:18:36 raspberrypi weewxd[557]: weewx[557] CRITICAL __main__: **** raise NotImplementedError("Property 'hardware_name' not implemented")
May 21 15:18:36 raspberrypi weewxd[557]: weewx[557] CRITICAL __main__: **** NotImplementedError: Property 'hardware_name' not implemented
May 21 15:18:36 raspberrypi weewxd[557]: weewx[557] CRITICAL __main__: **** Exiting.
Hint: Some lines were ellipsized, use -l to show in full.
pi@raspberrypi:~ $
#
# $Revision: 1 $
# $Author: Nickolas McColl $
# $Date: 2014-08-16 $
# Initial information from above author further edits by Nev Davis
# Latest edit 20 June 2017 by Nev Davis
"""Raspberry Pi driver for the weewx weather system"""
from __future__ import with_statement
import math
import time
import weewx.units
import weedb
import weeutil.weeutil
import weewx.drivers
import weewx.wxformulas
DRIVER_NAME = 'PiWeather'
DRIVER_VERSION = "1.9"
def loader(config_dict, engine):
return PiWeatherDriver(**config_dict[DRIVER_NAME])
def confeditor_loader():
return PiWeatherConfEditor()
class PiWeatherDriver(weewx.drivers.AbstractDevice):
def __init__(self, **stn_dict):
self.loop_interval = float(stn_dict.get('loop_interval',2.5))
def genLoopPackets(self):
while True:
start_time = time.time()
# Create Loop packet
f = open('/var/ramdisk/wxdata.csv')
input = f.readline()
f.close()
data = input.split(',')
if len(data) == 13: # data line is complete, process
# if len(data) == 11:
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,
'outTemp' : data[1],
'outHumidity' : data[2],
'windSpeed' : data[3], #use 3 second average
'windGust' : data[4], #use 3 second average
'windDir' : data[5],
'pressure' : data[6],
'extraTemp1' : data[7],
'inTemp' : data[8],
'inHumidity' : data[9],
'UV' : data[10],
'radiation' :data[11],
'farsSpeed' : data[12]
}
_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
#sleep_time = self.loop_interval
if sleep_time > 0:
time.sleep(sleep_time)
class PiWeatherConfEditor(weewx.drivers.AbstractConfEditor):
@property
def default_stanza(self):
return
@property
def hardware_name(self):
return "MyDriverName"
Fileparse driver is a good simple example.
Gary
● weewx.service - LSB: weewx weather system
Loaded: loaded (/etc/init.d/weewx)
Active: active (exited) since Thu 2020-05-21 16:20:37 AEST; 1h 9min ago
Process: 426 ExecStart=/etc/init.d/weewx start (code=exited, status=0/SUCCESS)
May 21 16:20:37 raspberrypi weewxd[558]: weewx[558] CRITICAL __main__: **** if console and hasattr(console, 'hardware_name'):
May 21 16:20:37 raspberrypi weewxd[558]: weewx[558] CRITICAL __main__: **** File "/home/weewx/bin/weewx/drivers/__init__.py", line 17, in hardware_name
May 21 16:20:37 raspberrypi weewxd[558]: weewx[558] CRITICAL __main__: **** raise NotImplementedError("Property 'hardware_name' not implemented")
May 21 16:20:37 raspberrypi weewxd[558]: weewx[558] CRITICAL __main__: **** NotImplementedError: Property 'hardware_name' not implemented
May 21 16:20:37 raspberrypi weewxd[558]: weewx[558] CRITICAL __main__: **** Exiting.
May 21 16:39:53 raspberrypi systemd[1]: Started LSB: weewx weather system.
May 21 16:48:24 raspberrypi systemd[1]: Started LSB: weewx weather system.
May 21 16:58:44 raspberrypi systemd[1]: Started LSB: weewx weather system.
May 21 17:25:32 raspberrypi systemd[1]: Started LSB: weewx weather system.
May 21 17:30:24 raspberrypi systemd[1]: Started LSB: weewx weather system.
pi@raspberrypi:/home/weewx/bin/weewx/drivers $
pi@raspberrypi:/home/sensorreadings $ python getrain.py //localhost:4304/1D.E3AB0D000000/counter.B
16570
pi@raspberrypi:/home/sensorreadings $
which is great and does show correct bucket tip info.
What I am now attempting to do (with very little success , i am blaming my age(75) :) is how to get the command line arguments required with the owget.py script and call that script from my main sensordata.py script (this collects all data from i2C network and wind.
What I want to end up with e.g 16570 returned to my main script and I process it further from there.
I have been looking at subprocess but I am way over my head and any guidance would be appreciated.
Neville