[weewx-user] Re: OurWeather by SwitchDoc

2020-04-19 Thread Matt Pitts
Hi there, did you ever this working with our weather? 

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/420c4901-abe2-427c-83c6-b74961845500%40googlegroups.com.


[weewx-user] Re: OurWeather by SwitchDoc

2019-12-31 Thread Chester L. Garrett IV
i am getting this when i put the info for the custom driver. see pic below 

[image: WeeWx drivers.jpg]


On Thursday, August 8, 2019 at 9:14:09 AM UTC-5, Chester L. Garrett IV 
wrote:
>
> HI every one,
>
> I am wonder if you can support this hardware or not. I would like to use 
> Weewx to pull data from ourweather using the ip address and using the REST 
> to pull the data. 
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/815d98d1-7b8b-4fff-8f85-5f4a5069b4da%40googlegroups.com.


[weewx-user] Re: OurWeather by SwitchDoc

2019-10-27 Thread Avinash H. Duduskar
Hi mwall,

Thanks for the pointers, I have some Qs.
This is what my JSON looks like at http://192.168.1.9/FullDataString:

{"FullDataString": 
"25.60,89.30,29.42,101926.00,592.16,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,1,2019-10-17
 
18:39:19,NIBM,0,-1,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,V:1,WXLMB
 ,0,,,0,,,0", "id": "1", "name": "OurWeather", "hardware": "esp8266", 
"connected": true}


This station supports Air Quality and Lightning detection sensors which 
I've currently mapped (to ignore) as extraTemp and soilTemp for now.
The trouble from the JSON is multi-part:

   1. After part14 which is dateTime, the user-configured Station Name is 
   sent for which I don't see an option to specify in 
   https://github.com/weewx/weewx/blob/master/bin/schemas/wview.py
   2. Same issue for these bits towards the end of the JSON: V:1,WXLMB 
   ,0,,,0,,,0", "id": "1", "name": "OurWeather", "hardware": "esp8266", 
   "connected": true which I'm happy to ignore as of now.

Here's the output of me trying to troubleshoot it:

$ PYTHONPATH=/home/weewx/bin python2 /home/weewx/bin/user/ourweather.py
Traceback (most recent call last):
  File "/home/weewx/bin/user/ourweather.py", line 65, in 
for packet in driver.genLoopPackets():
  File "/home/weewx/bin/user/ourweather.py", line 23, in genLoopPackets
{"FullDataString": 
"25.60,89.30,29.42,101926.00,592.16,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,1,2019-10-17
 
18:39:19,NIBM,0,-1,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,V:1,WXLMB
 ,0,,,0,,,0", "id": "1", "name": "OurWeather", "hardware": "esp8266", 
"connected": true}
NameError: global name 'true' is not defined


How do I ignore sections of the JSON?
This is what my current ourweather.py looks like, any pointers are 
appreciated - 
https://gist.github.com/Strykar/bd7c77c1229af6c8d5bd7ff551a5c541

P.S. I don't know Python, just some Bash.



Thanks,

AD


On Wednesday, August 14, 2019 at 5:22:01 PM UTC+5:30, mwall wrote:
>
> On Wednesday, August 14, 2019 at 7:25:13 AM UTC-4, Chester L. Garrett IV 
> wrote:
>>
>> Could someone point me in the right direction to get OurWeather by Switch 
>> Doc to work with WeeWx.
>
>
> just write a weewx driver that makes a periodic request for the 
> 'FullDataString' URL.  parse the response and emit it as LOOP data.  that's 
> it!
>
> the code will look something like this (error handling is left as an 
> exercise to the reader :)
>
> put this code into the file ourweather.py in the 'user' directory of your 
> weewx installation:
>
> #!/usr/bin/python
> import urllib2
> import json
> import time
>
> import weewx.drivers
>
> DRIVER_NAME = 'OurWeather'
> DRIVER_VERSION = "0.1"
>
> def loader(config_dict, engine):
> return OurWeatherDriver(**config_dict[DRIVER_NAME])
>
> class OurWeatherDriver(weewx.drivers.AbstractDevice):
>
> def __init__(self, **stn_dict):
> # where to find the data
> self.path = stn_dict.get('host', '192.168.0.10')
> # how often to poll the weather data file, seconds
> self.poll_interval = float(stn_dict.get('poll_interval', 10))
>
> def genLoopPackets(self):
> """request the 'full data string' then parse it.  a 'full data 
> string' looks like this:
> {"FullDataString":
>
> "21.30,36.70,25.63,101714.00,620.44,0.00,0.00,0.00,0.70,0.00,0.00,0.00,0.00,0.00,0.00,0,04/2
> 4/2016 11:56:10,SwitchDoc Labs", "id": "1", "name": "OurWeather", 
> "connected": true}
> """
> while True:
> url = "http://%s/FullDataString' % self.host
> req = urllib2.Request(url=url)
> resp = urllib2.urlopen(req).read()
> resp_json = json.loads(resp)
> parts = resp_json['FullDataString']
> _packet = {
> 'dateTime': int(time.time() + 0.5),
> 'usUnits': weewx.US,
> 'outTemp': parts[0],
> 'outHumidity': parts[1],
> # FIXME: fill in the rest of the data here
> }
> yield _packet
> time.sleep(self.poll_interval)
>
> @property
> def hardware_name(self):
> return "OurWeather"
>
> # To test this driver, run it directly as follows:
> #   PYTHONPATH=/home/weewx/bin python /home/weewx/bin/user/ourweather.py
> if __name__ == "__main__":
> import weeutil.weeutil
> driver = OurWeatherDriver()
> for packet in driver.genLoopPackets():
> print weeutil.weeutil.timestamp_to_string(packet['dateTime']), 
> packet
>
> then add a stanza to your weewx.conf file:
>
> [OurWeather]
> # ip address or hostname of the weather station
> host = 192.168.5.3
> driver = user.ourweather
>
> and tell weewx to use that driver by modifying the 'station_type' field in 
> the 'Station' stanza:
>
> [Station]
> ...
> station_type = OurWeather
>
> you should run weewx directly until you fix the bugs.  that way you will 
> see data immediately.  after you get to that point y

[weewx-user] Re: OurWeather by SwitchDoc

2019-08-14 Thread Chester L. Garrett IV
Thank you I'll get that going


On Wednesday, August 14, 2019 at 6:52:01 AM UTC-5, mwall wrote:
>
> On Wednesday, August 14, 2019 at 7:25:13 AM UTC-4, Chester L. Garrett IV 
> wrote:
>>
>> Could someone point me in the right direction to get OurWeather by Switch 
>> Doc to work with WeeWx.
>
>
> just write a weewx driver that makes a periodic request for the 
> 'FullDataString' URL.  parse the response and emit it as LOOP data.  that's 
> it!
>
> the code will look something like this (error handling is left as an 
> exercise to the reader :)
>
> put this code into the file ourweather.py in the 'user' directory of your 
> weewx installation:
>
> #!/usr/bin/python
> import urllib2
> import json
> import time
>
> import weewx.drivers
>
> DRIVER_NAME = 'OurWeather'
> DRIVER_VERSION = "0.1"
>
> def loader(config_dict, engine):
> return OurWeatherDriver(**config_dict[DRIVER_NAME])
>
> class OurWeatherDriver(weewx.drivers.AbstractDevice):
>
> def __init__(self, **stn_dict):
> # where to find the data
> self.path = stn_dict.get('host', '192.168.0.10')
> # how often to poll the weather data file, seconds
> self.poll_interval = float(stn_dict.get('poll_interval', 10))
>
> def genLoopPackets(self):
> """request the 'full data string' then parse it.  a 'full data 
> string' looks like this:
> {"FullDataString":
>
> "21.30,36.70,25.63,101714.00,620.44,0.00,0.00,0.00,0.70,0.00,0.00,0.00,0.00,0.00,0.00,0,04/2
> 4/2016 11:56:10,SwitchDoc Labs", "id": "1", "name": "OurWeather", 
> "connected": true}
> """
> while True:
> url = "http://%s/FullDataString' % self.host
> req = urllib2.Request(url=url)
> resp = urllib2.urlopen(req).read()
> resp_json = json.loads(resp)
> parts = resp_json['FullDataString']
> _packet = {
> 'dateTime': int(time.time() + 0.5),
> 'usUnits': weewx.US,
> 'outTemp': parts[0],
> 'outHumidity': parts[1],
> # FIXME: fill in the rest of the data here
> }
> yield _packet
> time.sleep(self.poll_interval)
>
> @property
> def hardware_name(self):
> return "OurWeather"
>
> # To test this driver, run it directly as follows:
> #   PYTHONPATH=/home/weewx/bin python /home/weewx/bin/user/ourweather.py
> if __name__ == "__main__":
> import weeutil.weeutil
> driver = OurWeatherDriver()
> for packet in driver.genLoopPackets():
> print weeutil.weeutil.timestamp_to_string(packet['dateTime']), 
> packet
>
> then add a stanza to your weewx.conf file:
>
> [OurWeather]
> # ip address or hostname of the weather station
> host = 192.168.5.3
> driver = user.ourweather
>
> and tell weewx to use that driver by modifying the 'station_type' field in 
> the 'Station' stanza:
>
> [Station]
> ...
> station_type = OurWeather
>
> you should run weewx directly until you fix the bugs.  that way you will 
> see data immediately.  after you get to that point you can run weewx as a 
> service/daemon.
>
> for more details, see the customization guide, or any one of the many, 
> many extensions to weewx that are listed in the wiki.
>
> m
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/cc975a33-0f32-4991-88b5-9336a571d08b%40googlegroups.com.


[weewx-user] Re: OurWeather by SwitchDoc

2019-08-14 Thread mwall
On Wednesday, August 14, 2019 at 7:25:13 AM UTC-4, Chester L. Garrett IV 
wrote:
>
> Could someone point me in the right direction to get OurWeather by Switch 
> Doc to work with WeeWx.


just write a weewx driver that makes a periodic request for the 
'FullDataString' URL.  parse the response and emit it as LOOP data.  that's 
it!

the code will look something like this (error handling is left as an 
exercise to the reader :)

put this code into the file ourweather.py in the 'user' directory of your 
weewx installation:

#!/usr/bin/python
import urllib2
import json
import time

import weewx.drivers

DRIVER_NAME = 'OurWeather'
DRIVER_VERSION = "0.1"

def loader(config_dict, engine):
return OurWeatherDriver(**config_dict[DRIVER_NAME])

class OurWeatherDriver(weewx.drivers.AbstractDevice):

def __init__(self, **stn_dict):
# where to find the data
self.path = stn_dict.get('host', '192.168.0.10')
# how often to poll the weather data file, seconds
self.poll_interval = float(stn_dict.get('poll_interval', 10))

def genLoopPackets(self):
"""request the 'full data string' then parse it.  a 'full data 
string' looks like this:
{"FullDataString":
"21.30,36.70,25.63,101714.00,620.44,0.00,0.00,0.00,0.70,0.00,0.00,0.00,0.00,0.00,0.00,0,04/2
4/2016 11:56:10,SwitchDoc Labs", "id": "1", "name": "OurWeather", 
"connected": true}
"""
while True:
url = "http://%s/FullDataString' % self.host
req = urllib2.Request(url=url)
resp = urllib2.urlopen(req).read()
resp_json = json.loads(resp)
parts = resp_json['FullDataString']
_packet = {
'dateTime': int(time.time() + 0.5),
'usUnits': weewx.US,
'outTemp': parts[0],
'outHumidity': parts[1],
# FIXME: fill in the rest of the data here
}
yield _packet
time.sleep(self.poll_interval)

@property
def hardware_name(self):
return "OurWeather"

# To test this driver, run it directly as follows:
#   PYTHONPATH=/home/weewx/bin python /home/weewx/bin/user/ourweather.py
if __name__ == "__main__":
import weeutil.weeutil
driver = OurWeatherDriver()
for packet in driver.genLoopPackets():
print weeutil.weeutil.timestamp_to_string(packet['dateTime']), 
packet

then add a stanza to your weewx.conf file:

[OurWeather]
# ip address or hostname of the weather station
host = 192.168.5.3
driver = user.ourweather

and tell weewx to use that driver by modifying the 'station_type' field in 
the 'Station' stanza:

[Station]
...
station_type = OurWeather

you should run weewx directly until you fix the bugs.  that way you will 
see data immediately.  after you get to that point you can run weewx as a 
service/daemon.

for more details, see the customization guide, or any one of the many, many 
extensions to weewx that are listed in the wiki.

m

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/d0596216-5893-41bb-880b-a1eff9d281f3%40googlegroups.com.


[weewx-user] Re: OurWeather by SwitchDoc

2019-08-14 Thread Chester L. Garrett IV
Could someone point me in the right direction to get OurWeather by Switch Doc 
to work with WeeWx.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/b409a265-9de3-454c-a7d2-e09e6dc32c84%40googlegroups.com.


[weewx-user] Re: OurWeather by SwitchDoc

2019-08-11 Thread Chester L. Garrett IV
I have attached the info on how the REST works. It depends on how often you 
want to pull the data. It updates underground weather every 5 mins. But if you 
do it locally it depends on how often you want to pull the data.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/c318e873-a9ac-4fb2-957d-4b2ebf2e69d2%40googlegroups.com.


[weewx-user] Re: OurWeather by SwitchDoc

2019-08-08 Thread Pat
A driver could be written to support this, it will just take someone to 
invest some time to write it. It's not difficult but without knowing the 
hardware or the REST data schema there can be challenges. 

weewx operates on a LOOP idea where the weather data is available at 
specific intervals. Typically it's pushed to weewx, but there can be a pull 
method as well (using REST). Do you know what interval the data is 
available at?

On Thursday, August 8, 2019 at 10:14:09 AM UTC-4, Chester L. Garrett IV 
wrote:
>
> HI every one,
>
> I am wonder if you can support this hardware or not. I would like to use 
> Weewx to pull data from ourweather using the ip address and using the REST 
> to pull the data. 
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/aafa024a-b6fd-47a4-a730-ba9499a08d75%40googlegroups.com.