themoosman / weewx-ambientweatherapi-json

An AmbientWeather API driver for the weewx weather software using JSON.
14 stars 0 forks source link

Error when starting weewxd #32

Closed mjm455 closed 4 months ago

mjm455 commented 4 months ago

I'm new to trying out weewx so I just installed Raspbian Lite on my Zero W. I then followed install instructions from https://weewx.com/docs/4.10/usersguide.htm. This is when I noticed that my 2902 weather station is not available so I then came across your code. I edited the conf file and made sure the permissions were correct but I'm see the following error:

Jun 05 04:13:04 raspberrypi systemd[1]: Started WeeWX. Jun 05 04:13:06 raspberrypi weewxd[14413]: INFO main: Initializing weewxd version 5.0.2 Jun 05 04:13:06 raspberrypi weewxd[14413]: INFO main: Command line: /usr/share/weewx/weewxd.py /etc/weewx/weewx.conf Jun 05 04:13:06 raspberrypi weewxd[14413]: INFO main: Using Python 3.9.2 (default, Mar 12 2021, 04:06:34) [GCC 10.2.1 20210110] Jun 05 04:13:06 raspberrypi weewxd[14413]: INFO main: Located at /usr/bin/python3 Jun 05 04:13:06 raspberrypi weewxd[14413]: INFO main: Platform Linux-6.1.21+-armv6l-with-glibc2.31 Jun 05 04:13:06 raspberrypi weewxd[14413]: INFO main: Locale: 'en_GB.UTF-8' Jun 05 04:13:06 raspberrypi weewxd[14413]: INFO main: Entry path: /usr/share/weewx/weewxd.py Jun 05 04:13:06 raspberrypi weewxd[14413]: INFO main: WEEWX_ROOT: /etc/weewx Jun 05 04:13:06 raspberrypi weewxd[14413]: INFO main: Configuration file: /etc/weewx/weewx.conf Jun 05 04:13:06 raspberrypi weewxd[14413]: INFO main: User module: /etc/weewx/bin/user Jun 05 04:13:06 raspberrypi weewxd[14413]: INFO main: Debug: 0 Jun 05 04:13:06 raspberrypi weewxd[14413]: INFO weewx.engine: Loading station type ambientweatherapi (user.ambientweatherapi) Jun 05 04:13:08 raspberrypi weewxd[14413]: INFO root: use_meteobridge: False Jun 05 04:13:08 raspberrypi weewxd[14413]: INFO root: No Station MAC specified. The first station will be returned. Jun 05 04:13:08 raspberrypi weewxd[14413]: INFO root: Starting: ambientweatherapi, version: 0.0.11 Jun 05 04:13:08 raspberrypi weewxd[14413]: CRITICAL main: Caught unrecoverable exception: Jun 05 04:13:08 raspberrypi weewxd[14413]: CRITICAL main: 'Engine' Jun 05 04:13:08 raspberrypi weewxd[14413]: CRITICAL main: Traceback (most recent call last): Jun 05 04:13:08 raspberrypi weewxd[14413]: CRITICAL main: File "/usr/share/weewx/weewxd.py", line 160, in main Jun 05 04:13:08 raspberrypi weewxd[14413]: CRITICAL main: engine = weewx.engine.StdEngine(config_dict) Jun 05 04:13:08 raspberrypi weewxd[14413]: CRITICAL main: File "/usr/share/weewx/weewx/engine.py", line 89, in init Jun 05 04:13:08 raspberrypi weewxd[14413]: CRITICAL main: self.loadServices(config_dict) Jun 05 04:13:08 raspberrypi weewxd[14413]: CRITICAL main: File "/usr/share/weewx/weewx/engine.py", line 127, in loadServices Jun 05 04:13:08 raspberrypi weewxd[14413]: CRITICAL main: for service_group in config_dict['Engine']['Services']: Jun 05 04:13:08 raspberrypi weewxd[14413]: CRITICAL main: File "/usr/lib/python3/dist-packages/configobj.py", line 554, in getitem Jun 05 04:13:08 raspberrypi weewxd[14413]: CRITICAL main: val = dict.getitem(self, key) Jun 05 04:13:08 raspberrypi weewxd[14413]: CRITICAL main: KeyError: 'Engine' Jun 05 04:13:08 raspberrypi weewxd[14413]: CRITICAL main: Exiting. Jun 05 04:13:08 raspberrypi weewxd[14413]: Traceback (most recent call last): Jun 05 04:13:08 raspberrypi weewxd[14413]: File "/usr/share/weewx/weewxd.py", line 265, in Jun 05 04:13:08 raspberrypi weewxd[14413]: main() Jun 05 04:13:08 raspberrypi weewxd[14413]: File "/usr/share/weewx/weewxd.py", line 160, in main Jun 05 04:13:08 raspberrypi weewxd[14413]: engine = weewx.engine.StdEngine(config_dict) Jun 05 04:13:08 raspberrypi weewxd[14413]: File "/usr/share/weewx/weewx/engine.py", line 89, in init Jun 05 04:13:08 raspberrypi weewxd[14413]: self.loadServices(config_dict) Jun 05 04:13:08 raspberrypi weewxd[14413]: File "/usr/share/weewx/weewx/engine.py", line 127, in loadServices Jun 05 04:13:08 raspberrypi weewxd[14413]: for service_group in config_dict['Engine']['Services']: Jun 05 04:13:08 raspberrypi weewxd[14413]: File "/usr/lib/python3/dist-packages/configobj.py", line 554, in getitem Jun 05 04:13:08 raspberrypi weewxd[14413]: val = dict.getitem(self, key) Jun 05 04:13:08 raspberrypi weewxd[14413]: KeyError: 'Engine' Jun 05 04:13:08 raspberrypi systemd[1]: weewx.service: Main process exited, code=exited, status=1/FAILURE Jun 05 04:13:08 raspberrypi systemd[1]: weewx.service: Failed with result 'exit-code'. Jun 05 04:13:08 raspberrypi systemd[1]: weewx.service: Consumed 3.637s CPU time.

Let me know if you need more details.

themoosman commented 4 months ago

I think something is the weewx.conf is messed up. Does the weewx.conf look weird?

mjm455 commented 4 months ago

Not that I think. Here it is with some edits for privacy:

pi@raspberrypi:/etc/weewx $ more /etc/weewx/weewx.conf [Station] station_type = ambientweatherapi location = WeeWX station altitude = 262, foot latitude = 12.34 longitude = -56.78

##############################################################################

[ambientweatherapi]

This section for the AmbientWeatheAPI driver for weewx

# The time (in seconds) between LOOP packets and getting API data
# The ObserverIP only pushes data every 60 seconds.
loop_interval = 60

#API Log level
log_level = ERROR

#Log file location
log_file = /var/log/weewx.log

#URL to the Ambient Weather API
api_url = https://api.ambientweather.net/v1

#Ambient Weather API App Key
api_app_key = yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

#Ambient Weather API Key
api_key = zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

#MAC Address of station to reutrn data (default is the first station in the list.)
#station_mac = 'AB:CD:EF:AB:CD:EF'

#Ambient Weather Use Meteobridge (default if False)
#use_meteobridge = ''

# Name of Hardware device.
hardware = Ambient Weather WS-2902

# The driver to use:
driver = user.ambientweatherapi
themoosman commented 4 months ago

Does your weewx.conf have a section like this?

#   This section configures the internal weewx engine.
[Engine]
    # The following section specifies which services should be run and in what order.
    [[Services]]
      #A couple of other key/values.
mjm455 commented 4 months ago

I really tore down most of my conf file so I was missing that plus some other parts. So I added what I have above with the original file. However now I'm getting a slightly different error:

Jun 06 04:47:25 raspberrypi systemd[1]: Started WeeWX. Jun 06 04:47:27 raspberrypi weewxd[15385]: INFO main: Initializing weewxd version 5.0.2 Jun 06 04:47:27 raspberrypi weewxd[15385]: INFO main: Command line: /usr/share/weewx/weewxd.py /etc/weewx/weewx.conf Jun 06 04:47:27 raspberrypi weewxd[15385]: INFO main: Using Python 3.9.2 (default, Mar 12 2021, 04:06:34) [GCC 10.2.1 20210110] Jun 06 04:47:27 raspberrypi weewxd[15385]: INFO main: Located at /usr/bin/python3 Jun 06 04:47:27 raspberrypi weewxd[15385]: INFO main: Platform Linux-6.1.21+-armv6l-with-glibc2.31 Jun 06 04:47:27 raspberrypi weewxd[15385]: INFO main: Locale: 'en_GB.UTF-8' Jun 06 04:47:27 raspberrypi weewxd[15385]: INFO main: Entry path: /usr/share/weewx/weewxd.py Jun 06 04:47:27 raspberrypi weewxd[15385]: INFO main: WEEWX_ROOT: /etc/weewx Jun 06 04:47:27 raspberrypi weewxd[15385]: INFO main: Configuration file: /etc/weewx/weewx.conf Jun 06 04:47:27 raspberrypi weewxd[15385]: INFO main: User module: /etc/weewx/bin/user Jun 06 04:47:27 raspberrypi weewxd[15385]: INFO main: Debug: 0 Jun 06 04:47:27 raspberrypi weewxd[15385]: INFO weewx.engine: Loading station type ambientweatherapi (user.ambientweatherapi) Jun 06 04:47:29 raspberrypi weewxd[15385]: INFO root: use_meteobridge: False Jun 06 04:47:29 raspberrypi weewxd[15385]: INFO root: No Station MAC specified. The first station will be returned. Jun 06 04:47:29 raspberrypi weewxd[15385]: INFO root: Starting: ambientweatherapi, version: 0.0.11 Jun 06 04:47:29 raspberrypi weewxd[15385]: INFO weewx.engine: StdConvert target unit is 0x1 Jun 06 04:47:29 raspberrypi weewxd[15385]: INFO weewx.wxservices: StdWXCalculate will use data binding wx_binding Jun 06 04:47:29 raspberrypi weewxd[15385]: INFO weewx.engine: Archive will use data binding wx_binding Jun 06 04:47:29 raspberrypi weewxd[15385]: INFO weewx.engine: Record generation will be attempted in 'hardware' Jun 06 04:47:29 raspberrypi weewxd[15385]: INFO weewx.engine: Using archive interval of 300 seconds (specified in weewx configuration) Jun 06 04:47:29 raspberrypi weewxd[15385]: INFO weewx.restx: StationRegistry: Station will be registered. Jun 06 04:47:29 raspberrypi weewxd[15385]: INFO weewx.restx: Wunderground: Posting not enabled. Jun 06 04:47:29 raspberrypi weewxd[15385]: INFO weewx.restx: PWSweather: Posting not enabled. Jun 06 04:47:29 raspberrypi weewxd[15385]: INFO weewx.restx: CWOP: Posting not enabled. Jun 06 04:47:29 raspberrypi weewxd[15385]: INFO weewx.restx: WOW: Posting not enabled. Jun 06 04:47:29 raspberrypi weewxd[15385]: INFO weewx.restx: AWEKAS: Posting not enabled. Jun 06 04:47:29 raspberrypi weewxd[15385]: CRITICAL main: Caught unrecoverable exception: Jun 06 04:47:29 raspberrypi weewxd[15385]: CRITICAL main: init() takes 1 positional argument but 3 were given Jun 06 04:47:29 raspberrypi weewxd[15385]: CRITICAL main: Traceback (most recent call last): Jun 06 04:47:29 raspberrypi weewxd[15385]: CRITICAL main: File "/usr/share/weewx/weewxd.py", line 160, in main Jun 06 04:47:29 raspberrypi weewxd[15385]: CRITICAL main: engine = weewx.engine.StdEngine(config_dict) Jun 06 04:47:29 raspberrypi weewxd[15385]: CRITICAL main: File "/usr/share/weewx/weewx/engine.py", line 89, in init Jun 06 04:47:29 raspberrypi weewxd[15385]: CRITICAL main: self.loadServices(config_dict) Jun 06 04:47:29 raspberrypi weewxd[15385]: CRITICAL main: File "/usr/share/weewx/weewx/engine.py", line 157, in loadServices Jun 06 04:47:29 raspberrypi weewxd[15385]: CRITICAL main: obj = weeutil.weeutil.get_object(svc)(self, config_dict) Jun 06 04:47:29 raspberrypi weewxd[15385]: CRITICAL main: TypeError: init() takes 1 positional argument but 3 were given Jun 06 04:47:29 raspberrypi weewxd[15385]: CRITICAL main: Exiting. Jun 06 04:47:29 raspberrypi weewxd[15385]: Traceback (most recent call last): Jun 06 04:47:29 raspberrypi weewxd[15385]: File "/usr/share/weewx/weewxd.py", line 265, in Jun 06 04:47:29 raspberrypi weewxd[15385]: main() Jun 06 04:47:29 raspberrypi weewxd[15385]: File "/usr/share/weewx/weewxd.py", line 160, in main Jun 06 04:47:29 raspberrypi weewxd[15385]: engine = weewx.engine.StdEngine(config_dict) Jun 06 04:47:29 raspberrypi weewxd[15385]: File "/usr/share/weewx/weewx/engine.py", line 89, in init Jun 06 04:47:29 raspberrypi weewxd[15385]: self.loadServices(config_dict) Jun 06 04:47:29 raspberrypi weewxd[15385]: File "/usr/share/weewx/weewx/engine.py", line 157, in loadServices Jun 06 04:47:29 raspberrypi weewxd[15385]: obj = weeutil.weeutil.get_object(svc)(self, config_dict) Jun 06 04:47:29 raspberrypi weewxd[15385]: TypeError: init() takes 1 positional argument but 3 were given Jun 06 04:47:29 raspberrypi systemd[1]: weewx.service: Main process exited, code=exited, status=1/FAILURE Jun 06 04:47:29 raspberrypi systemd[1]: weewx.service: Failed with result 'exit-code'. Jun 06 04:47:29 raspberrypi systemd[1]: weewx.service: Consumed 4.043s CPU time.

themoosman commented 4 months ago

This plugin isn't the issue. You can see from the log that it loads just fine.

Jun 06 04:47:27 raspberrypi weewxd[15385]: INFO main: User module: /etc/weewx/bin/user
Jun 06 04:47:27 raspberrypi weewxd[15385]: INFO main: Debug: 0
Jun 06 04:47:27 raspberrypi weewxd[15385]: INFO weewx.engine: Loading station type ambientweatherapi (user.ambientweatherapi)
Jun 06 04:47:29 raspberrypi weewxd[15385]: INFO root: use_meteobridge: False
Jun 06 04:47:29 raspberrypi weewxd[15385]: INFO root: No Station MAC specified. The first station will be returned.
Jun 06 04:47:29 raspberrypi weewxd[15385]: INFO root: Starting: ambientweatherapi, version: 0.0.11
Jun 06 04:47:29 raspberrypi weewxd[15385]: INFO weewx.engine: StdConvert target unit is 0x1
Jun 06 04:47:29 raspberrypi weewxd[15385]: INFO weewx.wxservices: StdWXCalculate will use data binding wx_binding
mjm455 commented 4 months ago

What could be the issue? Should I try a different OS? Is there a way to determine if there is a communication issue between the RPi and the Ambient Weather station?

Thanks for your help on this. Really would like to get a local copy of all of my weather data.

themoosman commented 4 months ago

I would revert to the default weewx.conf file and see if that works.

mjm455 commented 4 months ago

I think I need to start from the beginning again. I followed the Debian installation guide found here: https://weewx.com/docs/5.0/quickstarts/debian/ but I'm confused which hardware setting to choose since I need to use the ambientweatherapi. When I picked one of the driver selections, the weewxd would not start with similar errors that I pasted above. Am I missing a step here?

mjm455 commented 4 months ago

I started over and installed weewx without changing anything. Just did a simple "sudo apt-get install weewx" and now it is showing this in the log:

Jun 7 01:30:32 raspberrypi systemd[1]: Started WeeWX. Jun 7 01:30:36 raspberrypi weewxd[17018]: INFO main: Initializing weewxd version 5.0.2 Jun 7 01:30:36 raspberrypi weewxd[17018]: INFO main: Command line: /usr/share/weewx/weewxd.py /etc/weewx/weewx.conf Jun 7 01:30:36 raspberrypi weewxd[17018]: INFO main: Using Python 3.9.2 (default, Mar 12 2021, 04:06:34) #012[GCC 10.2.1 20210110] Jun 7 01:30:36 raspberrypi weewxd[17018]: INFO main: Located at /usr/bin/python3 Jun 7 01:30:36 raspberrypi weewxd[17018]: INFO main: Platform Linux-6.1.21+-armv6l-with-glibc2.31 Jun 7 01:30:36 raspberrypi weewxd[17018]: INFO main: Locale: 'en_GB.UTF-8' Jun 7 01:30:36 raspberrypi weewxd[17018]: INFO main: Entry path: /usr/share/weewx/weewxd.py Jun 7 01:30:36 raspberrypi weewxd[17018]: INFO main: WEEWX_ROOT: /etc/weewx Jun 7 01:30:36 raspberrypi weewxd[17018]: INFO main: Configuration file: /etc/weewx/weewx.conf Jun 7 01:30:36 raspberrypi weewxd[17018]: INFO main: User module: /etc/weewx/bin/user Jun 7 01:30:36 raspberrypi weewxd[17018]: INFO main: Debug: 0 Jun 7 01:30:36 raspberrypi weewxd[17018]: INFO weewx.engine: Loading station type WS28xx (weewx.drivers.ws28xx) Jun 7 01:30:36 raspberrypi weewxd[17018]: INFO weewx.drivers.ws28xx: driver version is 0.51 Jun 7 01:30:36 raspberrypi weewxd[17018]: INFO weewx.drivers.ws28xx: frequency is US Jun 7 01:30:37 raspberrypi weewxd[17018]: CRITICAL weewx.drivers.ws28xx: Cannot find USB device with Vendor=0x6666 ProdID=0x5555 Device=None Serial=None Jun 7 01:30:37 raspberrypi weewxd[17018]: ERROR weewx.engine: Import of driver failed: Unable to find transceiver on USB (<class 'weewx.WeeWxIOError'>) Jun 7 01:30:37 raspberrypi weewxd[17018]: CRITICAL weewx.engine: Traceback (most recent call last): Jun 7 01:30:37 raspberrypi weewxd[17018]: CRITICAL weewx.engine: File "/usr/share/weewx/weewx/engine.py", line 115, in setupStation Jun 7 01:30:37 raspberrypi weewxd[17018]: CRITICAL weewx.engine: self.console = loader_function(config_dict, self) Jun 7 01:30:37 raspberrypi weewxd[17018]: CRITICAL weewx.engine: File "/usr/share/weewx/weewx/drivers/ws28xx.py", line 945, in loader Jun 7 01:30:37 raspberrypi weewxd[17018]: CRITICAL weewx.engine: ** return WS28xxDriver(config_dict[DRIVER_NAME]) Jun 7 01:30:37 raspberrypi weewxd[17018]: CRITICAL weewx.engine: File "/usr/share/weewx/weewx/drivers/ws28xx.py", line 1291, in init Jun 7 01:30:37 raspberrypi weewxd[17018]: CRITICAL weewx.engine: self.startUp() Jun 7 01:30:37 raspberrypi weewxd[17018]: CRITICAL weewx.engine: File "/usr/share/weewx/weewx/drivers/ws28xx.py", line 1410, in startUp Jun 7 01:30:37 raspberrypi weewxd[17018]: CRITICAL weewx.engine: self._service.setup(self.frequency, Jun 7 01:30:37 raspberrypi weewxd[17018]: CRITICAL weewx.engine: File "/usr/share/weewx/weewx/drivers/ws28xx.py", line 4017, in setup Jun 7 01:30:37 raspberrypi weewxd[17018]: CRITICAL weewx.engine: self.shid.open(vendor_id, product_id, device_id, serial) Jun 7 01:30:37 raspberrypi weewxd[17018]: CRITICAL weewx.engine: File "/usr/share/weewx/weewx/drivers/ws28xx.py", line 3068, in open Jun 7 01:30:37 raspberrypi weewxd[17018]: CRITICAL weewx.engine: raise weewx.WeeWxIOError('Unable to find transceiver on USB') Jun 7 01:30:37 raspberrypi weewxd[17018]: CRITICAL weewx.engine: weewx.WeeWxIOError: Unable to find transceiver on USB Jun 7 01:30:37 raspberrypi weewxd[17018]: CRITICAL main: Unable to load driver: Unable to find transceiver on USB Jun 7 01:30:37 raspberrypi weewxd[17018]: CRITICAL main: Exiting... Jun 7 01:30:38 raspberrypi systemd[1]: weewx.service: Main process exited, code=exited, status=4/NOPERMISSION Jun 7 01:30:38 raspberrypi systemd[1]: weewx.service: Failed with result 'exit-code'. Jun 7 01:30:38 raspberrypi systemd[1]: weewx.service: Consumed 2.407s CPU time.

So do I now work on installing the ambientweatherapi or should I just edit the conf file?

EDIT: Looking into this some more....it looks like the old edits are still in the /etc/weewx/weewx.conf file. Maybe I need to do a complete flash of the OS and start completely over. I dunno....

themoosman commented 4 months ago

You should be able to use station_type = Simulator as a test. Then restart and the logs should be clean.

mjm455 commented 4 months ago

I ran "sudo weectl station reconfigure" and picked Simulator but the error is mostly similar:

Jun 7 04:41:21 raspberrypi systemd[1]: Started WeeWX. Jun 7 04:41:22 raspberrypi weewxd[17162]: INFO main: Initializing weewxd version 5.0.2 Jun 7 04:41:22 raspberrypi weewxd[17162]: INFO main: Command line: /usr/share/weewx/weewxd.py /etc/weewx/weewx.conf Jun 7 04:41:22 raspberrypi weewxd[17162]: INFO main: Using Python 3.9.2 (default, Mar 12 2021, 04:06:34) #012[GCC 10.2.1 20210110] Jun 7 04:41:22 raspberrypi weewxd[17162]: INFO main: Located at /usr/bin/python3 Jun 7 04:41:23 raspberrypi weewxd[17162]: INFO main: Platform Linux-6.1.21+-armv6l-with-glibc2.31 Jun 7 04:41:23 raspberrypi weewxd[17162]: INFO main: Locale: 'en_GB.UTF-8' Jun 7 04:41:23 raspberrypi weewxd[17162]: INFO main: Entry path: /usr/share/weewx/weewxd.py Jun 7 04:41:23 raspberrypi weewxd[17162]: INFO main: WEEWX_ROOT: /etc/weewx Jun 7 04:41:23 raspberrypi weewxd[17162]: INFO main: Configuration file: /etc/weewx/weewx.conf Jun 7 04:41:23 raspberrypi weewxd[17162]: INFO main: User module: /etc/weewx/bin/user Jun 7 04:41:23 raspberrypi weewxd[17162]: INFO main: Debug: 0 Jun 7 04:41:23 raspberrypi weewxd[17162]: INFO weewx.engine: Loading station type Simulator (weewx.drivers.simulator) Jun 7 04:41:23 raspberrypi weewxd[17162]: INFO weewx.engine: StdConvert target unit is 0x1 Jun 7 04:41:23 raspberrypi weewxd[17162]: INFO weewx.wxservices: StdWXCalculate will use data binding wx_binding Jun 7 04:41:23 raspberrypi weewxd[17162]: INFO weewx.engine: Archive will use data binding wx_binding Jun 7 04:41:23 raspberrypi weewxd[17162]: INFO weewx.engine: Record generation will be attempted in 'hardware' Jun 7 04:41:23 raspberrypi weewxd[17162]: INFO weewx.engine: Using archive interval of 300 seconds (specified in weewx configuration) Jun 7 04:41:23 raspberrypi weewxd[17162]: INFO weewx.restx: StationRegistry: Station will be registered. Jun 7 04:41:23 raspberrypi weewxd[17162]: INFO weewx.restx: Wunderground: Posting not enabled. Jun 7 04:41:23 raspberrypi weewxd[17162]: INFO weewx.restx: PWSweather: Posting not enabled. Jun 7 04:41:23 raspberrypi weewxd[17162]: INFO weewx.restx: CWOP: Posting not enabled. Jun 7 04:41:23 raspberrypi weewxd[17162]: INFO weewx.restx: WOW: Posting not enabled. Jun 7 04:41:23 raspberrypi weewxd[17162]: INFO weewx.restx: AWEKAS: Posting not enabled. Jun 7 04:41:24 raspberrypi weewxd[17162]: CRITICAL main: Caught unrecoverable exception: Jun 7 04:41:24 raspberrypi weewxd[17162]: CRITICAL main: init() takes 1 positional argument but 3 were given Jun 7 04:41:24 raspberrypi weewxd[17162]: CRITICAL main: Traceback (most recent call last): Jun 7 04:41:24 raspberrypi weewxd[17162]: CRITICAL main: File "/usr/share/weewx/weewxd.py", line 160, in main Jun 7 04:41:24 raspberrypi weewxd[17162]: CRITICAL main: engine = weewx.engine.StdEngine(config_dict) Jun 7 04:41:24 raspberrypi weewxd[17162]: CRITICAL main: File "/usr/share/weewx/weewx/engine.py", line 89, in init Jun 7 04:41:24 raspberrypi weewxd[17162]: CRITICAL main: self.loadServices(config_dict) Jun 7 04:41:24 raspberrypi weewxd[17162]: CRITICAL main: File "/usr/share/weewx/weewx/engine.py", line 157, in loadServices Jun 7 04:41:24 raspberrypi weewxd[17162]: CRITICAL main: obj = weeutil.weeutil.get_object(svc)(self, config_dict) Jun 7 04:41:24 raspberrypi weewxd[17162]: CRITICAL main: TypeError: init() takes 1 positional argument but 3 were given Jun 7 04:41:24 raspberrypi weewxd[17162]: CRITICAL main: Exiting. Jun 7 04:41:24 raspberrypi weewxd[17162]: Traceback (most recent call last): Jun 7 04:41:24 raspberrypi weewxd[17162]: File "/usr/share/weewx/weewxd.py", line 265, in Jun 7 04:41:24 raspberrypi weewxd[17162]: main() Jun 7 04:41:24 raspberrypi weewxd[17162]: File "/usr/share/weewx/weewxd.py", line 160, in main Jun 7 04:41:24 raspberrypi weewxd[17162]: engine = weewx.engine.StdEngine(config_dict) Jun 7 04:41:24 raspberrypi weewxd[17162]: File "/usr/share/weewx/weewx/engine.py", line 89, in init Jun 7 04:41:24 raspberrypi weewxd[17162]: self.loadServices(config_dict) Jun 7 04:41:24 raspberrypi weewxd[17162]: File "/usr/share/weewx/weewx/engine.py", line 157, in loadServices Jun 7 04:41:24 raspberrypi weewxd[17162]: obj = weeutil.weeutil.get_object(svc)(self, config_dict) Jun 7 04:41:24 raspberrypi weewxd[17162]: TypeError: init() takes 1 positional argument but 3 were given Jun 7 04:41:25 raspberrypi systemd[1]: weewx.service: Main process exited, code=exited, status=1/FAILURE Jun 7 04:41:25 raspberrypi systemd[1]: weewx.service: Failed with result 'exit-code'. Jun 7 04:41:25 raspberrypi systemd[1]: weewx.service: Consumed 3.927s CPU time.

themoosman commented 4 months ago

This seems like a bug in weectl station reconfigure. It seems to be rendering an invalid weewx.conf.

mjm455 commented 4 months ago

I posted this error on the weewx github page and I received this information: https://github.com/weewx/weewx/issues/963#issuecomment-2156244439

themoosman commented 4 months ago

But a base weewx install does not work for you. The last log you posted has nothing to do with this extension.

themoosman commented 4 months ago

I updated the file in a branch. Feel free to download it and drop it in your install.
https://github.com/themoosman/weewx-ambientweatherapi-json/blob/feature/32/bin/user/ambientweatherapi.py

tkeffer commented 4 months ago

Karl,

The problem is that you have written your extension as a driver, but you are trying to install it as a WeeWX service. In particular, you are including it in option restful_services, which will cause it to be loaded as a service. See line 17 of the installer.

Pay no attention to my comment about how you wrote loader(). What you did is fine! I suspect that if you just remove line 17 in install.py, it will work.

I would also suggest adopting the WeeWX logger.

themoosman commented 4 months ago

@mjm455 I just pushed v0.0.12 with Tom's suggestion. Can you see if that fixes your issue? I did some tests in my environment, and it works just fine.

themoosman commented 4 months ago

@tkeffer I've been interested in implementing WeeWX logging for some time now. Do you have any example code available for reference?

mjm455 commented 4 months ago

Thanks for pushing out a new version. I ran the following commands but I'm still getting an error:

sudo -H pip3 install -r requirements.txt cd .. ls -al sudo weectl extension install ./weewx-ambientweatherapi-json-0.0.12.zip cd /etc/weewx/ vi weewx.conf weectl station reconfigure sudo systemctl start weewx sudo systemctl status weewx

When I did the reconfigure, I picked ambientweatherapi.

Attached is the log file weewx_error_20240617.log

themoosman commented 4 months ago

@mjm455 Can you run weectl debug --output=/var/tmp/weewx.txt, sanitize, then post the output?

tkeffer commented 4 months ago

@mjm455 I suspect you will have to manually edit weewx.conf. Option restful_services (down near the bottom). Remove the reference to user.ambientweatherapi.AmbientWeatherAPI.

@themoosman See the wiki article WeeWX v4 and logging for information on how to implement logging. In particular, the section Developers.

themoosman commented 4 months ago

That was my thought as well. In the file you provided on the other issue, the second to last line in the file had a bad reference.

restful_services = weewx.restx.StdStationRegistry, weewx.restx.StdWunderground, weewx.restx.StdPWSweather, weewx.restx.StdCWOP, weewx.restx.StdWOW, weewx.restx.StdAWEKAS, user.ambientweatherapi.AmbientWeatherAPI

mjm455 commented 4 months ago

I removed that reference at the end of the conf file and the service is now running. However it did give me a few errors in the journalctl stating:

Jun 18 02:12:07 raspberrypi weewxd[8351]: INFO weewx.engine: Starting main packet loop. Jun 18 02:12:10 raspberrypi weewxd[8351]: ERROR root: AmbientAPI get_devices() returned empty dict Jun 18 02:12:10 raspberrypi weewxd.py[8351]: ambientweatherapi driver encountered an error. Jun 18 02:12:10 raspberrypi weewxd[8351]: ERROR root: ambientweatherapi driver encountered an error. Jun 18 02:12:10 raspberrypi weewxd.py[8351]: Error caught was: AmbientAPI get_devices() returned empty dict Jun 18 02:12:10 raspberrypi weewxd[8351]: ERROR root: Error caught was: AmbientAPI get_devices() returned empty dict Jun 18 02:12:10 raspberrypi weewxd.py[8351]: ambientweatherapi driver had an error sending data to weewx. Jun 18 02:12:10 raspberrypi weewxd[8351]: ERROR root: ambientweatherapi driver had an error sending data to weewx. Jun 18 02:12:10 raspberrypi weewxd.py[8351]: Error caught was: Previous error occured, skipping packet build. Jun 18 02:12:10 raspberrypi weewxd[8351]: ERROR root: Error caught was: Previous error occured, skipping packet build.

Do you still need me to run the debug?

themoosman commented 4 months ago

Great. Error caught was: AmbientAPI get_devices() returned empty dict means the API call returned no data. To test your key, go here (https://ambientweather.docs.apiary.io/#reference/0/devices/list-user's-devices?console=1) plug in your keys and see if you get any data back.

mjm455 commented 4 months ago

One issue I had was that my keys were backwards. Doh. I used that link you sent and it is showing all of the correct information.

Being new to weewx, I wasn't sure where to start or access my data so I tried running some reports but the journalctl is still showing similar errors with:

Jun 18 03:52:11 raspberrypi weewxd[8446]: INFO weewx.manager: Added record 2024-06-18 03:45:00 BST (1718678700) to database 'weewx.sdb' Jun 18 03:52:12 raspberrypi weewxd[8446]: INFO weewx.manager: Added record 2024-06-18 03:45:00 BST (1718678700) to daily summary in 'weewx.sdb' Jun 18 03:52:25 raspberrypi weewxd[8446]: INFO weewx.cheetahgenerator: Generated 8 files for report SeasonsReport in 13.15 seconds Jun 18 03:52:30 raspberrypi weewxd[8446]: INFO weewx.imagegenerator: Generated 13 images for report SeasonsReport in 4.60 seconds Jun 18 03:52:30 raspberrypi weewxd[8446]: INFO weewx.reportengine: Copied 0 files to /var/www/html/weewx Jun 18 03:53:56 raspberrypi weewxd[8446]: ERROR root: AmbientAPI get_devices() returned empty dict Jun 18 03:53:56 raspberrypi weewxd.py[8446]: ambientweatherapi driver encountered an error. Jun 18 03:53:56 raspberrypi weewxd[8446]: ERROR root: ambientweatherapi driver encountered an error. Jun 18 03:53:56 raspberrypi weewxd.py[8446]: Error caught was: AmbientAPI get_devices() returned empty dict Jun 18 03:53:56 raspberrypi weewxd[8446]: ERROR root: Error caught was: AmbientAPI get_devices() returned empty dict Jun 18 03:53:56 raspberrypi weewxd.py[8446]: ambientweatherapi driver had an error sending data to weewx. Jun 18 03:53:56 raspberrypi weewxd[8446]: ERROR root: ambientweatherapi driver had an error sending data to weewx. Jun 18 03:53:56 raspberrypi weewxd.py[8446]: Error caught was: Previous error occured, skipping packet build. Jun 18 03:53:56 raspberrypi weewxd[8446]: ERROR root: Error caught was: Previous error occured, skipping packet build.

themoosman commented 4 months ago

I still see ERROR root: AmbientAPI get_devices() returned empty dict in the logs, so it's not pulling data from the API. So either the keys are wrong or you've hit a rate limit.

mjm455 commented 4 months ago

I think I fixed the issue. I had never changed the following line:

api_url = https://api.ambientweather.net/v1

So I edited that to match the link that you sent above. I'm not seeing any errors when I run status for weewx.

What other ways can I test my database or view my data?

Thanks again for all of your dedicated help and especially for creating this api.

themoosman commented 4 months ago

There should be a default report on port 80 or 8080, I don't remember which.

themoosman commented 4 months ago

FWIW, I'll be releasing 0.0.14 tonight, which will enable debug messages from the Ambient API.

mjm455 commented 4 months ago

I was able to get the website working. Apparently apache2 was never installed. Looks great but I definitely need to do the following: 1) change the skin and figure out how to view better graphs 2) see if I can import the past years data from ambient weather or even more from wunderground

I'll have to check out the latest version sometime soon. The weewx is working but journalctl is still showing some errors:

Jun 19 02:25:08 raspberrypi weewxd[8557]: INFO weewx.manager: Added record 2024-06-19 02:20:00 BST (1718760000) to daily summary in 'weewx.sdb' Jun 19 02:25:30 raspberrypi weewxd[8557]: INFO weewx.cheetahgenerator: Generated 8 files for report SeasonsReport in 21.27 seconds Jun 19 02:25:42 raspberrypi weewxd[8557]: INFO weewx.imagegenerator: Generated 13 images for report SeasonsReport in 11.97 seconds Jun 19 02:25:42 raspberrypi weewxd[8557]: INFO weewx.reportengine: Copied 0 files to /var/www/html/weewx Jun 19 02:26:52 raspberrypi weewxd[8557]: ERROR root: AmbientAPI get_devices() returned empty dict Jun 19 02:26:52 raspberrypi weewxd.py[8557]: ambientweatherapi driver encountered an error. Jun 19 02:26:52 raspberrypi weewxd[8557]: ERROR root: ambientweatherapi driver encountered an error. Jun 19 02:26:52 raspberrypi weewxd.py[8557]: Error caught was: AmbientAPI get_devices() returned empty dict Jun 19 02:26:52 raspberrypi weewxd[8557]: ERROR root: Error caught was: AmbientAPI get_devices() returned empty dict Jun 19 02:26:52 raspberrypi weewxd.py[8557]: ambientweatherapi driver had an error sending data to weewx. Jun 19 02:26:52 raspberrypi weewxd[8557]: ERROR root: ambientweatherapi driver had an error sending data to weewx. Jun 19 02:26:52 raspberrypi weewxd.py[8557]: Error caught was: Previous error occured, skipping packet build. Jun 19 02:26:52 raspberrypi weewxd[8557]: ERROR root: Error caught was: Previous error occured, skipping packet build. Jun 19 02:29:36 raspberrypi weewxd[8557]: ERROR root: AmbientAPI get_devices() returned empty dict Jun 19 02:29:36 raspberrypi weewxd.py[8557]: ambientweatherapi driver encountered an error. Jun 19 02:29:36 raspberrypi weewxd[8557]: ERROR root: ambientweatherapi driver encountered an error. Jun 19 02:29:36 raspberrypi weewxd.py[8557]: Error caught was: AmbientAPI get_devices() returned empty dict Jun 19 02:29:36 raspberrypi weewxd[8557]: ERROR root: Error caught was: AmbientAPI get_devices() returned empty dict Jun 19 02:29:36 raspberrypi weewxd.py[8557]: ambientweatherapi driver had an error sending data to weewx. Jun 19 02:29:36 raspberrypi weewxd[8557]: ERROR root: ambientweatherapi driver had an error sending data to weewx. Jun 19 02:29:36 raspberrypi weewxd.py[8557]: Error caught was: Previous error occured, skipping packet build. Jun 19 02:29:36 raspberrypi weewxd[8557]: ERROR root: Error caught was: Previous error occured, skipping packet build.

themoosman commented 4 months ago

I still see some ambient api errors. I just released v0.0.14, which allows you to set aw_debug = 1. This will print logs messages from the AW API to help debug why you see those errors.

mjm455 commented 4 months ago

I set the debug to 1 and everything is looking really good now. This is the only slight issue that I'm seeing:

un 18 23:17:06 raspberrypi weewxd[1106]: INFO user.ambientweatherapi: Weewx value: 'soilMoist5' not found in AW JSON packet. Jun 18 23:17:06 raspberrypi weewxd[1106]: INFO user.ambientweatherapi: Weewx value: 'soilMoist6' not found in AW JSON packet. Jun 18 23:17:06 raspberrypi weewxd[1106]: INFO user.ambientweatherapi: Weewx value: 'soilMoist7' not found in AW JSON packet. Jun 18 23:17:06 raspberrypi weewxd[1106]: INFO user.ambientweatherapi: Weewx value: 'soilMoist8' not found in AW JSON packet. Jun 18 23:17:06 raspberrypi weewxd[1106]: INFO user.ambientweatherapi: Weewx value: 'soilTemp1' not found in AW JSON packet. Jun 18 23:17:06 raspberrypi weewxd[1106]: INFO user.ambientweatherapi: Weewx value: 'soilTemp2' not found in AW JSON packet. Jun 18 23:17:06 raspberrypi weewxd[1106]: INFO user.ambientweatherapi: Weewx value: 'soilTemp3' not found in AW JSON packet. Jun 18 23:17:06 raspberrypi weewxd[1106]: INFO user.ambientweatherapi: Weewx value: 'soilTemp4' not found in AW JSON packet. Jun 18 23:17:06 raspberrypi weewxd[1106]: INFO user.ambientweatherapi: loopPacket Accepted Jun 18 23:17:09 raspberrypi weewxd[1106]: ERROR weewx.restx: StationRegistry: Failed to publish record 2024-06-18 23:15:00 EDT (1718766900): HTTP Error 429: TOO MANY REQUESTS

and now I'm also seeing this:

Jun 18 23:35:39 raspberrypi weewxd[1106]: INFO user.ambientweatherapi: Weewx value: 'soilTemp4' not found in AW JSON packet. Jun 18 23:35:39 raspberrypi weewxd[1106]: INFO user.ambientweatherapi: loopPacket Accepted Jun 18 23:36:42 raspberrypi weewxd[1106]: INFO root: TARGET URL: https://api.ambientweather.net/v1/devices Jun 18 23:36:42 raspberrypi weewxd[1106]: INFO root: PARAMS: Jun 18 23:36:42 raspberrypi weewxd[1106]: INFO root: {'applicationKey': '[secure]', 'apiKey': '[secure]'} Jun 18 23:38:22 raspberrypi weewxd[1106]: INFO root: RESPONSE: Jun 18 23:38:22 raspberrypi weewxd[1106]: INFO root: <Response [524]> Jun 18 23:38:22 raspberrypi weewxd[1106]: INFO root: DEVICES: Jun 18 23:38:22 raspberrypi weewxd[1106]: INFO root: {} Jun 18 23:38:22 raspberrypi weewxd[1106]: INFO root: DEVICE INSTANCE LIST: Jun 18 23:38:22 raspberrypi weewxd[1106]: INFO root: [] Jun 18 23:38:22 raspberrypi weewxd[1106]: ERROR user.ambientweatherapi: AmbientAPI get_devices() returned empty dict Jun 18 23:38:22 raspberrypi weewxd.py[1106]: ambientweatherapi driver encountered an error. Jun 18 23:38:22 raspberrypi weewxd[1106]: ERROR user.ambientweatherapi: ambientweatherapi driver encountered an error. Jun 18 23:38:22 raspberrypi weewxd.py[1106]: Error caught was: AmbientAPI get_devices() returned empty dict Jun 18 23:38:22 raspberrypi weewxd[1106]: ERROR user.ambientweatherapi: Error caught was: AmbientAPI get_devices() returned empty dict Jun 18 23:38:22 raspberrypi weewxd.py[1106]: ambientweatherapi driver had an error sending data to weewx. Jun 18 23:38:22 raspberrypi weewxd[1106]: ERROR user.ambientweatherapi: ambientweatherapi driver had an error sending data to weewx. Jun 18 23:38:22 raspberrypi weewxd.py[1106]: Error caught was: Previous error occured, skipping packet build. Jun 18 23:38:22 raspberrypi weewxd[1106]: ERROR user.ambientweatherapi: Error caught was: Previous error occured, skipping packet build.

themoosman commented 4 months ago
themoosman commented 4 months ago

Closing this issue. If you have any additional problems, please open a new issue.