My attempts so far:
class ds18b20(StdService):
def __init__(self, engine, config_dict):
super(ds18b20, self).__init__(engine, config_dict)
d = config_dict.get('PondService', {})
url = "http://192.168.0.70"
self.filename = d.get('filename', 'urllib2.urlopen(url)')#.read()
#self.filename = d.get('filename',
'/home/weewx/public_html/data/ds18b20.txt')
#self.filename =
d.get(urllib2.urlopen("http://192.168.0.70/").readlines())
#self.filename =
d.get(urllib2.urlopen("http://192.168.0.70").read())
#self.filename = d.get('filename','http://192.168.0.70')
#response = urllib2.urlopen('http://192.168.0.70/')
#self.filename = d.get(response.read())
#self.filename =
urllib2.request.urlopen("http://192.168.0.70").read()
syslog.syslog(syslog.LOG_INFO, "ds18b20: using %s" % self.filename)
self.bind(weewx.NEW_ARCHIVE_RECORD, self.read_file)
not working right now :(
no such file or directory
Am Montag, 22. Januar 2018 07:14:07 UTC+1 schrieb Andreas Landixus:
>
> Yes i am on it. But i am a bad coder, it is more try and error.
> I need help from the pros here :)
>
> Am Montag, 22. Januar 2018 02:11:29 UTC+1 schrieb Ralph Underwood:
>>
>> I am interested in your progress. I have a esp8266 on my work bench -
>> haven't got started with it yet. I was looking for options use wifi with my
>> OWFS based system. I use the file parse driver to add data connected to
>> RPi.
>>
>>
>>
>> On Sunday, January 21, 2018 at 10:42:47 AM UTC-8, Andreas Otten wrote:
>>>
>>> hmm not working how i want it.
>>>
>>> can someone tell me how to read values from a ip adress?
>>>
>>> I have on 192.168.0.70 my data comma separated and i want to read the
>>> values with:
>>>
>>> import syslog
>>> import requests
>>> import weewx
>>> from weewx.wxengine import StdService
>>>
>>> class ds18b20(StdService):
>>> def __init__(self, engine, config_dict):
>>> super(ds18b20, self).__init__(engine, config_dict)
>>> d = config_dict.get('PondService', {})
>>> #self.filename = d.get('filename',
>>> '/home/weewx/public_html/data/ds18b20.txt')
>>> #self.filename = d.get('filename', 'urllib2.urlopen("
>>> http://192.168.0.70").read()')
>>> # link = "http://192.168.0.70"
>>> syslog.syslog(syslog.LOG_INFO, "ds18b20: 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()
>>> line = f.readline()
>>> value = line.split(',')
>>> syslog.syslog(syslog.LOG_DEBUG, "ds18b20: found value of %s"
>>> % value)
>>> event.record['soilTemp1'] = float(value[0])
>>> event.record['soilTemp2'] = float(value[1])
>>> event.record['soilTemp3'] = float(value[2])
>>> event.record['soilTemp4'] = float(value[3])
>>> except Exception, e:
>>> syslog.syslog(syslog.LOG_ERR, "ds18b20: cannot read value:
>>> %s" % e)
>>>
>>> i fail here. What is the line to read from URL? my both attempts are
>>> faulty :(
>>>
>>>
>>>
>>> Am Samstag, 20. Januar 2018 20:31:25 UTC+1 schrieb Andreas Otten:
>>>>
>>>> Before i invent the wheel new :)
>>>>
>>>> anybody have a *ino file with a http post to write the values in a file
>>>> from multiple ds18b20 sensors ?
>>>>
>>>> I have the weewx functions ready, but not the ino file for the esp8266
>>>>
>>>> if yes, i am happy when you share it :)
>>>>
>>>> if not i made one :)
>>>>
>>>
--
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.