The StdCalibrate code didn't work but didn't throw any error messages. I 
thought about implementing a service but thought about the advice to better 
locate the thermometer. I can't find a better place to put it, but I did 
make a sun shield out of a scrap piece of aluminum that seems to be 
helping. 

On Thursday, March 28, 2019 at 4:56:14 PM UTC-7, [email protected] wrote:
>
> Thanks to everyone for their help. I'm going to leave it in StdCalibrate 
> for a day or two. I'm curious to see if it works. I'll most likely follow 
> your advice and do it in a service. 
>
>
> On Thursday, March 28, 2019 at 4:29:34 PM UTC-7, Thomas Keffer wrote:
>>
>> If you really want to do this, you would be better off writing a simple 
>> WeeWX service, rather than trying to squeeze it into StdCalibrate. It's 
>> really pretty simple. Something like this (NOT TESTED):
>>
>> *File user/temperature_fix.py:*
>>
>> import datetime
>> import weewx
>> from weewx.engine import StdService
>>
>> def fix_temp(record):
>>     hour = 
>> int(datetime.datetime.utcfromtimestamp(record['dateTime']).strftime("%H"))
>>     if record['outTemp'] > record['extraTemp1] + 4 and 16 < hour < 20:
>>         record['outTemp'] = record['extraTemp1']
>>
>> class FixMyTemperature(StdService):
>>     """Service that switches between temperature sensors"""
>>     
>>     def __init__(self, engine, config_dict):
>>         super(FixMyTemperature, self).__init__(engine, config_dict)
>>
>>         self.bind(weewx.NEW_LOOP_PACKET, self.new_loop_packet)
>>         self.bind(weewx.NEW_ARCHIVE_RECORD, self.new_archive_record)
>>         
>>     def new_loop_packet(self, event):
>>         fix_temp(event.packet)        
>>     
>>     def new_archive_record(self, event):
>>         fix_temp(event.record)
>>
>> Add this new service to the end of the process_services:
>>         process_services = weewx.engine.StdConvert, 
>> weewx.engine.StdCalibrate, weewx.engine.StdQC, 
>> weewx.wxservices.StdWXCalculate, user.temperature_fix.FixMyTemperature
>>
>>
>> But, do you really want to do this? There is no substitute for a properly 
>> calibrated and sited instrument. 
>>
>> -tk
>>
>>
>> On Thu, Mar 28, 2019 at 4:09 PM p q <[email protected]> wrote:
>>
>>> What do you mean in-line python in a template? Do you mean change the 
>>> skin to do the calculation when displaying the data? I'm mostly concerned 
>>> about having erroneous high temps in my historical data.
>>>
>>> I agree it's getting complex, but I don't see a better way short of 
>>> moving my thermometer to a new enclosure.
>>>
>>> On Thu, Mar 28, 2019 at 4:03 PM gjr80 <[email protected]> wrote:
>>>
>>>> On Friday, 29 March 2019 08:56:27 UTC+10, [email protected] wrote:
>>>>>
>>>>> Ok. I made multiple errors and the try/catch was swallowing them. I 
>>>>> still don't know if I found and fixed them all, but I think I did.
>>>>>
>>>>> Mistake #1
>>>>> I need to add datetime import into the engine python code
>>>>>
>>>>>
>>>> Just remember if you make a change to engine.py then you are opening 
>>>> yourself up to having your changes overwritten when upgrading. You can 
>>>> always pickup the date-time requirements with a couple of lines of in-line 
>>>> python in a template. Also remmeber the zen 
>>>> <https://www.python.org/dev/peps/pep-0020/#id3>:
>>>>
>>>> Simple is better than complex.
>>>> Complex is better than complicated.
>>>>
>>>>
>>>> I'm guessing your are bordering on the complicated
>>>>
>>>> Gary
>>>>
>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "weewx-user" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to [email protected].
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>> -- 
>>> Peter Quinn
>>> (415)794-2264
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "weewx-user" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>

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

Reply via email to