RE: [weewx-user] Re: weewx crashes with error: unpack requires a string of len 104
Hi Susan I’m at a loss to understand where the problem lay but as it’s working fine with a loop delay of 15 I’m happy to leave it at that. Thank you for the note about the router advertisements and soliciting a DHCPV6 lease – I’ve fixed the problem and the syslog files are a lot easier to read now. Once again thanks for your help Graham From: weewx-user@googlegroups.com <weewx-user@googlegroups.com> On Behalf Of vk3...@gmail.com Sent: 12 April 2018 04:42 To: weewx-user <weewx-user@googlegroups.com> Subject: [weewx-user] Re: weewx crashes with error: unpack requires a string of len 104 Hello Graham, I've not been able to come up with anything so far but I'm still looking at this. It is a real puzzle because there should be log file entries from WeeWx if my code was exiting or encountering a fault etc.. Instead there is nothing in the log file. I'm still looking into this By the way, I noticed a number of messages in your syslog file from wlan0 about router advertisements and soliciting an DCHPV6 lease. I used to get a number of those as well and I found that it was my system running its own DHCP server (dhcpd) on that interface as well as the main DHCP server in my router. I stopped the dhcpd service on the system and those all went away. Not what you were after but might help in other areas anyway. Susan -- 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 weewx-user+unsubscr...@googlegroups.com <mailto:weewx-user+unsubscr...@googlegroups.com> . For more options, visit https://groups.google.com/d/optout. -- 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 weewx-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [weewx-user] Re: weewx crashes with error: unpack requires a string of len 104
Thanks Susan I just set up weewx on an older RPI and that seems to be working fine, though still on delay of 15. I was wondering about the wlan and ip6 messages, thanks for giving me the solution. I had assumed it was to do with weewx. Cheers Graham Get Outlook for Android<https://aka.ms/ghei36> From: weewx-user@googlegroups.com <weewx-user@googlegroups.com> on behalf of vk3...@gmail.com <vk3...@gmail.com> Sent: Thursday, April 12, 2018 4:41:41 AM To: weewx-user Subject: [weewx-user] Re: weewx crashes with error: unpack requires a string of len 104 Hello Graham, I've not been able to come up with anything so far but I'm still looking at this. It is a real puzzle because there should be log file entries from WeeWx if my code was exiting or encountering a fault etc.. Instead there is nothing in the log file. I'm still looking into this By the way, I noticed a number of messages in your syslog file from wlan0 about router advertisements and soliciting an DCHPV6 lease. I used to get a number of those as well and I found that it was my system running its own DHCP server (dhcpd) on that interface as well as the main DHCP server in my router. I stopped the dhcpd service on the system and those all went away. Not what you were after but might help in other areas anyway. Susan -- 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 weewx-user+unsubscr...@googlegroups.com<mailto:weewx-user+unsubscr...@googlegroups.com>. For more options, visit https://groups.google.com/d/optout. -- 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 weewx-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[weewx-user] Re: weewx crashes with error: unpack requires a string of len 104
Hello Graham, I've not been able to come up with anything so far but I'm still looking at this. It is a real puzzle because there should be log file entries from WeeWx if my code was exiting or encountering a fault etc.. Instead there is nothing in the log file. I'm still looking into this By the way, I noticed a number of messages in your syslog file from wlan0 about router advertisements and soliciting an DCHPV6 lease. I used to get a number of those as well and I found that it was my system running its own DHCP server (dhcpd) on that interface as well as the main DHCP server in my router. I stopped the dhcpd service on the system and those all went away. Not what you were after but might help in other areas anyway. Susan -- 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 weewx-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [weewx-user] Re: weewx crashes with error: unpack requires a string of len 104
Using the revised hp1000 driver with delay of 30 and starting weewx manually I can see all the records coming through on the terminal. I can see the process stopping as the records just stop coming through and the cmd line returns. Additionally no further reports are generated. I haven’t tried ps on this version of the driver but returning to the cmd line would seem to indicate that the process has stopped. Using the original driver with delay of 30 produced the error after random times (ie there was no consistency as to how long the process would run for) that started this thread off. Ps did not show any running process for weewx following this. The delay of 15 seems to have resolved the issue from my perspective as it has run continuously for 3 days but I must admit I’m puzzled by the error Graham Sent from my iPad > On 9 Apr 2018, at 03:36, vk3...@gmail.com wrote: > > Mmmm - I'll have a look to see if there is an issue with the delay setting. > > I've had a look at the log file and I can't see any reason why it should just > stop like that. I fact, how do you know that it *has* stopped? Can you do a > 'ps' or 'top' to se if the process is still running, or if you are using > systemd, then do a status on weewx to see what has happened. > > As far as I know (and in like with the original title of this thread) if > there was an error then it should have displayed that and then continued. In > my (limited) experience, Python code only stops when the program exits > normally. > > Susan > >> On Saturday, April 7, 2018 at 6:44:11 PM UTC+10, Graham Seward wrote: >> Hi Susan >> Your last comment got me to thinking about the loop delay so I reset >> weewx.conf to a loop delay of 15 secs. It has now been running for 14 hours >> without a glitch so it looks like I had caused the problem but I’m not sure >> how. I will leave it as is. >> Thanks >> Graham >> >> Sent from my iPad >> >>> On 5 Apr 2018, at 03:37, vk3...@gmail.com wrote: >>> >>> You are not being a nuisance at all, but it is a bit hard to do 'remote >>> diagnostics'. >>> >>> The log file would be useful but not the whole thing: just the part a bit >>> before you start weewx until just after it has stopped will be enough. >>> >>> Where are you setting the loop delay value and can you show us the >>> file/line in question? >>> >>> Susan >>> >>>> On Thursday, April 5, 2018 at 2:20:53 AM UTC+10, Graham Seward wrote: >>>> Hi Susan >>>> >>>> Regret to say that weewx stopped running again without writing anything to >>>> syslog, messages or user.log. Syslog shows that when weewx starts it is >>>> using the correct version of the driver, so I’m puzzled as to what is >>>> going on. Would you like a copy of the syslog file in it’s entirety to see >>>> if that throws up any clues? >>>> >>>> >>>> >>>> I’m going to run weewx again but with your original driver to see what >>>> happens this time. Incidentally if I set the loop-delay to 60 secs the >>>> program doesn’t run at all – currently set at 30secs. >>>> >>>> >>>> >>>> Sorry to be a nuisance! >>>> >>>> Graham >>>> >>>> >>>> >>>> From: weewx...@googlegroups.com <weewx...@googlegroups.com> On Behalf Of >>>> vk3...@gmail.com >>>> Sent: 04 April 2018 03:50 >>>> To: weewx-user <weewx...@googlegroups.com> >>>> Subject: Re: [weewx-user] Re: weewx crashes with error: unpack requires a >>>> string of len 104 >>>> >>>> >>>> >>>> G - too long since I wrote the code and I made a stupid mistake. The >>>> two 'loginf' lines should read >>>> >>>> >>>> >>>> loginf('Bad data: length = {0}'.format(len(rxData))) >>>> >>>> loginf('Bad data: "{0}"'.format(rxData)) >>>> >>>> >>>> >>>> I've attached your file with the correction in it. >>>> >>>> >>>> >>>> Sorry about that. >>>> >>>> >>>> >>>> Susan >>>> >>>> >>>> >>>> -- >>>> You received this message because you are subscribed to the Google Groups >>>> "weewx-user" group. >>>> To unsubscribe from this group and stop receiving emails fr
Re: [weewx-user] Re: weewx crashes with error: unpack requires a string of len 104
Mmmm - I'll have a look to see if there is an issue with the delay setting. I've had a look at the log file and I can't see any reason why it should just stop like that. I fact, how do you know that it *has* stopped? Can you do a 'ps' or 'top' to se if the process is still running, or if you are using systemd, then do a status on weewx to see what has happened. As far as I know (and in like with the original title of this thread) if there was an error then it should have displayed that and then continued. In my (limited) experience, Python code only stops when the program exits normally. Susan On Saturday, April 7, 2018 at 6:44:11 PM UTC+10, Graham Seward wrote: > > Hi Susan > Your last comment got me to thinking about the loop delay so I reset > weewx.conf to a loop delay of 15 secs. It has now been running for 14 hours > without a glitch so it looks like I had caused the problem but I’m not sure > how. I will leave it as is. > Thanks > Graham > > Sent from my iPad > > On 5 Apr 2018, at 03:37, vk3...@gmail.com wrote: > > You are not being a nuisance at all, but it is a bit hard to do 'remote > diagnostics'. > > The log file would be useful but not the whole thing: just the part a bit > before you start weewx until just after it has stopped will be enough. > > Where are you setting the loop delay value and can you show us the > file/line in question? > > Susan > > On Thursday, April 5, 2018 at 2:20:53 AM UTC+10, Graham Seward wrote: >> >> Hi Susan >> >> Regret to say that weewx stopped running again without writing anything >> to syslog, messages or user.log. Syslog shows that when weewx starts it is >> using the correct version of the driver, so I’m puzzled as to what is going >> on. Would you like a copy of the syslog file in it’s entirety to see if >> that throws up any clues? >> >> >> >> I’m going to run weewx again but with your original driver to see what >> happens this time. Incidentally if I set the loop-delay to 60 secs the >> program doesn’t run at all – currently set at 30secs. >> >> >> >> Sorry to be a nuisance! >> >> Graham >> >> >> >> *From:* weewx...@googlegroups.com <weewx...@googlegroups.com> *On Behalf >> Of *vk3...@gmail.com >> *Sent:* 04 April 2018 03:50 >> *To:* weewx-user <weewx...@googlegroups.com> >> *Subject:* Re: [weewx-user] Re: weewx crashes with error: unpack >> requires a string of len 104 >> >> >> >> G - too long since I wrote the code and I made a stupid mistake. The >> two 'loginf' lines should read >> >> >> >> loginf('Bad data: length = {0}'.format(len(rxData))) >> >> loginf('Bad data: "{0}"'.format(rxData)) >> >> >> >> I've attached your file with the correction in it. >> >> >> >> Sorry about that. >> >> >> >> Susan >> >> >> >> -- >> 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 weewx-user+...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > -- > 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 weewx-user+...@googlegroups.com . > For more options, visit https://groups.google.com/d/optout. > > -- 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 weewx-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [weewx-user] Re: weewx crashes with error: unpack requires a string of len 104
You are not being a nuisance at all, but it is a bit hard to do 'remote diagnostics'. The log file would be useful but not the whole thing: just the part a bit before you start weewx until just after it has stopped will be enough. Where are you setting the loop delay value and can you show us the file/line in question? Susan On Thursday, April 5, 2018 at 2:20:53 AM UTC+10, Graham Seward wrote: > > Hi Susan > > Regret to say that weewx stopped running again without writing anything to > syslog, messages or user.log. Syslog shows that when weewx starts it is > using the correct version of the driver, so I’m puzzled as to what is going > on. Would you like a copy of the syslog file in it’s entirety to see if > that throws up any clues? > > > > I’m going to run weewx again but with your original driver to see what > happens this time. Incidentally if I set the loop-delay to 60 secs the > program doesn’t run at all – currently set at 30secs. > > > > Sorry to be a nuisance! > > Graham > > > > *From:* weewx...@googlegroups.com <weewx...@googlegroups.com > > *On Behalf Of *vk3...@gmail.com > *Sent:* 04 April 2018 03:50 > *To:* weewx-user <weewx...@googlegroups.com > > *Subject:* Re: [weewx-user] Re: weewx crashes with error: unpack requires > a string of len 104 > > > > G - too long since I wrote the code and I made a stupid mistake. The > two 'loginf' lines should read > > > > loginf('Bad data: length = {0}'.format(len(rxData))) > > loginf('Bad data: "{0}"'.format(rxData)) > > > > I've attached your file with the correction in it. > > > > Sorry about that. > > > > Susan > > > > -- > 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 weewx-user+...@googlegroups.com . > For more options, visit https://groups.google.com/d/optout. > -- 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 weewx-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
RE: [weewx-user] Re: weewx crashes with error: unpack requires a string of len 104
Hi Susan Regret to say that weewx stopped running again without writing anything to syslog, messages or user.log. Syslog shows that when weewx starts it is using the correct version of the driver, so I’m puzzled as to what is going on. Would you like a copy of the syslog file in it’s entirety to see if that throws up any clues? I’m going to run weewx again but with your original driver to see what happens this time. Incidentally if I set the loop-delay to 60 secs the program doesn’t run at all – currently set at 30secs. Sorry to be a nuisance! Graham From: weewx-user@googlegroups.com <weewx-user@googlegroups.com> On Behalf Of vk3...@gmail.com Sent: 04 April 2018 03:50 To: weewx-user <weewx-user@googlegroups.com> Subject: Re: [weewx-user] Re: weewx crashes with error: unpack requires a string of len 104 G - too long since I wrote the code and I made a stupid mistake. The two 'loginf' lines should read loginf('Bad data: length = {0}'.format(len(rxData))) loginf('Bad data: "{0}"'.format(rxData)) I've attached your file with the correction in it. Sorry about that. Susan -- 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 weewx-user+unsubscr...@googlegroups.com <mailto:weewx-user+unsubscr...@googlegroups.com> . For more options, visit https://groups.google.com/d/optout. -- 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 weewx-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [weewx-user] Re: weewx crashes with error: unpack requires a string of len 104
G - too long since I wrote the code and I made a stupid mistake. The two 'loginf' lines should read loginf('Bad data: length = {0}'.format(len(rxData))) loginf('Bad data: "{0}"'.format(rxData)) I've attached your file with the correction in it. Sorry about that. Susan -- 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 weewx-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. # #Copyright (c) 2017 Susan Mackay # acknowledging that this driver code originated from and # is structured in a similar way to the Weewx 'Simulator' driver code # that carries the following line: #Copyright (c) 2009-2015 Tom Keffer# # """hp1000 driver for the weewx weather system This driver communicates with the HP1000/WS1001/XC0422 and whatever other clone weather stations respond over the LAN to the 'easyweather' protocol. Communication starts with a UDP IP broadcast on the local subnet to port 6000 to see if the weather station responds. The broadcast packet is structured as: Offset Value Structure Comment 0x00PC2000 8 byte string Identifies the calling station 0x08SEARCH 8 byte string Command 0x10nulls 24 null bytes I think there could be structure here but sending nulls works! (NB: All strings are null padded if required) The weather station returns a packet structured as: Offset Value Structure Comment 0x00HP2000 8 byte string Name of the seather station 0x08SEARCH 8 byte string Command 0x108 byte string Unknown 0x1816 bytesNot yet deciphered 0x28text24 byte string MAC address of the weather station 0x40text16 byte string IP address of the weather station The last item is the one that we are after as then then make an TCP connection to port 6500 on that address for all further communications. All packets have the same basick structure: the 8-byte (null terminated) sending device name, the 8 byte command (READ - sent to the weather station requesting data; WRITE - the response from the wreather station with the requested data) and a 12-byte sub-command with the type of data to be read/sent. This is followed by what appears to be random characters but sending nulls does not seem to affect things. READ packets are always 40 bytes and WRITE packets vary in length depending on the data but has a 32-byte header (structured as above). The weather station will send data using the unit selection in the 'set up' screen (e.g temperature in degrees Fahrenheit or Celsius). Therefore you need to know what conversions (if any) are needed to build up the LOOP record. The driver follows the (nearly) universal convention and uses the Metric (METRICWX) system for the LOOP packet and so will convert al values to SI units. To find out what units are being sent by the weather staiton, send a "SETUP" command and interpret the response as follows (after the 32-byte header): Offset Value Structure Comment 0x20unknown 16 bytesYet to be deciphered 0x30Time1 byte 1 = 'H:mm:ss', 2="h:mm:ss AM", 4='AM h:mm:ss' 0x31Date1 byte 16 = 'DD-MM-', 32 = 'MM-DD-', 64 = '-MM-DD' 0x32Temperature 1 byte 0 = Celsius, 1 = Fahrenheit 0x33Pressure1 byte 0 = hPa, 1 = inHg, 2 = mmHg 0x34Wind speed 1 byte 0 = m/s, 1 = km/h, 2 = knots, 3 = mph, 4 = Beaufort, 5 = ft/s 0x35Rainfall1 byte 0 = mm, 1 = in 0x36Solar rad 1 byte 0 = lux, 1 = fc, 2=W/m^2 0x37Rain display1 byte 0 = rain rate, 1 = daily, 2 = weekly, 3 = monthly, 4 = yearly 0x38Graph time 1 byte 0 = 12h, 1 = 24h, 2 = 48h, 3 = 72h 0x39Barometer 1 byte 0 = absolute, 1 = relative 0x3aWeather 1 byte number 0x3bStorm 1 byte number 0x3cCurrent 1 byte 0 = sunny, 1 = partly cloudy, 2 = cloudy, 3 = raim. 4 = strom 0x3dReset 1 byte Month for yearly rain reset, 1 = Jan, 2 = Feb... 0x3eUpdate 1 byte Update interval in minutes Many of these (from offset 0x37 on) are of little interest for the driver byte the temperature, pressure, wind speed, rain and solar radiaiton units are all used. The main data packet that is fetched is the NOWRECORD and it has the following structure (again after the 32 byte header): Offset Value Structure Comment 0x20unknown 8 bytes Yet to be deciphered 0x28Wind dir2 bytes Wind direction (in degrees from North = 0) [4] 0x2ainHumidity 1 byte Inside humidity [5] 0x2boutHumidity 1 byte Outside humidity [6] 0x2cinTemp 4 bytes Inside temperature
RE: [weewx-user] Re: weewx crashes with error: unpack requires a string of len 104
Hi Susan I updated the hp1000 file as requested – copy attached. I then ran weewx which was fine until 17:39 when it stopped with the last reading being: LOOP: 2018-04-03 17:39:07 BST (1522773547) altimeter: 29.1707530717, appTemp: 47.1549180258, barometer: 29.8636759983, cloudbase: 2403.71906385, dateTime: 1522773547, dewPoint: 6.3019073, dewpoint: 43.297915016, heatindex: 53.6, humidex: 53.6, inDewpoint: 48.7200784102, inHumidity: 48, inTemp: 69.2600013733, maxSolarRad: None, outHumidity: 68, outTemp: 53.6, pressure: 29.1136153972, radiation: 451.04699707, rain: 0.0, rainRate: 0, usUnits: 1, UV: 1, windchill: 53.6, windChill: 12.0, windDir: 167, windGust: 9.81768936544, windSpeed: 8.69921832006 Syslog does not show the failure at all - see below: Apr 3 17:39:06 raspberrypi dhcpcd[311]: wlan0: Router Advertisement from fe80::52c7:bfff:fe17:64d6 Apr 3 17:39:06 raspberrypi dhcpcd[311]: wlan0: soliciting a DHCPv6 lease Apr 3 17:39:16 raspberrypi dhcpcd[311]: wlan0: Router Advertisement from fe80::52c7:bfff:fe17:64d6 Apr 3 17:39:16 raspberrypi dhcpcd[311]: wlan0: soliciting a DHCPv6 lease I suspect I messed up editing HP1000 but I am at a bit of a loss to know how. Any suggestions gratefully received. Graham. From: weewx-user@googlegroups.com <weewx-user@googlegroups.com> On Behalf Of vk3...@gmail.com Sent: 03 April 2018 04:50 To: weewx-user <weewx-user@googlegroups.com> Subject: Re: [weewx-user] Re: weewx crashes with error: unpack requires a string of len 104 First off, my apologies to all - given the subject line I completely missed that this question was related to my HP1000 driver. Given the line number, you are using the latest version of the driver (I note that the driver that Bob provides above is based on the earlier version). Is it possible to edit the HP1000.py file and change line 524 from interp_data = struct.unpack("8s8s16s8shbb14fbbh", rxData) to try: interp_data = struct.unpack("8s8s16s8shbb14fbbh", rxData) except: loginf('Bad data: length = {0}', len(rxData)) loginf('Bad data: "{0}"', rxData) continue (Note the indenting of 4 spaces - Pythin is very sensitive to the indenting of the code.) That should dump out to the system log file the bad data so that we can look at it and see what is wrong. When I wrote the driver I only had my own weather station as a guide so if other firmware creates different sized (or formatted) records then there will be problems. It is hard to know the level of 'error protection' that is needed when yo don't know the sources of the possible errors (at least that is my excuse!). Susan -- 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 weewx-user+unsubscr...@googlegroups.com <mailto:weewx-user+unsubscr...@googlegroups.com> . For more options, visit https://groups.google.com/d/optout. -- 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 weewx-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. HP1000-gs.py Description: Binary data
Re: [weewx-user] Re: weewx crashes with error: unpack requires a string of len 104
Thanks Susan I will have a go at this later today. I am a newbie at Python so it will be a step forward on my learning curve! Regret Bob’s driver didn’t do the trick but I’m grateful to him for the help. Graham Sent from my iPad > On 3 Apr 2018, at 04:49, vk3...@gmail.com wrote: > > First off, my apologies to all - given the subject line I completely missed > that this question was related to my HP1000 driver. > Given the line number, you are using the latest version of the driver (I note > that the driver that Bob provides above is based on the earlier version). > Is it possible to edit the HP1000.py file and change line 524 from > > interp_data = struct.unpack("8s8s16s8shbb14fbbh", rxData) > > to > > try: > interp_data = struct.unpack("8s8s16s8shbb14fbbh", rxData) > except: > loginf('Bad data: length = {0}', len(rxData)) > loginf('Bad data: "{0}"', rxData) > continue > > (Note the indenting of 4 spaces - Pythin is very sensitive to the indenting > of the code.) > That should dump out to the system log file the bad data so that we can look > at it and see what is wrong. > > When I wrote the driver I only had my own weather station as a guide so if > other firmware creates different sized (or formatted) records then there will > be problems. It is hard to know the level of 'error protection' that is > needed when yo don't know the sources of the possible errors (at least that > is my excuse!). > > Susan > -- > 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 weewx-user+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- 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 weewx-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [weewx-user] Re: weewx crashes with error: unpack requires a string of len 104
First off, my apologies to all - given the subject line I completely missed that this question was related to my HP1000 driver. Given the line number, you are using the latest version of the driver (I note that the driver that Bob provides above is based on the earlier version). Is it possible to edit the HP1000.py file and change line 524 from interp_data = struct.unpack("8s8s16s8shbb14fbbh", rxData) to try: interp_data = struct.unpack("8s8s16s8shbb14fbbh", rxData) except: loginf('Bad data: length = {0}', len(rxData)) loginf('Bad data: "{0}"', rxData) continue (Note the indenting of 4 spaces - Pythin is very sensitive to the indenting of the code.) That should dump out to the system log file the bad data so that we can look at it and see what is wrong. When I wrote the driver I only had my own weather station as a guide so if other firmware creates different sized (or formatted) records then there will be problems. It is hard to know the level of 'error protection' that is needed when yo don't know the sources of the possible errors (at least that is my excuse!). Susan -- 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 weewx-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [weewx-user] Re: weewx crashes with error: unpack requires a string of len 104
Thanks Bob I’ll be giving a try tomorrow. Graham Sent from my iPad > On 2 Apr 2018, at 19:00, rmc...@gmail.com wrote: > > > >> On Monday, April 2, 2018 at 11:21:05 AM UTC-4, Graham Seward wrote: >> Thanks Bob >> I look forward to seeing it - like you though I'm not a programmer and not >> sure I'll be able to hack the driver myself - still I'll have a go! >> As you say, hopefully Susan will see this. >> Many thanks >> Graham > > Graham, > Here is a copy of the driver I'm using. There are only 3 sections I modified > starting about line 261, 314, and 346. > I hope it works for you > > Bob > -- > 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 weewx-user+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- 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 weewx-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[weewx-user] Re: weewx crashes with error: unpack requires a string of len 104
On Monday, April 2, 2018 at 11:21:05 AM UTC-4, Graham Seward wrote: > > Thanks Bob > I look forward to seeing it - like you though I'm not a programmer and not > sure I'll be able to hack the driver myself - still I'll have a go! > As you say, hopefully Susan will see this. > Many thanks > Graham > Graham, Here is a copy of the driver I'm using. There are only 3 sections I modified starting about line 261, 314, and 346. I hope it works for you Bob -- 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 weewx-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. # #Copyright (c) 2017 Susan Mackay # acknowledging that this driver code originated from and # is structured in a similar way to the Weewx 'Simulator' driver code # that carries the following line: #Copyright (c) 2009-2015 Tom Keffer# # """hp1000 driver for the weewx weather system""" import math import time import datetime import weedb import weewx.drivers import weeutil.weeutil from weewx.units import convertStd import syslog import sys import socket import struct DRIVER_NAME = 'HP1000' DRIVER_VERSION = "1.0" UDP_BROADCAST_PORT = 6000 TCP_PORT = 6500 def loader(config_dict, engine): station = HP1000Driver(**config_dict[DRIVER_NAME]) return station def logmsg(level, msg): syslog.syslog(level, 'HP1000: %s' % (msg)) def logdbg(msg): logmsg(syslog.LOG_DEBUG, msg) def loginf(msg): logmsg(syslog.LOG_ERR, msg) def logerr(msg): logmsg(syslog.LOG_ERR, msg) class HP1000Driver(weewx.drivers.AbstractDevice): """HP1000 Driver""" def __init__(self, **stn_dict): """Initialize the HP1000 driver""" self.ws_name = "HP1000" loginf('HP1000 Starting') self.internal_test_mode = False # Save the configuration parameters try: self.ip_address_mask = stn_dict['ip_address_mask'] except KeyError, e: raise Exception( "Required parameter 'ip_address_mask' has not been specified") self.retry_count = int(stn_dict.get('retry_count', 5)) self.socket_timeout = float(stn_dict.get('socket_timeout', 5)) self.loop_delay = float( stn_dict.get('loop_delay', None)) self.retry_wait = int(stn_dict.get('retry_wait', 5)) self.max_retry = int(stn_dict.get('max_retry', 5)) self.last_rain_value = None self.last_rain_time = None loginf('Address Mask = %s' % self.ip_address_mask) loginf('Retry count = %f' % self.retry_count) loginf('Socket timeout = %f' % self.socket_timeout) if self.loop_delay is None: loginf('No loop delay') else: loginf('Loop delay = %f' % self.loop_delay) loginf('Retry Wait = %f' % self.retry_wait) loginf('Max Retry = %f' % self.max_retry) # Show that we are not connected to a weather station self.ws_socket = None def string_to_null_padded(self, source, max_length, padd_char='\0'): # Create a byte array passed_string = source.ljust(max_length, '\0') return passed_string def create_cmd_string(self, cmd="READ", argument="NOWRECORD"): # Create the complete packet cmd_packet = '{0:<8s}{1:<8s}{2:<12s}'.format( self.string_to_null_padded('PC2000', 8), self.string_to_null_padded(cmd, 8), self.string_to_null_padded(argument, 12)) cmd_packet = self.string_to_null_padded(cmd_packet, 40) return cmd_packet def convert_units(self, source, target): """Suppress errors when the conversion cannot occcur such as when the source and target unit are the same - it happens a lot in this code""" try: result = convertStd(source, target) except: result = source return result def genLoopPackets(self): network_retry_count = self.max_retry # Local network failure retry counter while True: if self.ws_socket is None: # Search for a weather station on the specified if not self.internal_test_mode: # Broadcast for a weather station sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) sock.settimeout(self.socket_timeout) bcData = "PC2000\0\0SEARCH\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" retry_counter = self.retry_count sender_addr = None while True: #
[weewx-user] Re: weewx crashes with error: unpack requires a string of len 104
Thanks Bob I look forward to seeing it - like you though I'm not a programmer and not sure I'll be able to hack the driver myself - still I'll have a go! As you say, hopefully Susan will see this. Many thanks Graham -- 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 weewx-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[weewx-user] Re: weewx crashes with error: unpack requires a string of len 104
On Monday, April 2, 2018 at 9:48:57 AM UTC-4, Graham Seward wrote: > > Hi > Did you ever get a solution to this issue. I have weewx running with > Susan's HP1000 driver connecting to a Maplin N23-dq (HP1000 clone). Took me > a while to get it going in first place but eventually a firmware upgrade on > the HP1000 resulted in success. However after a couple of hours of running > weewx stops. Syslog throws up the same error as yours: > > Mar 31 17:04:38 raspberrypi weewx[1148]: engine: Main loop exiting. > Shutting engine down. > Mar 31 17:04:38 raspberrypi weewx[1148]: engine: Shutting down StdReport > thread > Mar 31 17:04:38 raspberrypi weewx[1148]: engine: StdReport thread has been > terminated > Mar 31 17:04:38 raspberrypi weewx[1148]: engine: Caught unrecoverable > exception in engine: > Mar 31 17:04:38 raspberrypi weewx[1148]: unpack requires a > string argument of length 104 > Mar 31 17:04:38 raspberrypi weewx[1148]: Traceback (most recent > call last): > Mar 31 17:04:38 raspberrypi weewx[1148]: File > "/home/weewx/bin/weewx/engine.py", line 871, in main > Mar 31 17:04:38 raspberrypi weewx[1148]: engine.run() > Mar 31 17:04:38 raspberrypi weewx[1148]: File > "/home/weewx/bin/weewx/engine.py", line 187, in run > Mar 31 17:04:38 raspberrypi weewx[1148]: for packet in > self.console.genLoopPackets(): > Mar 31 17:04:38 raspberrypi weewx[1148]: File > "/home/weewx/bin/user/HP1000.py", line 524, in genLoopPackets > Mar 31 17:04:38 raspberrypi weewx[1148]: interp_data = > struct.unpack("8s8s16s8shbb14fbbh", rxData) > Mar 31 17:04:38 raspberrypi weewx[1148]: error: unpack requires > a string argument of length 104 > Mar 31 17:04:38 raspberrypi weewx[1148]: Exiting. > > Weewex v3.8 on Raspberry Pi model B > Short of shutting down and restarting I have not been able to resolve the > issue > > I've searched all the threads and can't find a solution - is there one? > Any help apprecia > Hi Graham, Yes I did get a fix for the problem. Thats the short answer. The long answer is I hacked the driver and if I remember Weewx it self. I'll post what I did, but I want you to know that I'm a (almost) 80 yr old truck driver not a programmer. Maybe Susan will see this and chime in. Luck Bob -- 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 weewx-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[weewx-user] Re: weewx crashes with error: unpack requires a string of len 104
Hi Did you ever get a solution to this issue. I have weewx running with Susan's HP1000 driver connecting to a Maplin N23-dq (HP1000 clone). Took me a while to get it going in first place but eventually a firmware upgrade on the HP1000 resulted in success. However after a couple of hours of running weewx stops. Syslog throws up the same error as yours: Mar 31 17:04:38 raspberrypi weewx[1148]: engine: Main loop exiting. Shutting engine down. Mar 31 17:04:38 raspberrypi weewx[1148]: engine: Shutting down StdReport thread Mar 31 17:04:38 raspberrypi weewx[1148]: engine: StdReport thread has been terminated Mar 31 17:04:38 raspberrypi weewx[1148]: engine: Caught unrecoverable exception in engine: Mar 31 17:04:38 raspberrypi weewx[1148]: unpack requires a string argument of length 104 Mar 31 17:04:38 raspberrypi weewx[1148]: Traceback (most recent call last): Mar 31 17:04:38 raspberrypi weewx[1148]: File "/home/weewx/bin/weewx/engine.py", line 871, in main Mar 31 17:04:38 raspberrypi weewx[1148]: engine.run() Mar 31 17:04:38 raspberrypi weewx[1148]: File "/home/weewx/bin/weewx/engine.py", line 187, in run Mar 31 17:04:38 raspberrypi weewx[1148]: for packet in self.console.genLoopPackets(): Mar 31 17:04:38 raspberrypi weewx[1148]: File "/home/weewx/bin/user/HP1000.py", line 524, in genLoopPackets Mar 31 17:04:38 raspberrypi weewx[1148]: interp_data = struct.unpack("8s8s16s8shbb14fbbh", rxData) Mar 31 17:04:38 raspberrypi weewx[1148]: error: unpack requires a string argument of length 104 Mar 31 17:04:38 raspberrypi weewx[1148]: Exiting. Weewex v3.8 on Raspberry Pi model B Short of shutting down and restarting I have not been able to resolve the issue I've searched all the threads and can't find a solution - is there one? Any help appreciated >> -- 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 weewx-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[weewx-user] Re: weewx crashes with error: unpack requires a string of len 104
Well it looks as though the HP1001 driver had a problem with data received f4rom the station. I suspect you need to run with debug set in order to determine exactly what is going on inside the driver to cause the error to be thrown, but I suspect it has received a packet of incorrect length - and should probably throw the poacket away rather than taking a fatal error exit - unless in fact this is a result of a repeated failure to receive data from the station. I'll let someone more familiar with the HP1001 driver take up trying to help you further!! Good luck. On Saturday, 15 April 2017 21:47:17 UTC+3, rmc...@gmail.com wrote: > Your right Andrew, I didn't give much information. The farther I get into > my dottage the more I forget other people can't read my mind. > > I have a Ambient ws1001, Firmware is ver 2.6.1, weewx 3.7.1, with Susans > HP1001 driver. > > root@raspberrypi:/home/pi# systemctl status weewx > ● weewx.service - LSB: weewx weather system >Loaded: loaded (/etc/init.d/weewx) >Active: active (exited) since Sat 2017-04-15 14:24:30 EDT; 19min ago > Process: 6163 ExecStop=/etc/init.d/weewx stop (code=exited, > status=0/SUCCESS) > Process: 6177 ExecStart=/etc/init.d/weewx start (code=exited, > status=0/SUCCESS) > > Apr 15 14:28:38 raspberrypi weewx[6204]: unpack requires a string > argument of length 104 > Apr 15 14:28:38 raspberrypi weewx[6204]: Traceback (most recent call > last): > Apr 15 14:28:38 raspberrypi weewx[6204]: File > "/usr/share/weewx/weewx/engine.py", line 871, in main > Apr 15 14:28:38 raspberrypi weewx[6204]: engine.run() > Apr 15 14:28:38 raspberrypi weewx[6204]: File > "/usr/share/weewx/weewx/engine.py", line 187, in run > Apr 15 14:28:38 raspberrypi weewx[6204]: for packet in > self.console.genLoopPackets(): > Apr 15 14:28:38 raspberrypi weewx[6204]: File > "/usr/share/weewx/weewx/drivers/HP1000.py", line 327, in genLoopPackets > Apr 15 14:28:38 raspberrypi weewx[6204]: interp_data = > struct.unpack("8s8s12s12shbbffbbh", rxData) > Apr 15 14:28:38 raspberrypi weewx[6204]: error: unpack requires a > string argument of length 104 > Apr 15 14:28:38 raspberrypi weewx[6204]: Exiting. > > I hope this helps. > > On Saturday, April 15, 2017 at 1:26:08 PM UTC-4, rmc...@gmail.com wrote: >> >> Subject says it all. >> >> I know this was brought up before but I can't find the thread. >> >> -- 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 weewx-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[weewx-user] Re: weewx crashes with error: unpack requires a string of len 104
Your right Andrew, I didn't give much information. The farther I get into my dottage the more I forget other people can't read my mind. I have a Ambient ws1001, Firmware is ver 2.6.1, weewx 3.7.1, with Susans HP1001 driver. root@raspberrypi:/home/pi# systemctl status weewx ● weewx.service - LSB: weewx weather system Loaded: loaded (/etc/init.d/weewx) Active: active (exited) since Sat 2017-04-15 14:24:30 EDT; 19min ago Process: 6163 ExecStop=/etc/init.d/weewx stop (code=exited, status=0/SUCCESS) Process: 6177 ExecStart=/etc/init.d/weewx start (code=exited, status=0/SUCCESS) Apr 15 14:28:38 raspberrypi weewx[6204]: unpack requires a string argument of length 104 Apr 15 14:28:38 raspberrypi weewx[6204]: Traceback (most recent call last): Apr 15 14:28:38 raspberrypi weewx[6204]: File "/usr/share/weewx/weewx/engine.py", line 871, in main Apr 15 14:28:38 raspberrypi weewx[6204]: engine.run() Apr 15 14:28:38 raspberrypi weewx[6204]: File "/usr/share/weewx/weewx/engine.py", line 187, in run Apr 15 14:28:38 raspberrypi weewx[6204]: for packet in self.console.genLoopPackets(): Apr 15 14:28:38 raspberrypi weewx[6204]: File "/usr/share/weewx/weewx/drivers/HP1000.py", line 327, in genLoopPackets Apr 15 14:28:38 raspberrypi weewx[6204]: interp_data = struct.unpack("8s8s12s12shbbffbbh", rxData) Apr 15 14:28:38 raspberrypi weewx[6204]: error: unpack requires a string argument of length 104 Apr 15 14:28:38 raspberrypi weewx[6204]: Exiting. I hope this helps. On Saturday, April 15, 2017 at 1:26:08 PM UTC-4, rmc...@gmail.com wrote: > > Subject says it all. > > I know this was brought up before but I can't find the thread. > > -- 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 weewx-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[weewx-user] Re: weewx crashes with error: unpack requires a string of len 104
The subject says very little!! What type of station are you running, what version of weewx and how about posting the actual log extract rather than the summary since the log will have identified the module giving the error. On Saturday, 15 April 2017 20:26:08 UTC+3, rmc...@gmail.com wrote: > Subject says it all. > > I know this was brought up before but I can't find the thread. > > -- 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 weewx-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.