Hi All,

Thanks to Michael to pointing out it was expecting Degrees Fahrenheit in 
this context.

Based on the following comment and my config...

[StdConvert]
    # DO NOT MODIFY THIS VALUE UNLESS YOU KNOW WHAT YOU ARE DOING!
    target_unit = METRIC       # Default is 'US'

Apparently, I don't know what I'm doing so I've just changed my code as 
follows...

roofTempC = float("50") (This will be the Degrees Celsius from the RPi 
measuring the Roof) 
roofTempF = (roofTempC * 1.8) + 32
event.record['extraTemp1'] = roofTempF

Thanks,
Glenn.
On Thursday, 5 October 2023 at 12:53:42 am UTC+11 [email protected] wrote:

> It's a units issue:
> 40°F = 4.4°C
> 50°F = 10°C
> and so on.
>
> Glenn O'Callaghan schrieb am Mittwoch, 4. Oktober 2023 um 15:23:23 UTC+2:
>
>> Hi,
>>
>> I'm using WeeWx V4.4.1 and MySQL V8.0.20 with a Davis Vantage Pro 2 and 
>> have an RPi measuring my roof space Temp and Humidity and am planning to 
>> store the data in extraTemp1 and extraHumid1.
>>
>> I've successfully created a data_service and am simply writing static 
>> values initially as a test. extraHumid1 works (I get the same value I put 
>> in out the end) but when I set extraTemp1 I'm getting strange values when 
>> viewed in MySQL Workbench. 40 becomes 4.4', 50 = 10. 60 = 15.5', 70 = 
>> 21.1', numbers around 30 and below become negatives. But I am yet to see a 
>> pattern or find a reason why. extraTemp2 does the same thing (haven't 
>> tested any other fields, and they all appear to be typed "double").
>>
>> My code is below and any help would be greatly appreciated. I've checked 
>> and there are no StdCalibrate entries in my configuration.
>>
>> Thanks,
>> Glenn.
>>
>> import syslog
>> import weewx
>> from weewx.engine import StdService
>>
>> class AddRoof(StdService):
>>
>>     def __init__(self, engine, config_dict):
>>
>>       # Initialize my superclass first:
>>       super(AddRoof, self).__init__(engine, config_dict)
>>
>>       # Bind to any new archive record events:
>>       self.bind(weewx.NEW_ARCHIVE_RECORD, self.new_archive_record)
>>
>>     def new_archive_record(self, event):
>>
>> roofTemp = float("50")
>> roofHumid = float("9.1")
>>
>> event.record['extraTemp1'] = roofTemp
>> event.record['extraHumid1'] = roofHumid
>>
>> syslog.syslog(syslog.LOG_INFO, "AddRoof: Temperature %s, Humidity %s" % 
>> (roofTemp, roofHumid))
>>
>>

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/9f1e8fd2-b61d-467b-a4cf-27f7fe2b7875n%40googlegroups.com.

Reply via email to