These hasn't been modified by me, though:

Jens-Jørgen Kjærgaard
Tuenvej 818
9870 Sindal
+45 21204417
www.jensjk.dk

2018-05-06 8:50 GMT+02:00 Andrew Milner <andrew.s.r.mil...@gmail.com>:

> yes I did indeed!! sorry - user/pond.py we need to see
>
>
>
> On Sunday, 6 May 2018 09:48:57 UTC+3, gjr80 wrote:
>>
>> I think you mean user/pond.py, PondService should be a class in
>> user/pond.py.
>>
>> Gary
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "weewx-user" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/weewx-user/YVAkCwsY2S0/unsubscribe.
> To unsubscribe from this group and all its topics, 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.
import syslog
import weewx
from weewx.wxengine import StdService

class PondService(StdService):
    def __init__(self, engine, config_dict):
        super(PondService, self).__init__(engine, config_dict)      
        d = config_dict.get('PondService', {})
        self.filename = d.get('filename', '/var/tmp/pond.txt')
        syslog.syslog(syslog.LOG_INFO, "pond: using %s" % self.filename)
        self.bind(weewx.NEW_ARCHIVE_RECORD, self.read_file)
    
    def read_file(self, event):
        try:
            with open(self.filename) as f:
                value = f.read()
            syslog.syslog(syslog.LOG_DEBUG, "pond: found value of %s" % value)
            event.record['extraTemp1'] = float(value)
        except Exception, e:
            syslog.syslog(syslog.LOG_ERR, "pond: cannot read value: %s" % e)

Attachment: pond.pyc
Description: application/python-bytecode

Reply via email to