Olivier,
1. Use of JSON/XML
Why not a database or MQTT? Reason = 'history of System-concept'
Within my configuration I have a structure in which from various sources a
set of JSON/XML-files is uploaded to a 'Central server', and all users can
pick as they like:
*some* of these files are 'public' and used by external applications for
remote access to (a piece of) my actual data.
Obvious then try to fit HP3001 in that structure.
;-) Although sure I should modernize (in parallel to the 'production') in
the direction of MQTT etc.
2. 'Misuse' of WeeWX
My 2 PWSes (WS7000 + TFA_Nexus) have directly related software taking the
interfaces of the sensors and applying the data for various purposes.
However, those 2 PWSes have weak elements. In my configuration also an
amount of other sensors feeding to Domoticz.
Some of the weaknesses can be remedied by feeding alternative data from
Domoticz, but the software mentioned above only allows limited 'correction'.
Therefore the idea to make with help of WeeWX-elements ;-) the '3rd &
perfect PWS' compiled from the best dataset available in my configuration.
Meanwhile have inserted and tested some 'plugins' in the
WS3000-readerscript in the vicinity of lines 380 ~ 390, for orientation in
the following script-segment some existing lines before and aft the
insertion.
Result is generation of a JSON-file and an XML-file put in folder /home/pi
>From there an FTP-function (to be choosen by the User) picks the files and
processes them for further applications, such as the upload to the
mentioned 'Central Server'.
Geef de code hier op...
# Read datasets for new_packet
nberrors = 0
while nberrors < self.max_tries:
# Get a stream of raw packets, then convert them
try:
read_sensors_command = self.COMMANDS['sensor_values']
raw_data = self._get_raw_data(read_sensors_command)
# Convert data sets for new_packet
if not raw_data: # empty record
raise IOError("Failed to get any data from the station")
formatted_data = self._raw_to_data(raw_data,
read_sensors_command)
logdbg('data: %s' % formatted_data)
new_packet = self._data_to_wxpacket(formatted_data)
logdbg('packet: %s' % new_packet)
# Make JSON-file
with open('/home/pi/HP3001_data.json', 'w') as outfile:
json.dump(formatted_data, outfile)
# Make XML-file
HP3001_xml = dicttoxml.dicttoxml(new_packet, attr_type=False
)
xml_output = open("/home/pi/HP3001_data.xml",'w')
xml_output.write(HP3001_xml)
xml_output.close()
# End of JSON/XML-Compilation
return new_packet
Op zondag 16 februari 2020 17:48:05 UTC+1 schreef Olivier Guyotot:
>
> ok, in fact I am getting very confused by what you are trying to do. Why
> do you want to mis-use weewx? And why use XML or JSON files, rather than a
> database?
> And if the goal is to integrate the WS-3000 with Domoticz, can't this be
> done directly (by writing a plugin or add-on to Domoticz)?
>
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/weewx-user/2ce4e57f-0795-411f-8bf9-df9215ba2199%40googlegroups.com.