Returning from the discusion at
https://groups.google.com/forum/#!topic/weewx-user/CfhGLIF8aaU


On 16 December 2017 at 02:49, mixpc75 <mixp...@gmail.com> wrote:
>
> Glenn,
>
> We're on the right track! I noticed Horacio's message and tried to
implement it in an earlier attempt but maybe I messed it up or maybe - as I
think of it now - it was just a matter of getting
>
> owfs-common_2.9p8-6_all.deb

[...]

Just so we are clear on it - those packages don't apply to your case
anymore. Neither owfs or OWFS are relevant here.

> sudo nano /usr/share/weewx/user/ds18b20.py with Horacio's code
> edited self.filename to show my ds18b20 id
>
> sudo nano /etc/weewx/weewx.conf
> added to [[services]] the line
> data_services = user.ds18b20.ds18b20_Service
> and commented
> #data_services = ,
> to avoid duplication
>
> No ther changes done so [OWFS] section remains the same as well as
[Station] showing station_type = Simulator
>

[OWFS] is redundant - it no longer applies as you are not using the owfs
driver/service. Use wee_extension --uninstall owfs to remove it cleanly
(unless you hand edited back in?). Either way remove it.
Using the Simulator is okay at this stage, you are using it to allow weewx
to start and run.


> The fact is that starting weewx now produces no error!
>
> pi@raspberrypi:~ $ sudo systemctl start weewx.service
>
> pi@raspberrypi:~ $ sudo systemctl status weewx.service
> ● weewx.service - LSB: weewx weather system
>    Loaded: loaded (/etc/init.d/weewx; generated; vendor preset: enabled)
>    Active: active (running) since Fri 2017-12-15 12:23:34 CET; 6s ago

[...]

Yep, while I dislike systemd's logging. Those summaries do show it's
working. :-)


[...]

> As the guideline
> https://github.com/weewx/weewx/wiki/add-sensor
> indicates: "The data will not be displayed on the weather station
console, but they will be displayed in WeeWX reports." So needless to run:
>
> PYTHONPATH=/usr/share/weewx python /usr/share/weewx/user/owfs.py --sensors
> sudo PYTHONPATH=/usr/share/weewx python /usr/share/weewx/user/owfs.py
--sensors

Needless. Yes, these are only of use if you're using mwalls driver with a
1-wire bus master.

>
> So temperature readings are taking place every 5 minutes, great! :) But
they are not being displayed by the webserver 192.16.1.2 which shows the
default weewx webpage:

There are several things - not necessarily in order.

A quick and temporary way to see if the script is returning a value is to
change DEBUG to INFO around line 39 -ish...
            [...]
            syslog.syslog(syslog.LOG_DEBUG, "ds18b20: found value of %s" %
value)
becomes
           # syslog.syslog(syslog.LOG_DEBUG, "ds18b20: found value of %s" %
value)
            syslog.syslog(syslog.LOG_INFO, "ds18b20: found value of %s" %
value)

and run tail -f /var/log/syslog in another terminal. You should see that
message pop up, with a value every 5 minutes.

>From Horacios post...

>> As a result the extraTemp1 value is available in weewx. It is possible
to change the event label in the third line from the bottom of ds18b20.py

You don't want to change the event label until you're more confident with
weewx, but as it is now you should have values being placed into the
database under extraTemp1
If they are there, then it's reading and storing the value. You can then
use them in your reports by configuring your skin.conf and the
index.html.tmpl accordingly.
http://www.weewx.com/docs/customizing.htm#customizing_reports

Also.
>From Horacios ds18b20.py script...
      [...]
        self.bind(weewx.NEW_ARCHIVE_RECORD, self.read_temp)

Shows that they should be showing up in the archive record.

stop weewx and run it directly (
http://www.weewx.com/docs/usersguide.htm#Running_directly ) using...

 /usr/share/weewx/weewxd  /etc/weewx/weewx.conf

You'll see lines starting with LOOP: and REC:  REC is the
NEW_ARCHIVE_RECORD and that's where they should show up. They won't be seen
under LOOP: as the driver doesn't use that - (perhaps it should?)

[...]

> But since it configured as a service, how should weewx.conf be edited so
that it takes values from Horacio's script?

[...]

> But what about this particular case? Editing station_type = DS18B20

Short answer - No.
Long answer: Not sure how you go running one sensor like this. Usually it's
supplementing an exisiting stations data. That's a question for those more
knowledgeable although the documentation has a section showing how to
implement it as a driver :)
http://www.weewx.com/docs/customizing.htm#Implement_the_driver

> and then adding a [DS18B20] tag at the end of the file?
>
> [OWFS]
>         interface = u
>         [[sensor_map]]
>             outTemp = extraTemp1 # variable from
/usr/share/weewx/user/ds18b20.py

Nope. ds18b20.py doesn't use section headings (such as [DS18B20]) so it
won't be looking for any user additions to the weewx.conf file. If it was a
driver in it's own right then you could have and use a [DS18B20] section.

However you may be able to remap extraTemp1 to outTemp ...

extraTemp1 instead of outTemp sensor
https://groups.google.com/forum/#!msg/weewx-user/iHaBv9cceEk/jTjMWCLYCgAJ;context-place=topic/weewx-user/140WrtGfMMs

But that may be adding a whole new level of complexity at this stage. Try
it but I'd work on adding it, as extraTemp1, by customizing the report
first.

>
> I'm a bit lost at this stage but very glad to see how close we are to get
it done :)
>
> Regards,



Cheers
 Glenn

rorpi - read only raspberry pi & various weewx addons
https://github.com/glennmckechnie

There's no more from me below, the rest is context for this post - from the
other thread.

>
>
>
> On 15 December 2017 at 11:45, Glenn McKechnie <glenn.mckech...@gmail.com>
wrote:
>>
>> The first couple of lines at pastebin are revealing...
>>
>> pi@raspberrypi:~ $ python temp_ds18b20.py
>> (21.812, 71.2616)
>> (21.812, 71.2616)
>> ^CTraceback (most recent call last):
>>   File "temp_ds18b20.py", line 30, in <module>
>>     time.sleep(1)
>> KeyboardInterrupt
>>
>> That indicates that you aren't using an owfs compatabile interface (bus
master)
>>
>> http://owfs.org/index.php?page=bus-masters
>>
>> which means that, to my knowledge, running mwalls owfs driver, or any
OWFS software won't help you.
>>
>> I could certainly be wrong but I don't think the GPIO and 1-wire kernel
module (enabled via raspi-config) talk to OWFS.
>>
>> That shouldn't mean that you can't use it with weewx but you need to
approach it differently.
>>
>> You've got a value being returned via your script (is it this
https://github.com/simonmonk/raspberrypi_cookbook_ed2/blob/master/temp_DS18B20.py
?) so you're half way there.  You need to find or write a script that will
enable you to present that data ( temperature value) and have it read by
weewx.
>> The fileparse driver could be a good starting point for the slurp end?
https://github.com/weewx/weewx/tree/master/examples/fileparse with your
script writing the data?
>>
>> Or
>>
>> Perhaps Horacio's work may speed you along.
>>
>> How to add a ds18b20 thermometer to raspberry pi and weewx
>>
https://groups.google.com/forum/#!searchin/weewx-user/ds18b20|sort:date/weewx-user/n1BbF3FAKh8/XxdPovR3AgAJ
>>
>>
>>
>>
>>
>>
>>
>> Cheers
>>  Glenn
>>
>> rorpi - read only raspberry pi & various weewx addons
>> https://github.com/glennmckechnie
>>
>> On 15 December 2017 at 19:55, mixpc75 <mixp...@gmail.com> wrote:
>>>
>>> Glen,
>>>
>>> That is fantastic! :) Clasp, clasp, clasp! :) I thank you for your two
messages, this one and the one in the other thread. I preferred getting
back to topic after trying from my side and let you know. I have not been
as successful as you on mi RP1 and since I think I have folowed the steps
correctly (again, writing a new image to SD, enabling 1-Wire, running a
python script test it etc.). And I am beginning to wonder whether it might
not work on a RPi1 but work successfully on a RPi3... I think I will mirror
your steps in a RPi3 later on today and will get back with output.
>>>
>>> I have made myself sure I have installed your .deb packages
>>>
>>> My package versions matched yours
>>>
>>> pi@raspberrypi:~ $ dpkg --list | grep ow
>>> ii  libow-3.1-5:armhf               3.1p5-1                      armhf
       1-Wire File System full library
>>> ii  owfs-common                     3.1p5-1                      all
       common files used by any of the OWFS programs
>>> ii  python-ow                       3.1p5-1                      armhf
       Dallas 1-wire support: Python bindings
>>>
>>> And we are on the same version weewx-owfs-0.21.tgz as well and, of
course, same weewx version.
>>>
>>> sudo apt-get remove libow-3.1-5 owfs-common python-ow
>>> sudo reboot
>>> sudo dpkg --install owfs-common_2.9p8-6_all.deb (this deb first)
>>> sudo dpkg --install libow-2.9-8_2.9p8-6_armhf.deb
>>> sudo dpkg --install python-ow_2.9p8-6_armhf.deb
>>>
>>> Here is a linked to a bash'ed log with every command issued. The
-sensors commands are towards the botton, of course.
>>> https://pastebin.com/Nkk5Th6V
>>>
>>>
>>> Please, mind I'm running my tests on a RPi1 armv61.



Cheers
 Glenn

rorpi - read only raspberry pi & various weewx addons
https://github.com/glennmckechnie

On 13 December 2017 at 09:23, Glenn McKechnie <glenn.mckech...@gmail.com>
wrote:

> Well, it's a bit of a puzzle
>
> We know you have had it working with owfs.py as your first post shows
> it returning a result when you used the --iface localhost:4304
>
>
> On 12 December 2017 at 23:32, mixpc75 <mixp...@gmail.com> wrote:
> > Dear Glenn,
> >
> [...]
>
> > PYTHONPATH=/usr/share/weewx python /usr/share/weewx/user/owfs.py
> --sensors
> > gives the usual error:
> > Traceback (most recent call last):
> >   File "/usr/share/weewx/user/owfs.py", line 618, in <module>
> >     main()
> >   File "/usr/share/weewx/user/owfs.py", line 578, in main
> >     ow.init(iface)
> >   File "/usr/lib/python2.7/dist-packages/ow/__init__.py", line 224, in
> init
> >     raise exNoController
> > ow.exNoController
>
> you've forgotten to add the --iface string ' --iface localhost:4304 '
> . Add that and see if it works again.
>
> [...]
>
> > PYTHONPATH=/usr/share/weewx python /usr/share/weewx/user/owfs.py --iface
> > localhost:4304 --sensors
> > PYTHONPATH=/usr/share/weewx sudo python /usr/share/weewx/user/owfs.py
> > --iface localhost:4304 --sensors
> > result in the same respective errors as indicated above
>
> Now I'm really confused, because you had it working before with that
> exact same command...
>
> pi@raspberrypi:~ $ sudo PYTHONPATH=/usr/share/weewx python
> /usr/share/weewx/user/owfs.py --iface localhost:4304 --sensors
> 67C6697351FF: /10.67C6697351FF DS18S20
> 4AEC29CDBAAB: /05.4AEC29CDBAAB DS2405
>
> although I note that you've switched sudos positioning.
>
> [...]
>
> > Just to check weewx status I run
> > pi@raspberrypi:~ $ sudo systemctl status weewx.service
> > ● weewx.service - LSB: weewx weather system
> >    Loaded: loaded (/etc/init.d/weewx; generated; vendor preset: enabled)
> >    Active: active (exited) since Tue 2017-12-12 13:20:34 CET; 1min 53s
> ago
> >      Docs: man:systemd-sysv-generator(8)
> >   Process: 249 ExecStart=/etc/init.d/weewx start (code=exited,
> > status=0/SUCCESS)
> >    CGroup: /system.slice/weewx.service
> >
> > Dec 12 13:20:34 raspberrypi weewx[349]: owfs: driver version is 0.21
> > Dec 12 13:20:34 raspberrypi weewx[349]: owfs: interface is localhost:4304
> > Dec 12 13:20:34 raspberrypi weewx[349]: owfs: sensor map is {}
> > Dec 12 13:20:34 raspberrypi weewx[349]: owfs: sensor type map is {}
> > Dec 12 13:20:34 raspberrypi weewx[349]: owfs: polling interval is 10
> > Dec 12 13:20:34 raspberrypi weewx[349]: owfs: sensor unit system is
> metric
> > Dec 12 13:20:39 raspberrypi OWFS[349]: DEFAULT: owlib.c:(52) No valid
> 1-wire
> > buses found
> > Dec 12 13:20:39 raspberrypi OWFS[349]: import of driver failed:  (<class
> > 'ow.exNoController'>)
> > Dec 12 13:20:39 raspberrypi OWFS[349]: engine: Unable to load driver:
> > Dec 12 13:20:39 raspberrypi OWFS[349]:     ****  Exiting...
> >
> > So there it is, the same error. So it seems now there is no way to get
> the
> > --sensors value... I have attached a link to the three config files:
>
> Indeed, it's not working. I wonder if changing to an IP would make a
> difference?
>
> interface = 127.0.0.1:4304
>
> The port 4304 was working before and is the one in the owfs.conf file
> so that should be correct.
> If you run...
> netstat -nlp
> you can check and confirm if it's actually listening there. The
> owfs.py notes suggest 3003 but...?
>
> [...]
>
> In summary
> we know you had it working from the command line
> we know it's at (or was at)  localhost:4304 and that --iface
> localhost:4304  worked
> It appears that - weewx.conf is not accepting that as the interface entry?
>
> I see the other thread has become active and offers further insight ,
> I shall move there - if required!
>
>
> Cheers
>  Glenn
>
> rorpi - read only raspberry pi & various weewx addons
> https://github.com/glennmckechnie
>

-- 
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.

Reply via email to