Which seems to me like the as3935 service isn't adding it to the record? |
Micael,
While watching TV last night (well, trying more like), this whole AS3935 thing was laying on my mind, and after reading the replies to this post, I decided to remove the separate database bindings and do things properly and modify the existing weewx schema. I did this using the weewx documentation which says it all very clearly. This is now running fine.
I am about to read some more and then try to alter the Seasons home page in order that I can see any storm action… I feel then I will be at the same point as you.
Interestingly, I have been running a Davis station using weewx for 4 years now (less this dreaded lighting module), keeping it updated on a regular basis and it has been faultless for all that time. It is a lovely piece of programming…
Let me know if you have any tips.
Dan
import weewx.units
weewx.units.obs_group_dict['avg_distance'] = 'group_distance'
Save extensions.py and then restart WeeWX. WeeWX tags using the avg_distance field should now have correct formatting and unit conversion (note default formats, units and labels for a report are set in either skin.conf or the weewx.conf [StdReport) stanza).
You can read further about adding fields and setting unit groups in the Customization Guide - http://weewx.com/docs/customizing.htm#customizing_units
In this case we were able to assign an appropriate existing unit group, if no suitable unit group existed we would need to create the appropriate unit conversion formulae as well as default labelling and formatting settings.
Gary
Ah, I thought the only issue was with distance. Just as you did for avg_distance you also need to do the same for lightning_strikes. In this case there are no unit conversions that need to be defined (lightning_strikes is just a count so there are no other units to convert to/between) but you do need to give WeeWX the ability to format and label tags using lightning_strikes. This time we want to use group_count, so add something like the following to the bottom of extensions.py:
weewx.units.obs_group_dict['lightning_strikes'] = 'group_count'
Again restart after saving the changes.
Gary
Steve
1. First I got the CJMCU as3935 chip soldered and hooked up to my RPi3B+, connections as follows:
VCC -> 3.3V
GND -> GND
SCL -> PIN 5
MOSI -> PIN 3
SI -> 3.3V
A0 -> 3.3V
A1 -> 3.3V
Connected with a breadborad.
2. In terminal, run "sudo i2cdetect -y 1" to see if the chip is connected, it should show 0x03.
3.Now install http://lancet.mit.edu/mwall/projects/weather/releases/weewx-as3935-0.6.tgz following the instructions.
(I did install another one also but I assume this one is the right one)
4. Open /usr/share/weewx/user/extensions.py in a text editor and add these lines at the bottom of the file:
import schemas.wview
schema_with_lightning_strikes = schemas.wview.schema + [('avg_distance', 'REAL'), ('lightning_strikes', 'REAL')]
import weewx.units
weewx.units.obs_group_dict['avg_distance'] = 'group_distance'
weewx.units.obs_group_dict['lightning_strikes'] = 'group_count'
weewx.units.default_unit_format_dict['count'] = '%.0f'
weewx.units.default_unit_label_dict['count'] = ''
5. My settings in weewx.conf:
[AS3935]
bus = 1
indoors = false # set to True if indoors
noise_floor = 0
calibration = 6
pin = 17
address = 3
binding = archive
Under [Databindings]
[[wx_binding]]
Add this: schema = user.extensions.schema_with_lightning_strikes
And put a # in front of schema = schemas.wview.schema (guess this replace the schema to use the new one.)
6. Stop WeeWX.
7. Make a backup of the weewx database file. Located under: /var/lib/weewx
8.Run sudo wee_database weewx.conf --reconfigure - You will need to specify the full path to weewx.conf (e.g. /home/weewx/weewx.conf or /etc/weewx/weewx.conf)
9. Replace the old database file with the new one.
10. Run sudo wee_database --rebuild-daily
11. Restart WeeWX.
(To add the new observation type I followed:
https://github.com/poblabs/weewx-belchertown/wiki/Adding-a-new-observation-type-to-the-WeeWX-database)
I think this is how I got running, with alot of help from Gary(gjr80)
And maybe this isn't the correct way to make a description, but now it's done!
Please feel free to make any corrections to my descriptions, I'm might have got somethings wrong and maybe forgot some step :)
And remember to backup your database file and maybe your weewx setup before doing any changes!
Let me know if there are some questions and I'll see if I remember something leftout!
//Mikael
Lightning strikes today | 0 | |
Distance (Last strike) | 20 km | 2019-07-21 19:50:00 |
Mikael
--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/ebfec5ef-2c83-415f-afaf-8f02c0f150ce%40googlegroups.com.