A few things that stand out:

1. Line 25: Typo

2. You can save yourself a database access if you combine
_get_day_max_temp() and _get_day_min_temp() into a function with a single
SELECT statement.

3. The file restx.py has a function to do what you're doing in lines 77 to
86. These lines become:

weewx.restx.get_site_dict(config_dict, 'RainMachine', 'token', 'ip')


This function will also check for logging and the presence of keyword
'enable'. Take a look at it.

4. It is more Pythonic to say

'password' in config_dict['StdRESTful']['RainMachine']


instead of

config_dict['StdRESTful']['RainMachine'].has_key('password')


In fact, in Python 3, the function has_key() has been removed. It is our
plan to migrate to Python 3 over the next year, so it's best to be ready.

5. Line 195-196. You will need to check that 'outTempMin' and 'outTempMax'
are in Metric units. Because they are straight from the database, they may
or may not be.

All in all, nice job! These are small issues. You are clearly "getting" how
RESTful services work in WeeWX.

-tk



On Tue, Oct 2, 2018 at 3:33 AM Nicu Pavel <[email protected]>
wrote:

> Hi,
>
> I created an extension to be used with RainMachine smart irrigation
> controller with source code available here:
> https://github.com/sprinkler/rainmachine-weewx
>
> This is supposed to upload the weather data to RainMachine which in turn
> will use this data to compute the irrigation needs.
>
> At this moment I'm testing with the Simulator as weather station, comments
> would be great as I'm not sure that I got everything right.
>
> Thanks,
> Nicu
>

Reply via email to