poblabs / weewx-belchertown

A clean and modern weewx skin with real time streaming updates, forecast data and interactive charts. View it in action at BelchertownWeather.com
https://belchertownweather.com
GNU General Public License v3.0
206 stars 109 forks source link

error after master update #540

Closed fvirgola80 closed 3 years ago

fvirgola80 commented 3 years ago

Please don't delete these questions! They are asked almost with every issue - answering them as below saves us time from asking them!

First step Try to debug the skin yourself. If you can't figure it out, please include the debug information (text, screenshots, etc.). See this guide on debugging the skin. https://github.com/poblabs/weewx-belchertown#how-to-use-debug

Describe the bug A clear and concise description of what the bug is. I entered the master version to get information on air quality and wind type. When I do the wee_report I have this error thanks

sudo ./wee_reports Using configuration file /home/weewx/weewx.conf Generating for all time Traceback (most recent call last): File "/home/weewx/bin/weewx/reportengine.py", line 204, in run obj.start() File "/home/weewx/bin/weewx/reportengine.py", line 300, in start self.run() File "/home/weewx/bin/user/belchertown.py", line 2658, in run name + " (" + unit_label.strip().encode("utf-8") + ")" UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 0: ordinal not in range(128)

Link to your website (IMPORTANT) www.meteocivitavecchia.it

Version of the skin you're using 1.2

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Device Information (please complete the following information):

Additional context Add any other context about the problem here. Maybe a potential fix?

HELP WANTED If you have a fix for this, please submit a pull request against the development branch!

uajqq commented 3 years ago

Are you running Python 2 or 3?

poblabs commented 3 years ago

Are you running Python 2 or 3?

I'm assuming this is from the code cleanup PR. Should a "hack" be put in place for backwards compat with Python 2?

fvirgola80 commented 3 years ago

Python 2

fvirgola80 commented 3 years ago

should i update python3?

fvirgola80 commented 3 years ago

currently on pi I have the 2.7.1 how do I update to 3?

uajqq commented 3 years ago

I'm assuming this is from the code cleanup PR. Should a "hack" be put in place for backwards compat with Python 2?

Yeah, looks like he's having trouble with what was supposed to be the hack. I'll look at it, sorry

How do I update to 3?

Easier said than done unfortunately--I recommend using pyenv or something similar so you can switch between versions at will. Google if you're brave, in the meantime I'll see if I can fix the bug (it should work with Python 2)

fvirgola80 commented 3 years ago

Thank you very much. I look forward to seeing you

uajqq commented 3 years ago

Just opened #541, see if that makes a difference. It works for me on Python2 but difficult to test in every locale.

poblabs commented 3 years ago

I've merged #541

fvirgola80 commented 3 years ago

I tried the change #541 made by you but it still gives me an error

sudo ./wee_reports Using configuration file /home/weewx/weewx.conf Generating for all time Traceback (most recent call last): File "/home/weewx/bin/weewx/reportengine.py", line 204, in run obj.start() File "/home/weewx/bin/weewx/reportengine.py", line 300, in start self.run() File "/home/weewx/bin/user/belchertown.py", line 2658, in run name + " (" + unit_label.strip().decode("utf-8") + ")" UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 7: ordinal not in range(128)

uajqq commented 3 years ago

Can you post your weewx.conf so I can see the locale/language info?

fvirgola80 commented 3 years ago

my language is it on the raspberry

poblabs commented 3 years ago

According to their site's weewx_data.json, they have this for locale

    "serverLocale": "it_IT",
    "serverLocaleJS": "it-IT",
    "localeEncoding": "UTF-8",
fvirgola80 commented 3 years ago

WEEWX CONFIGURATION FILE

#

Copyright (c) 2009-2015 Tom Keffer tkeffer@gmail.com

See the file LICENSE.txt for your rights.

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

This section is for general configuration information.

Set to 1 for extra debug info, otherwise comment it out or set to zero

debug = 1

Root directory of the weewx data file hierarchy for this station

WEEWX_ROOT = /home/weewx

How long to wait before timing out a socket (FTP, HTTP) connection

socket_timeout = 200

Do not modify this. It is used when installing and updating weewx.

version = 3.9.2

loop_on_init = 1

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

This section is for information about the station.

[Station]

# Description of the station location
location = 

# Latitude and longitude in decimal degrees 
latitude = 
longitude = 

# Altitude of the station, with unit it is in. This is downloaded from
# from the station if the hardware supports it.
altitude = 30, meter    # Choose 'foot' or 'meter' for unit

# Set to type of station hardware. There must be a corresponding stanza
# in this file with a 'driver' parameter indicating the driver to be used.
station_type = Vantage

# If you have a website, you may specify an URL
station_url = https://meteocivitavecchia.it

# The start of the rain year (1=January; 10=October, etc.). This is
# downloaded from the station if the hardware supports it.
rain_year_start = 1

# Start of week (0=Monday, 6=Sunday)
week_start = 0

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

[Vantage]

This section is for the Davis Vantage series of weather stations.

# Connection type: serial or ethernet 
#  serial (the classic VantagePro)
#  ethernet (the WeatherLinkIP or Serial-Ethernet bridge)
type = serial

# If the connection type is serial, a port must be specified:
#   Debian, Ubuntu, Redhat, Fedora, and SuSE:
#     /dev/ttyUSB0 is a common USB port name
#     /dev/ttyS0   is a common serial port name
#   BSD:
#     /dev/cuaU0   is a common serial port name
port = /dev/ttyUSB0

# If the connection type is ethernet, an IP Address/hostname is required:
host = 1.2.3.4

######################################################
# The rest of this section rarely needs any attention. 
# You can safely leave it "as is."
######################################################

# Serial baud rate (usually 19200)
baudrate = 19200

# TCP port (when using the WeatherLinkIP)
tcp_port = 22222

# TCP send delay (when using the WeatherLinkIP):
tcp_send_delay = 0.5

# The id of your ISS station (usually 1). If you use a wind meter connected
# to a anemometer transmitter kit, use its id
iss_id = 8

# How long to wait for a response from the station before giving up (in
# seconds; must be greater than 2)
timeout = 4

# How long to wait before trying again (in seconds)
wait_before_retry = 1.2

# How many times to try before giving up:
max_tries = 4

# Vantage model Type: 1 = Vantage Pro; 2 = Vantage Pro2
model_type = 2

# The driver to use:
driver = weewx.drivers.vantage

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

This section is for uploading data to Internet sites

[StdRESTful]

[[StationRegistry]]
    # To register this weather station with weewx, set this to true
    register_this_station = true

[[AWEKAS]]
    # This section is for configuring posts to AWEKAS.

    # If you wish to do this, set the option 'enable' to true,
    # and specify a username and password.
    # To guard against parsing errors, put the password in quotes.
    enable = 
    username = 
    password = 

[[CWOP]]
    # This section is for configuring posts to CWOP.

    # If you wish to do this, set the option 'enable' to true,
    # and specify the station ID (e.g., CW1234).
    enable = 
    station = 

# If this is an APRS (radio amateur) station, uncomment
# the following and replace with a passcode (e.g., 12345).
#passcode = replace_me (APRS stations only)

[[WOW]]
    # This section is for configuring posts to PWSweather.com.

    # If you wish to do this, set the option 'enable' to true,
    # and specify a station and password.
    # To guard against parsing errors, put the password in quotes.
    enable = 
    station = 
    password =

[[PWSweather]]
    # This section is for configuring posts to WOW.

    # If you wish to do this, set the option 'enable' to true,
    # and specify a station and password.
    # To guard against parsing errors, put the password in quotes.
    enable = 
    station = 
    password = 

[[Wunderground]]
    # This section is for configuring posts to the Weather Underground.

    # If you wish to do this, set the option 'enable' to true,
    # and specify a station (e.g., 'KORHOODR3') and password.
    # To guard against parsing errors, put the password in quotes.
    enable = 
    station = 
    password = 
    #password =       

    # Set the following to True to have weewx use the WU "Rapidfire"
    # protocol. Not all hardware can support it. See the User's Guide.
    rapidfire = False

[[WeatherCloud]]
    id = 
    key = 

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

This section specifies what reports, using which skins, to generate.

[StdReport]

# Where the skins reside, relative to WEEWX_ROOT
SKIN_ROOT = skins

# Where the generated reports should go, relative to WEEWX_ROOT
HTML_ROOT = public_html

# The database binding indicates which data should be used in reports.
data_binding = wx_binding

# Each of the following subsections defines a report that will be run.

[[SteelSeries]]
    skin = ss
    HTML_ROOT = public_html/ss
    [[[Units]]]
        [[[[Groups]]]]
            group_temperature = degree_C
            group_altitude = meter
            group_pressure = mbar
            group_rain = mm
            group_rainRate = mm_per_hour
            group_speed = km_per_hour

[[Defaults]]
    [[[Units]]]
        [[[[Groups]]]]
            group_altitude = meter
            group_degree_day = degree_C_day
            group_pressure = mbar
            group_rain = mm
            group_rainrate = mm_per_hour
            group_speed = km_per_hour
            group_speed2 = km_per_hour2
            group_temperature = degree_C

[[StandardReport]]
    # See the customizing guide to change the units, plot types and line
    # colors, modify the fonts, display additional sensor data, and other
    # customizations. Many of those changes can be made here by overriding
    # parameters, or by modifying templates within the skin itself.

    # The StandardReport uses the 'Standard' skin, which contains the
    # images, templates and plots for the report.
    skin = Standard
    [[[Units]]]
        [[[[Groups]]]]
            group_altitude = meter
            group_speed2 = km_per_hour2
            group_pressure = mbar
            group_rain = mm
            group_rainrate = mm_per_hour
            group_temperature = degree_C
            group_degree_day = degree_C_day
            group_speed = km_per_hour
[[Inigo]]
    HTML_ROOT = public_html/
    skin = Inigo
    [[[Units]]]
        [[[[Groups]]]]
            group_altitude = meter
            group_speed2 = km_per_hour2
            group_pressure = mbar
            group_rain = mm
            group_rainrate = mm_per_hour
            group_degree_day = degree_C_day
            group_temperature = degree_C
            group_speed = km_per_hour
[[Belchertown]]
    HTML_ROOT = public_html/belchertown
    skin = Belchertown
[[[Labels]]]
    [[[[Generic]]]]
     beaufort0 = Calma
     beaufort1 = Bava di vento
     beaufort2 = Brezza leggera
             beaufort3 = Brezza tesa 
     beaufort4 = Vento moderato
     beaufort5 = Vento teso
     beaufort6 = Vento fresco
     beaufort7 = Vento forte
     beaufort8 = Burrasca
     beaufort9 = Burrasca forte
             beaufort10 = Tempesta
             beaufort11 = Fortunale
     beaufort12 = Uragano

[[FTP]]
    # FTP'ing the results to a webserver is treated as just another report,
    # albeit one with an unusual report generator!
    skin = Ftp

    # If you wish to use FTP, uncomment and fill out the next four lines.
    # Use quotes around passwords to guard against parsing errors.
    user =
    password = 
    server = 
    path = 

    # Set to True for an FTP over TLS (FTPS) connection. Not all servers
    # support this.
    secure_ftp = False

    # To upload files from something other than what HTML_ROOT is set
    # to above, specify a different HTML_ROOT here.
    #HTML_ROOT = public_html

    # Most FTP servers use port 21
    port = 21

    # Set to 1 to use passive mode, zero for active mode
    passive = 1

[[RSYNC]]
    # rsync'ing to a webserver is treated as just another report
    skin = Rsync

    # If you wish to use rsync, you must configure passwordless ssh using
    # public/private key authentication from the user account that weewx
    # runs as to the user account on the remote machine where the files
    # will be copied.
    #
    # The server, user, and path determine where files will be sent.
    # The server is the server name, such as www.threefools.org
    # The user is the username, such as weewx
    # The path is the destination directory, such as /var/www/html/weather
    # Be sure that the user has write permissions on the destination!
    #server = replace_me
    #user = replace_me
    #path = replace_me

    # Rsync can be configured to remove files from the remote server if
    # they don't exist under HTML_ROOT locally. USE WITH CAUTION: if you
    # make a mistake in the remote path, you could could unintentionally
    # cause unrelated files to be deleted. Set to 1 to enable remote file
    # deletion, zero to allow files to accumulate remotely.
    delete = 0

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

This service acts as a filter, converting the unit system coming from

the hardware to a unit system in the database.

[StdConvert]

# The target_unit affects only the unit system in the database. Once
# chosen it cannot be changed without converting the entire database.
# Modification of target_unit after starting weewx will result in
# corrupt data - the database will contain a mix of US and METRIC data.
#
# The value of target_unit does not affect the unit system for
# reporting - reports can display US, Metric, or any combination of units.
#
# In most cases, target_unit should be left as the default: US
#
# In particular, those migrating from a standard wview installation
# should use US since that is what the wview database contains.

# DO NOT MODIFY THIS VALUE UNLESS YOU KNOW WHAT YOU ARE DOING!
target_unit = METRIC    # Options are 'US', 'METRICWX', or 'METRIC'

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

This section can adjust data using calibration expressions.

[StdCalibrate]

[[Corrections]]
    # For each type, an arbitrary calibration expression can be given. 
    # It should be in the units defined in the StdConvert section.
    # Example:
    foo = foo + 0.2

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

This section is for quality control checks. If units are not specified,

values must be in the units defined in the StdConvert section.

[StdQC]

[[MinMax]]
    barometer = 26, 32.5, inHg
    outTemp = -40, 120, degree_F
    inTemp = 10, 120, degree_F
    outHumidity = 0, 100
    inHumidity = 0, 100
    windSpeed = 0, 120, mile_per_hour
    pressure = 24, 34.5, inHg

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

This section controls the origin of derived values.

[StdWXCalculate]

[[Calculations]]
    # Derived quantities are calculated by this service. Possible values are:
    #  hardware        - use the value provided by hardware
    #  software        - use the value calculated by weewx
    #  prefer_hardware - use value provide by hardware if available,
    #                      otherwise use value calculated by weewx

    pressure = prefer_hardware
    barometer = prefer_hardware
    altimeter = prefer_hardware
    windchill = prefer_hardware
    heatindex = prefer_hardware
    dewpoint = prefer_hardware
    inDewpoint = prefer_hardware
    rainRate = prefer_hardware
beaufort = prefer_hardware

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

For hardware that supports it, this section controls how often the

onboard clock gets updated.

[StdTimeSynch]

# How often to check the weather station clock for drift (in seconds)
clock_check = 14400

# How much it can drift before we will correct it (in seconds)
max_drift = 5

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

This section is for configuring the archive service.

[StdArchive]

# If the station hardware supports data logging then the archive interval
# will be downloaded from the station. Otherwise, specify it (in seconds).
archive_interval = 300

# If possible, new archive records are downloaded from the station
# hardware. If the hardware does not support this, then new archive
# records will be generated in software.
# Set the following to "software" to force software record generation.
record_generation = hardware

# Whether to include LOOP data in hi/low statistics
loop_hilo = True

# The data binding used to save archive records
data_binding = wx_binding

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

This section binds a data store to a database.

[DataBindings]

[[wx_binding]]
    # The database must match one of the sections in [Databases].
    # This is likely to be the only option you would want to change.
    database = archive_sqlite
    # The name of the table within the database
    table_name = archive
    # The manager handles aggregation of data for historical summaries
    manager = weewx.wxmanager.WXDaySummaryManager
    # The schema defines the structure of the database.
    # It is *only* used when the database is created.
    schema = schemas.wview.schema

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

This section defines various databases.

[Databases]

# A SQLite database is simply a single file
[[archive_sqlite]]
    database_type = SQLite
    database_name = weewx.sdb

# MySQL
[[archive_mysql]]
    database_type = MySQL
    database_name = weewx

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

This section defines defaults for the different types of databases.

[DatabaseTypes]

# Defaults for SQLite databases
[[SQLite]]
    driver = weedb.sqlite
    # Directory in which the database files are located
    SQLITE_ROOT = %(WEEWX_ROOT)s/archive

# Defaults for MySQL databases
[[MySQL]]
    driver = weedb.mysql
    # The host where the database is located
    host = localhost
    # The user name for logging in to the host
    user = weewx
    # The password for the user name (quotes guard against parsing errors)
    password = weewx

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

This section configures the internal weewx engine.

[Engine]

[[Services]]
    # This section specifies the services that should be run. They are
    # grouped by type, and the order of services within each group
    # determines the order in which the services will be run.
    prep_services = weewx.engine.StdTimeSynch
    data_services = ,
    process_services = weewx.engine.StdConvert, weewx.engine.StdCalibrate, weewx.engine.StdQC, weewx.wxservices.StdWXCalculate
    archive_services = weewx.engine.StdArchive
    restful_services = weewx.restx.StdStationRegistry, weewx.restx.StdWunderground, weewx.restx.StdPWSweather, weewx.restx.StdCWOP, weewx.restx.StdWOW, weewx.restx.StdAWEKAS, user.wcloud.WeatherCloud
    report_services = user.rtgd.RealtimeGaugeData, weewx.engine.StdPrint, weewx.engine.StdReport

[RealtimeGaugeData] date_format = %Y.%m.%d %H:%M scroller_source = text rtgd_path = /home/weewx/public_html/ss remote_server_url = https://www.meteocivitavecchia.it/weewx/ss/post_gauge-data.php timeout = 1 response_text = success [[Groups]] group_altitude = meter group_pressure = hPa group_rain = mm group_speed = km_per_hour group_temperature = degree_C [[StringFormats]] inch_per_hour = %.2f mile_per_hour = %.1f degree_compass = %.0f km_per_hour = %.1f inHg = %.2f mm = %.1f meter_per_second = %.1f percent = %.0f km = %.1f uv_index = %.1f inch = %.2f degree_F = %.1f meter = %.0f degree_C = %.1f mile = %.1f foot = %.0f hPa = %.1f mbar = %.1f watt_per_meter_squared = %.0f mm_per_hour = %.1f [[DS]] api_key = xxxxxxxxxxxxxxxx

Specify settings to be used for user specified text block

[[Text]]
    # user specified text to populate the 'forecast' field
    text = Prossimo aggiornamento in
uajqq commented 3 years ago

Even setting my locale to Italian and using Python2.7, I can't replicate the error, so I'm not quite sure. However, I note that I can remove most of the Python 2/3 code blocks and it still seems to run fine.

If I'm understanding this correctly, the line that's throwing the error right now gets its string from the accumulateLeaves method. That's a weewx method and therefore should be Python2/3 compatible already. The only place in the code where Unicode should need to be specified directly is when files are written or read, since Python 2 demands that Unicode be specified explicitly. Therefore, removing any .decode() or .encode() that's not related to a file read/write should still work, right @poblabs?

I opened a pull request #542 with those changes but again, since I can't replicate the bug in the first place, I'm not sure if I fixed it or introduced more bugs. @fvirgola80, do you have the ability to check out the unicode_fix branch from my fork and install that to test before it gets merged into the master branch?

poblabs commented 3 years ago

@uajqq #542 looks like it removes all the hacks - was that intentional?

@fvirgola80 Just to confirm - you re-downloaded the master branch and restarted weewx after we merged the latest "fix"?

uajqq commented 3 years ago

@uajqq #542 looks like it removes all the hacks - was that intentional?

Yeah--on my system, everything runs fine on Python2 even without the hacks. If I understand correctly, since those strings come from a weewx method, they should already be Python2 compatible, right? I just made Unicode encoding explicit during file read/write steps, which is unnecessary for Python3 but should be backwards compatible with Python2.

@fvirgola80 Just to confirm - you re-downloaded the master branch and restarted weewx after we merged the latest "fix"?

I can tell they did--their traceback switched from "encode" to "decode," which was supposed to be the fix.

fvirgola80 commented 3 years ago

i can't make all the changes i could have the file that i pass it directly?

fvirgola80 commented 3 years ago

fvirgola80@gmail.com

fvirgola80 commented 3 years ago

or if you put it in the master I insert it now

michaelundwd commented 3 years ago

Just another thought. If you look at the debug log or forecast.json for @fvirgola80 websitehttps://www.meteocivitavecchia.it/weewx/belchertown/json/forecast.json, you will see that there is no aqi data as aeris is returning an error (no valid data), hence the unknown on the home page. Is this cause or effect?

fvirgola80 commented 3 years ago

Ok guys here we are, the wee_report did not give errors, the file can be inserted in the master, tomorrow I will try to update the weewx version to 4.3 and I will tell you. I don't understand why the belchertown pagian no longer hangs around, I have an automatic update every 5 minutes ... @michael I think it's a consequence

poblabs commented 3 years ago

@fvirgola80 to confirm - you restarted weewx too?

fvirgola80 commented 3 years ago

yes

fvirgola80 commented 3 years ago

however I notice that the website is no longer updated ... I also restarted raspberry

fvirgola80 commented 3 years ago

debug is open if you want to have a look

fvirgola80 commented 3 years ago

Now the site update is stopped at 17.50 today it does not update anymore ... I restarted weewx I restarted raspberry but nothing .... I don't know what to do ... all this despite the wee_report was successful

poblabs commented 3 years ago

What errors are in syslog?

ArendPWS commented 3 years ago

Now the site update is stopped at 17.50 today it does not update anymore ... I restarted weewx I restarted raspberry but nothing .... I don't know what to do ... all this despite the wee_report was successful

I think I know what's the solution to this specific issue. Need to do some more testing, but it looks like the:

    function autoRefreshPage() {
        window.location = window.location.href;
    }

in index.html.tmpl needs to be moved outside:

    ajaxweewx().then(function(weewx_data){ // Initial call to load from weewx (date, daily high, low, etc)

Will create a necessary PR.

uajqq commented 3 years ago

Now the site update is stopped at 17.50 today it does not update anymore ... I restarted weewx I restarted raspberry but nothing .... I don't know what to do ... all this despite the wee_report was successful

@fvirgola80 can you post any errors in your syslog? Usually this means something in belchertown isn’t working, but not crashing so badly that the entire weewx program stops working.

fvirgola80 commented 3 years ago

hello, how do I create or recover the syslog? if you go to www.meteocivitavecchia.it/live.php the sensors work .. i noticed that where i transmit data to the various platforms whu psweather etc. gives me the off-line weather station

fvirgola80 commented 3 years ago

I can give you access to the Raspberry via ngrok to let you check

fvirgola80 commented 3 years ago

i found the syslog

syslog.zip

fvirgola80 commented 3 years ago

I upgraded to weewx 4.3 I regenerated the wee_report report and here is the result .. I am also attaching the syslog .. could it be that I changed the language to the raspberry? now I re-entered the default one I think

sudo ./wee_reports Using configuration file /home/weewx/weewx.conf Generating for all time Traceback (most recent call last): File "/home/weewx/bin/weewx/reportengine.py", line 196, in run obj.start() File "/home/weewx/bin/weewx/reportengine.py", line 281, in start self.run() File "/home/weewx/bin/weewx/cheetahgenerator.py", line 149, in run ngen = self.generate(gen_dict[section_name], self.gen_ts) File "/home/weewx/bin/weewx/cheetahgenerator.py", line 219, in generate ngen += self.generate(section[subsection], gen_ts) File "/home/weewx/bin/weewx/cheetahgenerator.py", line 219, in generate ngen += self.generate(section[subsection], gen_ts) File "/home/weewx/bin/weewx/cheetahgenerator.py", line 308, in generate default_binding) File "/home/weewx/bin/weewx/cheetahgenerator.py", line 379, in _getSearchList searchList += obj.get_extension_list(timespan, db_lookup) File "/home/weewx/bin/user/belchertown.py", line 1905, in get_extension_list obs_output = getattr(current, obs) File "/home/weewx/bin/weewx/tags.py", line 506, in getattr vt = weewx.xtypes.get_scalar(obs_type, self.record, db_manager) File "/home/weewx/bin/weewx/xtypes.py", line 71, in get_scalar return xtype.get_scalar(obs_type, record, db_manager) File "/home/weewx/bin/weewx/wxxtypes.py", line 89, in getscalar return getattr(self, 'calc%s' % obs_type)(obs_type, record, db_manager) File "/home/weewx/bin/weewx/wxxtypes.py", line 127, in calc_cloudbase if 'outTemp' not in data or 'outHumidity' not in data: TypeError: argument of type 'NoneType' is not iterable Traceback (most recent call last): File "/home/weewx/bin/weewx/reportengine.py", line 196, in run obj.start() File "/home/weewx/bin/weewx/reportengine.py", line 281, in start self.run() File "/home/weewx/bin/user/belchertown.py", line 2631, in run yAxis_label = name + " (" + unit_label.strip() + ")" UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 7: ordinal not in range(128) syslog.zip

i have python2

fvirgola80 commented 3 years ago

Ok guys, I restarted the copy with the weewx version 3.9.2 I re-launched the wee_report and I had no problems with the last modification belchertown.py, then I ran the commands wee_ddevice --dump and wee_device --clear I restarted weewx is everything has started working again. I noticed two things the first one that does not auto update the web page every 5 minutes and the Snapshots of the meteorological records are not updated and for example today at 6.30 the maximum wind speed was 92 km / h but I still see 68 km / h this you can check from charts the same goes for the monthly ones ... while in the records section everything is correct, I would not like there to be a problem in the home page. in the last analysis AQI has no data it seems strange to me also because until yesterday morning it worked .. these are my considerations

fvirgola80 commented 3 years ago

Last analysis, i can't in any way view the cloudbase, i have weewx version 3.9.2 can it depend on that? I tried to update to 4.3 but from errors that I have attached on how can I do? Aires gives the information of the cloud base if somehow it could be integrated in the belchetown it would be fantastic .. I hope so

ArendPWS commented 3 years ago

Ok guys, I restarted the copy with the weewx version 3.9.2 I re-launched the wee_report and I had no problems with the last modification belchertown.py, then I ran the commands wee_ddevice --dump and wee_device --clear I restarted weewx is everything has started working again. I noticed two things the first one that does not auto update the web page every 5 minutes and the Snapshots of the meteorological records are not updated and for example today at 6.30 the maximum wind speed was 92 km / h but I still see 68 km / h this you can check from charts the same goes for the monthly ones ... while in the records section everything is correct, I would not like there to be a problem in the home page. in the last analysis AQI has no data it seems strange to me also because until yesterday morning it worked .. these are my considerations

@fvirgola80

The auto update should be fixed with my PR #544. @poblabs needs to merge.

fvirgola80 commented 3 years ago

I have replaced the file now

ok just tried it works perfectly

fvirgola80 commented 3 years ago

Good morning guys, as you can see from the images that entice you you will notice that the snapshots on the site are not updated to today but to yesterday and I have also noticed that in the graphs the total rainfall in January has a value while the daily and annual values ​​are different I also link the syssylog and debug to you. It is also noted in the month of January the values ​​are arrti the gust of wind is not 79 km / h but 91.

attached

debugsyslog.zip

Cattura

annual chart Cattura2

monthly chart Cattura1

fvirgola80 commented 3 years ago

sorry guys the graphs are correct😉 .... it's the snapshots that are wrong😔

fvirgola80 commented 3 years ago

I noticed that the min and max temperature did not change either, I think there is something strange in the index.html.tmpl file

code index.hml.tmpl

`ajaxweewx().then(function(weewx_data) { // This call will make sure json/weewx_data.json is loaded before anything else update_weewx_data(weewx_data); // Initial call to update (date, daily high, low, etc) belchertown_debug(weewx_data); // Make weewx_data.json available in debugging console

if $Extras.has_key("forecast_enabled") and $Extras.forecast_enabled == '1'

        // Load forecast
        ajaxforecast(); // Initial call to load forecast data like 8 day outlook, weather icon and observation text
        #end if

        #if $Extras.has_key("mqtt_websockets_enabled") and $Extras.mqtt_websockets_enabled == '0' and $Extras.has_key("webpage_autorefresh") and $Extras.webpage_autorefresh != '0'
        // Reload the page on an interval for updated data. This is for non-mqtt websocket websites
        setInterval('autoRefreshPage()', $Extras.webpage_autorefresh);
        #end if`

I entered this as proof

`ajaxweewx(); // Initial call to load from weewx (date, daily high, low, etc)

    #if $Extras.has_key("forecast_enabled") and $Extras.forecast_enabled == '1'
    // Load forecast
    ajaxforecast(); // Initial call to load forecast data like 8 day outlook, weather icon and observation text
    #end if`

actually they were recovered in correct values ​​in the min and max temperatures and the snapshots, obviously everything else does not work I just did a test to understand I re-inserted the original one now

ArendPWS commented 3 years ago

Why is your server locale showing en_US, as it should be it_IT right?

fvirgola80 commented 3 years ago

it_IT

ArendPWS commented 3 years ago

Can you show the output when you type "locale" in a terminal window?

fvirgola80 commented 3 years ago

locale LANG=it_IT LANGUAGE= LC_CTYPE="it_IT" LC_NUMERIC="it_IT" LC_TIME="it_IT" LC_COLLATE="it_IT" LC_MONETARY="it_IT" LC_MESSAGES="it_IT" LC_PAPER="it_IT" LC_NAME="it_IT" LC_ADDRESS="it_IT" LC_TELEPHONE="it_IT" LC_MEASUREMENT="it_IT" LC_IDENTIFICATION="it_IT" LC_ALL=

fvirgola80 commented 3 years ago

I have to do something?

ArendPWS commented 3 years ago

Trying to understand what is going on, just thinking out loud:

When I look at the syslog you posted this morning, as far as I can tell there are four reoccuring errors produced by the cheetahgenerator:

Jan 24 00:00:17 raspberrypi weewx[1264]: cheetahgenerator: Generate failed with exception '<type 'exceptions.UnicodeDecodeError'>'
Jan 24 00:00:17 raspberrypi weewx[1264]: cheetahgenerator: **** Ignoring template /home/weewx/skins/Standard/week.html.tmpl
Jan 24 00:00:17 raspberrypi weewx[1264]: cheetahgenerator: **** Reason: 'utf8' codec can't decode byte 0xec in position 15: unexpected end of data
Jan 24 00:00:17 raspberrypi weewx[1264]: ****  Traceback (most recent call last):
Jan 24 00:00:17 raspberrypi weewx[1264]: ****    File "/home/weewx/bin/weewx/cheetahgenerator.py", line 332, in generate
Jan 24 00:00:17 raspberrypi weewx[1264]: ****      fd.write(str(compiled_template))
Jan 24 00:00:17 raspberrypi weewx[1264]: ****    File "/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 1045, in __str__
Jan 24 00:00:17 raspberrypi weewx[1264]: ****      rc = getattr(self, mainMethName)()
Jan 24 00:00:17 raspberrypi weewx[1264]: ****    File "_home_weewx_skins_Standard_week_html_tmpl.py", line 814, in respond
Jan 24 00:00:17 raspberrypi weewx[1264]: ****    File "/home/weewx/bin/weewx/cheetahgenerator.py", line 600, in filter
Jan 24 00:00:17 raspberrypi weewx[1264]: ****      filtered = self.filter(str(val))
Jan 24 00:00:17 raspberrypi weewx[1264]: ****    File "/home/weewx/bin/weewx/cheetahgenerator.py", line 598, in filter
Jan 24 00:00:17 raspberrypi weewx[1264]: ****      filtered = val.decode('utf-8').encode('ascii', 'xmlcharrefreplace')
Jan 24 00:00:17 raspberrypi weewx[1264]: ****    File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
Jan 24 00:00:17 raspberrypi weewx[1264]: ****      return codecs.utf_8_decode(input, errors, True)
Jan 24 00:00:17 raspberrypi weewx[1264]: ****  UnicodeDecodeError: 'utf8' codec can't decode byte 0xec in position 15: unexpected end of data
Jan 24 00:00:17 raspberrypi weewx[1264]: cheetahgenerator: Generate failed with exception '<type 'exceptions.UnicodeDecodeError'>'
Jan 24 00:00:17 raspberrypi weewx[1264]: cheetahgenerator: **** Ignoring template /home/weewx/skins/Standard/smartphone/temp_outside.html.tmpl
Jan 24 00:00:17 raspberrypi weewx[1264]: cheetahgenerator: **** Reason: 'utf8' codec can't decode byte 0xec in position 14: unexpected end of data
Jan 24 00:00:17 raspberrypi weewx[1264]: ****  Traceback (most recent call last):
Jan 24 00:00:17 raspberrypi weewx[1264]: ****    File "/home/weewx/bin/weewx/cheetahgenerator.py", line 332, in generate
Jan 24 00:00:17 raspberrypi weewx[1264]: ****      fd.write(str(compiled_template))
Jan 24 00:00:17 raspberrypi weewx[1264]: ****    File "/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 1045, in __str__
Jan 24 00:00:17 raspberrypi weewx[1264]: ****      rc = getattr(self, mainMethName)()
Jan 24 00:00:17 raspberrypi weewx[1264]: ****    File "_home_weewx_skins_Standard_smartphone_temp_outside_html_tmpl.py", line 130, in respond
Jan 24 00:00:17 raspberrypi weewx[1264]: ****    File "/home/weewx/bin/weewx/cheetahgenerator.py", line 600, in filter
Jan 24 00:00:17 raspberrypi weewx[1264]: ****      filtered = self.filter(str(val))
Jan 24 00:00:17 raspberrypi weewx[1264]: ****    File "/home/weewx/bin/weewx/cheetahgenerator.py", line 598, in filter
Jan 24 00:00:17 raspberrypi weewx[1264]: ****      filtered = val.decode('utf-8').encode('ascii', 'xmlcharrefreplace')
Jan 24 00:00:17 raspberrypi weewx[1264]: ****    File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
Jan 24 00:00:17 raspberrypi weewx[1264]: ****      return codecs.utf_8_decode(input, errors, True)
Jan 24 00:00:17 raspberrypi weewx[1264]: ****  UnicodeDecodeError: 'utf8' codec can't decode byte 0xec in position 14: unexpected end of data
Jan 24 00:00:17 raspberrypi weewx[1264]: cheetahgenerator: Generate failed with exception '<type 'exceptions.UnicodeDecodeError'>'
Jan 24 00:00:17 raspberrypi weewx[1264]: cheetahgenerator: **** Ignoring template /home/weewx/skins/Standard/smartphone/barometer.html.tmpl
Jan 24 00:00:17 raspberrypi weewx[1264]: cheetahgenerator: **** Reason: 'utf8' codec can't decode byte 0xec in position 15: unexpected end of data
Jan 24 00:00:17 raspberrypi weewx[1264]: ****  Traceback (most recent call last):
Jan 24 00:00:17 raspberrypi weewx[1264]: ****    File "/home/weewx/bin/weewx/cheetahgenerator.py", line 332, in generate
Jan 24 00:00:17 raspberrypi weewx[1264]: ****      fd.write(str(compiled_template))
Jan 24 00:00:17 raspberrypi weewx[1264]: ****    File "/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 1045, in __str__
Jan 24 00:00:17 raspberrypi weewx[1264]: ****      rc = getattr(self, mainMethName)()
Jan 24 00:00:17 raspberrypi weewx[1264]: ****    File "_home_weewx_skins_Standard_smartphone_barometer_html_tmpl.py", line 138, in respond
Jan 24 00:00:17 raspberrypi weewx[1264]: ****    File "/home/weewx/bin/weewx/cheetahgenerator.py", line 600, in filter
Jan 24 00:00:17 raspberrypi weewx[1264]: ****      filtered = self.filter(str(val))
Jan 24 00:00:17 raspberrypi weewx[1264]: ****    File "/home/weewx/bin/weewx/cheetahgenerator.py", line 598, in filter
Jan 24 00:00:17 raspberrypi weewx[1264]: ****      filtered = val.decode('utf-8').encode('ascii', 'xmlcharrefreplace')
Jan 24 00:00:17 raspberrypi weewx[1264]: ****    File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
Jan 24 00:00:17 raspberrypi weewx[1264]: ****      return codecs.utf_8_decode(input, errors, True)
Jan 24 00:00:17 raspberrypi weewx[1264]: ****  UnicodeDecodeError: 'utf8' codec can't decode byte 0xec in position 15: unexpected end of data
Jan 24 00:00:17 raspberrypi weewx[1264]: cheetahgenerator: Generated 14 files for report StandardReport in 1.82 seconds
Jan 24 00:00:17 raspberrypi weewx[1264]: manager: Daily summary version is 2.0
Jan 24 00:00:17 raspberrypi weewx[1264]: restx: WeatherCloud: Published record 2021-01-24 00:00:00 CET (1611442800)
Jan 24 00:00:19 raspberrypi weewx[1264]: imagegenerator: Gap fraction 15.000 outside range 0 to 1. Ignored.
Jan 24 00:00:19 raspberrypi weewx[1264]: imagegenerator: Gap fraction 15.000 outside range 0 to 1. Ignored.
Jan 24 00:00:19 raspberrypi weewx[1264]: imagegenerator: Gap fraction 15.000 outside range 0 to 1. Ignored.
Jan 24 00:00:21 raspberrypi weewx[1264]: imagegenerator: Gap fraction 15.000 outside range 0 to 1. Ignored.
Jan 24 00:00:21 raspberrypi weewx[1264]: imagegenerator: Gap fraction 15.000 outside range 0 to 1. Ignored.
Jan 24 00:00:21 raspberrypi weewx[1264]: imagegenerator: Gap fraction 15.000 outside range 0 to 1. Ignored.
Jan 24 00:00:25 raspberrypi weewx[1264]: imagegenerator: Gap fraction 15.000 outside range 0 to 1. Ignored.
Jan 24 00:00:45 raspberrypi weewx[1264]: imagegenerator: Generated 63 images for StandardReport in 27.44 seconds
Jan 24 00:00:45 raspberrypi weewx[1264]: copygenerator: copied 0 files to /home/weewx/public_html
Jan 24 00:00:45 raspberrypi weewx[1264]: reportengine: Running report 'Inigo'
Jan 24 00:00:45 raspberrypi weewx[1264]: reportengine: Found configuration file /home/weewx/skins/Inigo/skin.conf for report 'Inigo'
Jan 24 00:00:45 raspberrypi weewx[1264]: cheetahgenerator: using search list ['weewx.cheetahgenerator.Almanac', 'weewx.cheetahgenerator.Station', 'weewx.cheetahgenerator.Current', 'weewx.cheetahgenerator.Stats', 'weewx.cheetahgenerator.UnitInfo', 'weewx.cheetahgenerator.Extras', 'user.alltime.ExtendedStatistics', 'user.inigo-since.Since']
Jan 24 00:00:45 raspberrypi weewx[1264]: manager: Daily summary version is 2.0
Jan 24 00:00:45 raspberrypi weewx[1264]: cheetahgenerator: Generated 1 files for report Inigo in 0.25 seconds
Jan 24 00:00:45 raspberrypi weewx[1264]: reportengine: Running report 'Belchertown'
Jan 24 00:00:45 raspberrypi weewx[1264]: reportengine: Found configuration file /home/weewx/skins/Belchertown/skin.conf for report 'Belchertown'
Jan 24 00:00:45 raspberrypi weewx[1264]: cheetahgenerator: using search list ['weewx.cheetahgenerator.Almanac', 'weewx.cheetahgenerator.Station', 'weewx.cheetahgenerator.Current', 'weewx.cheetahgenerator.Stats', 'weewx.cheetahgenerator.UnitInfo', 'weewx.cheetahgenerator.Extras', 'user.belchertown.getData']
Jan 24 00:00:45 raspberrypi weewx[1264]: manager: Daily summary version is 2.0
Jan 24 00:00:48 raspberrypi weewx[1264]: Belchertown Extension: New forecast file downloaded to /home/weewx/public_html/belchertown/json/forecast.json
Jan 24 00:00:48 raspberrypi weewx[1264]: Belchertown Extension: Error getting AQI from Aeris weather. The error was:#012list index out of range#012The response from the Aeris AQI server was:#012[{u'response': [], u'success': True, u'error': {u'code': u'warn_no_data', u'description': u'Valid request. No results available based on your query parameters.'}}]#012The URL being used is:#012https://api.aerisapi.com/airquality/closest?p=42.156,11.903&format=json&radius=50mi&limit=1&client_id=QLw2Ic2SyD52rxmLDVKcx&client_secret=H1m7PwuFRkRp8f1BXao4DIffkgS88ChngbFDOV2k
Jan 24 00:00:48 raspberrypi weewx[1264]: cheetahgenerator: Generate failed with exception '<type 'exceptions.UnicodeDecodeError'>'
Jan 24 00:00:48 raspberrypi weewx[1264]: cheetahgenerator: **** Ignoring template /home/weewx/skins/Belchertown/json/weewx_data.json.tmpl
Jan 24 00:00:48 raspberrypi weewx[1264]: cheetahgenerator: **** Reason: 'utf8' codec can't decode byte 0xec in position 16: unexpected end of data
Jan 24 00:00:48 raspberrypi weewx[1264]: ****  Traceback (most recent call last):
Jan 24 00:00:48 raspberrypi weewx[1264]: ****    File "/home/weewx/bin/weewx/cheetahgenerator.py", line 332, in generate
Jan 24 00:00:48 raspberrypi weewx[1264]: ****      fd.write(str(compiled_template))
Jan 24 00:00:48 raspberrypi weewx[1264]: ****    File "/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 1045, in __str__
Jan 24 00:00:48 raspberrypi weewx[1264]: ****      rc = getattr(self, mainMethName)()
Jan 24 00:00:48 raspberrypi weewx[1264]: ****    File "_home_weewx_skins_Belchertown_json_weewx_data_json_tmpl.py", line 2757, in respond
Jan 24 00:00:48 raspberrypi weewx[1264]: ****    File "/home/weewx/bin/weewx/cheetahgenerator.py", line 600, in filter
Jan 24 00:00:48 raspberrypi weewx[1264]: ****      filtered = self.filter(str(val))
Jan 24 00:00:48 raspberrypi weewx[1264]: ****    File "/home/weewx/bin/weewx/cheetahgenerator.py", line 598, in filter
Jan 24 00:00:48 raspberrypi weewx[1264]: ****      filtered = val.decode('utf-8').encode('ascii', 'xmlcharrefreplace')
Jan 24 00:00:48 raspberrypi weewx[1264]: ****    File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
Jan 24 00:00:48 raspberrypi weewx[1264]: ****      return codecs.utf_8_decode(input, errors, True)
Jan 24 00:00:48 raspberrypi weewx[1264]: ****  UnicodeDecodeError: 'utf8' codec can't decode byte 0xec in position 16: unexpected end of data

It fails on:

/home/weewx/skins/Standard/week.html.tmpl /home/weewx/skins/Standard/smartphone/temp_outside.html.tmpl /home/weewx/skins/Standard/smartphone/barometer.html.tmpl /home/weewx/skins/Belchertown/json/weewx_data.json.tmpl

Three errors on Standard skin and one on Belchertown. The error on weewx_data.json would explain why the json is showing en_US as a locale because the file isn't (re)generated properly. What else do these errors have in common?

cheetahgenerator: **** Reason: 'utf8' codec can't decode byte 0xec in position xx: unexpected end of data
****  UnicodeDecodeError: 'utf8' codec can't decode byte 0xec in position xx: unexpected end of data
****    File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode

Is this all caused by the code cleanup? If I understand more I will let you know, and perhaps @uajqq is already working on a new solution.

fvirgola80 commented 3 years ago

I'll re-link the debug and syslog files from now. I changed the raspberry language to en_us and in the skin.conf file I entered it_IT.UTF-8 debugsyslog.zip

ArendPWS commented 3 years ago

Your snapshots appear to look normal/correct right at this moment when I check your site....?

uajqq commented 3 years ago

Unfortunately this might take a little while to fix, since I can’t replicate this bug on my machine. I just force-pushed an update to the unicode_fix branch. @fvirgola80, try that latest file and see what you get.