Metainformationen zur Seite

FOSHKplugin - generic version

Even if the core task of the program is actually the conversion of incoming data from a weather station in WU or Ecowitt format to UDP for any target like Loxone Miniserver, it does offer a few functions that go beyond this.

This plugin connects various weather stations and sensors from the manufacturer Fine Offset Electronics (FOSHK) to a Loxone Miniserver or any other smarthome-system via UDP.
Actually all weather stations are supported where a custom server can be set up as a destination for transmitting the data in WU or Ecowitt format. If you can change or redirect the DNS server for the weather station, it works with any weather station which send it's data to Weather Underground or Ecowitt.
The "custom server" for the GW1000 (or HP2551C or WH2910) is configured remotely by FOSHKplugin itself. For other weather stations you have to configure the custom server via WS View or the manufacturer's configuration program.

Version History...


Features:

  • accepts http messages from a weather station (GW1000, GW1100, GW2000, HP2551, HP2560, WN19x0, DP1500, HP1000SE Pro, Sainlogic 7 in 1, ELV WS980WiFi, Eurochron EFWS 2900, Ambient Weather WS-2902, WS-2000, WS-5000, ???) locally in WU or Ecowitt protocol via network
  • supports custom server on stations from Ambient Weather
  • does not require cloud services or internet connection
  • sends the converted metric or imperial values via UDP to any host or via broadcast in the network
  • is able to feed a MQTT broker
  • connection to any database system possible via telegraf
  • direct support of InfluxDB
  • saves the converted or imperial data sorted and / or extracted as CSV
  • enables forwarding to up to 50 servers that are not supported by the weather station itself (e.g. Awekas, PWSWeather, Windy or Luftdaten.info, but you could also use WU in a different interval)
  • may export incoming data to realtime.txt and clientraw.txt
  • can serve as an Ecowitt relay (forward in Ecowitt protocol) for Personal Weather Tablet, weewx, PWS Dashboard and any other program expecting Ecowitt-data
  • can forward incoming WU and Ecowitt messages via UDP - also as a broadcast - as they come in
  • is able to convert between WU, Ecowitt and Ambient Weather format (within limits)
  • can answer queries in WU protocol
  • Integrated web server provides the last data record in http, UDP, CSV, RAW and JSON format as well as a simple website
  • various watchdogs and warnings can be configured (battery, connection weather station and sensors, storm, thunderstorm, CO2-alert, leakage-alert …)
  • calculates some extra data (dew point, feelslike, AQI, …)
  • allows to gather specific values via http (getvalue)
  • it creates an import file for the automatic import of the data into WSWin
  • provides the Weather4Loxone plugin with the measured values from local weather station
  • No additional software is required (WS View only for teaching new sensors or for configuring the standard forwarding services)
  • also works without Loxone / LoxBerry as a systemd service on Linux-systems (a Raspi should be powerful enough) for connecting other systems ( generic-FOSHKplugin.zip )
  • is free of charge

The target system (e.g. Loxone Miniserver) hardly needs resources with this solution; it does not have to fetch any data or convert values - the plugin automatically sends the already converted data to the Miniserver whenever new measured values arrive from the weather station.
In addition, the measured and partly calculated values are also available to any other services via various interfaces and forwards.

Operation:
FOSHKplugin acts as a web server and returns different values depending on the requested URL.
In addition to "updateweatherstation" to accept a incoming data record in WU format (Weather Underground protocol) the integrated web server processes other http call parameters in GET: http://serverip:port/[URLpath]

URLpath description
/CSVHDR the field names (the header) of the last data record are output as CSV semicolon separated. If units=e is also specified, the fields for the imperial values are output.
/CSV all reported metric values of the last data record are output as CSV semicolon separated (units=e supplies the imperial values)
/SSVHDR the field names (the header) configured in CSV\CSV_FIELDS are output as CSV semicolon separated.
/SSV all reported metric values of the last data record are output as CSV semicolon separated with fixed asignment based on CSV\CSV_FIELDS (units=e supplies the imperial values)
/UDP the last UDP string is output via http; with additional ?status in URL the output will also include all status.
/RAW the data set supplied by the weather station is output unchanged via http; separator can be changed with separator=Z, where Z is a single character
/STRING output the converted data record and the current status separated with ";" via http; by adding units=e in the URL will output with the imp. values; separator can be changed with separator=Z, where Z is a single character. With additional ?status in URL the output will also include all status.
example: http://ipadresse:port/STRING?units=e?separator=, will output imp. values with comma as separator
/JSON output via http as JSON (metric by default; by adding units=e in the URL, the output is made with the imp. values). With additional ?status in URL the output will also include all status (wswarning, sensorwarning, stormwarning, …).
/realtime.txt output a realtime.txt (Cumulus) file
/clientraw.txt output a clientraw.txt (Weather Display) file
/getvalue?key=[keyname] output the value only for given keyname; any keyname is allowed (RAW, converted); if keyname not found "" wil be output - usefull for processing values via curl or wget - if you need bool values like True/False instead of numerical values 1/0 add a &bool to the URL
/ simple website with the current metric data in tabular form - status includes all status-messages; additional units=e shows all values in imperial
/FOSHKplugin/state status of the service; if active: "running"
/FOSHKplugin/status status of the service, watchdog, missing sensor, battery, for storm, thunderstorm, … as a simple webpage
/FOSHKplugin/help help screen with all possibilities to access
/FOSHKplugin/keyhelp shows all available keys known to FOSHKplugin
/FOSHKplugin/debug=enable enable debug mode for extended messages in the log file
/FOSHKplugin/debug=disable disable debug mode for extended messages in the log file
/FOSHKplugin/pushover=enable temporarily enable push notification via Pushover (configuration must exist!)
/FOSHKplugin/pushover=disable temporarily disable push notification via Pushover
/FOSHKplugin/patchW4L "Patch" a Weather4Loxone installation (copy local grabber scripts and activate local retrieval by W4L)
/FOSHKplugin/recoverW4L Restore the original Weather4Loxone configuration before "patching"
/FOSHKplugin/rebootWS reboot the connected weather station (Config\REBOOT_ENABLE has to be True)
/FOSHKplugin/restartPlugin restart the running FISHKplugin service (Config\RESTART_ENABLE has to be True)
/observations/current/json/units=m Feedback of a WU-compatible data record with metric values (°C, kmh, mm, hPa)
/observations/current/json/units=e Feedback of the WU-compatible data record with imperial values (°F, mph, in, inHg)
/w4l/current.dat Feedback of a W4L-compatible current.dat:\\ 1617139459|Tue, 30 Mar 2021 23:24:19 +0200|CET|Europe/Berlin|+0200|Hohen Neuendorf||DE|52.669481|13.266531|53|8.2|8.2|92|Westsüdwest|256|0.0|0.0|8.2|1027.09|7.0||0.00|7.5|0|0.0|0.0||||||||||||||

If you have defined a PASSKEY in config-file to only accept incoming http-request containing this PASSKEY you always have to add something like ?auth=[PASSKEY] to the URL. The only exception is the call of FOSHKplugin/state - this works even without authentication. This is useful if FOSHKplugin should not work in a secure local network but directly on the Internet - for example on a root server. Without this security mechanism, anyone could otherwise submit data or query or change states. Basically, however, I advise against operating on "unsafe" hosts that are freely available on the Internet.

In POST mode, weather station data is accepted in Ecowitt format if the keyword "report" is contained in the URL. Since in Ecowitt format significantly more values can be transmitted from the weather station (such as the battery values of the sensors), I recommend this operating mode (which is also set by the plugin for WS-Set).

Download:
generic-FOSHKplugin.zip (current stable version v0.09)

Installation:
# create a local directory
# sudo mkdir /opt/FOSHKplugin
#
# change into the created directory
# cd /opt/FOSHKplugin
#
# get the current version of the plugin via wget
# wget -N http://foshkplugin.phantasoft.de/files/generic-FOSHKplugin.zip
# or use a local zip-file
#
# unpack ZIP-File
# unzip generic-FOSHKplugin.zip
#
# Allow execute right for generic-FOSHKplugin-install.sh (this script)
# chmod u+x generic-FOSHKplugin-install.sh
#
# Run generic-FOSHKplugin-install.sh (this script)
# sudo ./generic-FOSHKplugin-install.sh –install

Configuration options

metric units - USE_METRIC:
If activated, the values for UDP dispatch and CSV export delivered by the weather station in US units are converted directly by the plugin

skip empty values - IGNORE_EMPTY:
When activated, values -9999 coming from the weather station may not be sent to the target machine via UDP

use Loxone time - LOX_TIME:
This switch determines whether the UTC time should be converted to the Loxone time. When activated, an additional field loxtime is added in Loxone-compatible time format (seconds since 01/01/2009).

optional calculations - EVAL_VALUES:
When activated, the values for dew point, wind chill temperature, heat index and perceived temperature and - if a particulate matter sensor DP200 / WH41 / WH43 is available - the current AQI value and its 24-hour average are calculated from the available measured values and those coming from the weather station Data for export processing (UDP, WU, CSV, W4L, …) added. Values already coming from the weather station may NOT be overwritten. If the storm warning is activated, the air pressure trend and the change in air pressure are also calculated  (for the last hour and for the last 3 hours).

optional elements - ADD_ITEMS:
appends a string with static values to the raw data line coming from the weather station; any existing variable names with the same name are overwritten. Useful to pass on a few fields (such as geolocation: lat / lon / elev or location: neighborhood) via UDP / WU / CSV / W4L etc. These fields go through the entire export processing and therefore appear in all output formats - except RAW-exports of course. This function can also be used to exclude values from the weather station from further processing. To do this, an empty value must be assigned to a variable (ie: &variable3=&variable4=value4) and "skip empty values" must be activated.
Format: &variable1=value1&variable2=value2

Log files:
Are very useful for commissioning and in the event of problems. However, you should consider whether it is really sensible to keep a permanent log. If an SD card is used as the storage medium, the SD card will eventually be written down.
Especially the export log - if a very short interval is set - can quickly become very large, because for every message coming from the weather station - depending on the configuration - an entry for UDP, forwarding (FWD) and CSV is also generated.

To deactivate a specific log file, simply remove the name of the respective file.
From v0.08 on it is possible to switch logging on and off globally via the switch in the config file Logging\LOG_ENABLE = True/False (default: True).

Forwards - Forward-1..50:
There is only one external destination for sending via "Customized Upload" in the configuration of a weather station. Since we are already using this for FOSHKplugin, you can set a forwarding to an additional service (such as Awekas) here. The plugin currently supports 50 forwarding destinations via the config file.

From v0.07 you can enable/disable a Forward through FWD_ENABLE = True/False. In this way, all settings are retained, even if the forward is not currently required. FWD_ENABLE = False completely deactivates this forward until it is activated again with FWD_ENABLE = True.
For your own notes (for example what this forward is actually intended for) there is FWD_CMT, in which any string can be stored permanently after the equal sign.

When specifying the URL, please note that only the measured values are added by the plugin. Any authentications or update commands must therefore already be entered here.
For an upload to Weather Underground (which is of course also possible directly via the weather station), such a line would look like this:

https://rtupdate.wunderground.com/weatherstation/updateweatherstation.php?ID=[meine ID]&PASSWORD=[my password]&action=updateraw&

I successfully tested the delivery to the services Awekas, Windy and PWSWeather:

URL for Awekas:
http://ws.awekas.at/weatherstation/updateweatherstation.php?ID=[awekasid]&PASSWORD=[awekaspassword]&

URL for Windy:
https://stations.windy.com/pws/update/[windyAPIkey]?

URL for PWSWeather:
http://www.pwsweather.com/pwsupdate/pwsupdate.php?ID=[PWS-ID]&PASSWORD=[PWS-Password]&
(shortly: https://pwsupdate.pwsweather.com/api/v1/submitwx?ID=[PWS-ID]&PASSWORD=[PWS-Password]&)

Other WU-compatible services should also work.
If the field remains free, no forwarding takes place.

"FWD_TYPE" defines the format in which the forwarded messages are to be sent to the weather station.
The WU format should be selected for WU-compatible servers. For other scenarios there is also the UDPGET format, in which the possibly converted metric values are sent as with UDP (but not separated by spaces but by html-conforming "&"). Virtual http inputs should be possible with this.
The EW format is experimental. Incoming messages from the weather station are converted into the Ecowitt format and forwarded in the Ecowitt protocol via HTTP mail. This means that other hosts can also be operated using the Ecowitt protocol (relay).
With type RAW, the incoming data is forwarded via http-get without conversion. In order to send the original RAW string via POST without any extension in the EW format, the RAWEW type is recommended. The RAW data can also be sent via UDP via RAWUDP. Destination-ip: destination-port must then be specified as FWD_URL. If you need to send the output data to another destination via UDP you may use the FWD_TYPE UDP. The destination address and port are defined via destination-ip: port as FWD_URL.
The values of an existing particulate matter sensor DP200 / WH41 required for the luftdaten.info service can be sent via type LD:

URL for Luftdaten:
https://api.sensor.community/v1/push-sensor-data/

The sensor ID required for registration must be entered in the config file under FWD_SID. The interval for sending the particulate matter sensor values should be configured to 150 seconds (FWD_INTERVAL = 150 in the config file). In addition to the PM2.5 value, the service also expects the PM10 value (which the DP200 / WH41 particulate matter sensor cannot deliver). Therefore, the plugin sends a dummy value of 1 for PM10.

Overview of the different forward options:

FWD_TYPE input-Format out-Transport out-Format
WU WU, EW, AMB GET Weather Underground (WU–>WU or EW–>WU)
RAW WU, EW, AMB GET like input (WU–>WU or EW–>EW)
UDPGET WU, EW, AMB GET like output to Loxone with header and possibly conversion, however, URL-compatible with "&" instead of spaces
WC WU, EW, AMB GET Weathercloud
MT WU, EW, AMB GET Meteotemplate (API)
AMB WU, EW, AMB GET Ambient Weather
AWEKAS WU, EW, AMB GET Awekas (API)
WETTERCOM WU, EW, AMB GET Wetterarchiv/wetter.com (API)
EW WU, EW, AMB POST enhanced Ecowitt (WU–>EW or EW–>EW)
RAWEW WU, EW, AMB POST untouched Ecowitt (EW–>EW or WU–>EW)
LD WU, EW, AMB POST Luftdaten.info-Format (only PM2.5, PM10, Temp, Humidity, rel. Pressure, abs. Presssure)
CSV WU, EW, AMB POST like output to Loxone with possibly conversion, with semicolon as separator instead of spaces but without header
RAWCSV WU, EW, AMB POST like input (WU–>WU or EW–>EW), with semicolon as separator instead of spaces but without header
WEATHER365 WU, EW, AMB POST weather365.net API
UDP WU, EW, AMB UDP like output to Loxone with header and possibly conversion via UDP (FWD_URL = destination:port)
RAWUDP WU, EW, AMB UDP like input-Format but transmission via UDP (EW→EW via UDP or WU→WU via UDP)
REALTIMETXT WU, EW, AMB various sends a realtime.txt (Cumulus export file) via http(s)/POST or ftp(s) to remote destinations or save the file locally in the filesystem
CLIENTRAWTXT WU, EW, AMB various sends a clientraw.txt (Weather Display export file) via http(s)/POST or ftp(s) to remote destinations or save the file locally in the filesystem
CSVFILE WU, EW, AMB various sends a CSV-file with current data only via http(s)/POST or ftp(s) to remote destinations or save the file locally in the filesystem
TXTFILE WU, EW, AMB various sends a TXT-file with current data only via http(s)/POST or ftp(s) to remote destinations or save the file locally in the filesystem
RAWTEXT WU, EW, AMB various sends a TXT-file with current raw data only via http(s)/POST or ftp(s) to remote destinations or save the file locally in the filesystem
MQTTMET WU, EW, AMB MQTT sends incoming data in metric units to a MQTT-broker
MQTTIMP WU, EW, AMB MQTT sends incoming data in imperial units to a MQTT-broker
WSWIN WU, EW, AMB File saves a WSWin-compatible wswin.csv in the file system, which can be read in automatically by WSWin via file monitoring
INFLUXMET WU, EW, AMB InfluxDB sends metric values to a InfluxDB database
INFLUXIMP WU, EW, AMB InfluxDB sends imperial values to a InfluxDB database

Data fields from the ignore list maintained under "FWD_IGNORE" are not sent for the relevant forward.

With "FWD_INTERVAL" an interval independent of the weather station can be configured (in seconds). If this field is left blank, it will be sent at the weather station's send interval.

Save as CSV:
The measurement results can also be saved as a comma-separated file (CSV). The storage location and the file name are specified under CSV_NAME. The problem with writing to SD cards already mentioned for log files also applies here. If necessary, a more suitable medium (such as NFS) should be selected here.

Field names for CSV - CSV_FIELDS:
All fields desired in the CSV are listed under CSV_FIELDS - separated by a separator (semicolon, comma or space).
Not all fields of a data record are worth saving in the CSV. The contents of the fields SID, PASSKEY, freq or model change very rarely.
By omitting these field names, these fields are excluded from storage. The order of the columns in the CSV file results from the order of the fields specified here.

CSV interval- CSV_INTERVAL:
Here you can define your own time interval for storing a data record in the CSV. If the field remains free, the transmission interval of the weather station is used.

The interval for the CSV and forwarding function cannot be smaller than the set transmission interval of the weather station, since data is only available for further processing when a data record is received from the weather station.

watchdog & warn-functions:

type config description
report watchdog WSDOG_WARNING will warn if weather station did not report within 3 send-intervals (configurable)
sensor warning SENSOR_WARNING will warn if data for mandatory sensor (configurable list of fields e.g. wh65batt) is missed
battery warning BATTERY_WARNING will warn if battery level of all known sensors is critical (pre-defined)
storm warning STORM_WARNING will warn if air pressure rises/drops more than 1.75 hPa/hour or 3.75hPa/3hr with expiry time of 60 minutes (all values configurable)
thunderstorm warning TSTORM_WARNING will warn if lightning sensor WH57/DP60 present, count of lightnings is more than TSTORM_WARNCOUNT and distance is less or equal TSTORM_WARNDIST with expiry time of TSTORM_EXPIRE minutes (all values configurable)
firmware-update warning UPD_CHECK will warn if there's a new firmware for the weather station available
leakage warning LEAK_WARNING will warn if any WH55 reports a leak
CO2 warning CO2_WARNING reports an alarm when a WH45 reports a value above CO2_WARNLEVEL

These warnings are issued - depending on the configuration - in the standard log file, via UDP and via pushover and can be queried via http (?status).

The rules for BATTERY_WARNING are predefined and not adjustable. A warning will be triggered if:
key = [wh65batt, lowbatt, wh26batt, wh25batt] and value = 1
key = batt and length(key) = 5 and value = 1
key = [wh57batt, pm25batt, leakbatt, co2_batt] and value < 2
key = [soilbatt, wh40batt * , wh68batt, tf_batt] and value ⇐ 1.2        * with current hardware revision of WH40 there's no wh40batt at all
key = wh80batt and value < 2.3

and - if recognized as a Ambient Weather station:
isAmbientWeather and (batt in key or batleak in key) and value = 0

Fake-Mode
The values for outside temperature and humidity normally come from either a combination sensor (WH65, WS80) or the dedicated outside sensor WH32.
However, if neither a combination sensor nor a WH32 is available, values of any internal sensor DP50/WH31 (which should of course then be installed outside with appropriate weather protection) can be output as values of the external sensor.
In the config file you have to specify which key should be used for the respective value:

[Export]
OUT_TEMP=temp1f
OUT_HUM=humidity1

# exchange the keyname temp1f with tempf (or use temp2f, temp3f, …)
# exchange the keyname humidity1 with humidity (or use humidity2, humidity3, …)

Within FOSHKplugin, the substring "&temp1f =" is simply replaced by "&tempf =" and "&humidity1 =" by "&humidity =" when the Ecowitt line arrives from the weather station. The values themselves remain.
This setting is global and therefore affects all FOSHKplugin exports/forwards/outputs (except for RAW and RAWEW).
The weather station itself, of course, knows nothing of this - so the services configured there (Ecowitt, WU, WOW, etc.) still have no external values.
If you also want to output the values of the indoor sensor as outdoor sensor values for these services, the services within the weather station must be deactivated and carried out by FOSHKplugin instead.
Corresponding forwards must then be defined in the config file (the square brackets must not be included):

#WU:
[Forward-11]
FWD_INTERVAL = 300
FWD_URL = https://rtupdate.wunderground.com/weatherstation/updateweatherstation.php?ID=[WU-ID]&PASSWORD=[WU-Password]&action=updateraw&
FWD_TYPE = WU
#EW:
[Forward-12]
FWD_INTERVAL = 300
FWD_URL = http://cdnrtpdate.ecowitt.net/data/report/
FWD_TYPE = EW
#Ambient Weather:
[Forward-13]
FWD_TYPE = RAWAMB
FWD_CMT = Forward for Ambient Weather
FWD_URL = https://api.ambientweather.net/endpoint?
FWD_ENABLE = True
FWD_STATUS = False
FWD_INTERVAL = 180
#WOW:
[Forward-14]
FWD_INTERVAL = 300
FWD_URL = http://wow.metoffice.gov.uk/automaticreading?siteid=[siteid]&siteAuthenticationKey=[siteAuthenticationKey]&
FWD_TYPE = WU
#Weathercloud:
[Forward-15]
FWD_INTERVAL = 300
FWD_URL = http://api.weathercloud.net/v01/set?wid=[weathercloudid]&key=[key]&
FWD_TYPE = WC
#Meteotemplate:
[Forward-16]
FWD_INTERVAL = 60         # should be shorter than 5 minutes
FWD_URL = http://192.168.15.100/template/api.php?PASS=[meteotemplatepwd]&
FWD_TYPE = MT
#Awekas-API:
[Forward-17]
FWD_CMT = forward im Awekas-API-Format
FWD_TYPE = AWEKAS
FWD_URL = http://data.awekas.at/eingabe_pruefung.php?
FWD_SID = Awekas-ID
FWD_PWD = Awekas-password
FWD_INTERVAL = 60
FWD_ENABLE = True
#wetter.com-API:
[Forward-18]
FWD_CMT = wetter.com via API
FWD_TYPE = WETTERCOM
FWD_URL = http://interface.wetterarchiv.de/weather
FWD_SID = station-ID
FWD_PWD = station-password
FWD_INTERVAL = 300
FWD_ENABLE = True
#weather365-API:
[Forward-19]
FWD_CMT = weather365 via API
FWD_TYPE = WEATHER365
FWD_URL = https://channel1.weather365.net/stations/index.php
FWD_SID = station-ID
FWD_INTERVAL = 300
FWD_ENABLE = True
#realtime.txt:
[Forward-20]
FWD_CMT = export realtime.txt via ftp
FWD_TYPE = REALTIMETXT
FWD_URLftp://anydomain.de/httpdocs/mydomain.phantasoft.de/upload # use a path name for saving the file in the file system
FWD_SID = ftp-username
FWD_PWD = ftp-password
FWD_INTERVAL = 30
FWD_ENABLE = True
#clientraw.txt:
[Forward-21]
FWD_CMT = export clientraw.txt to filesystem
FWD_TYPE = CLIENTRAWTXT
FWD_URL = /some/path/anyhwere/in/filesystem/
FWD_INTERVAL = 30
FWD_ENABLE = True
#Wettersektor:
[Forward-22]
FWD_CMT = send data to wettersektor.de via POST
FWD_TYPE = WETTERSEKTOR
FWD_URL = http://wettersektor.de/getwett.php
FWD_SID = username
FWD_PWD = password
FWD_INTERVAL = 60
FWD_ENABLE = True
#WSWin-Export
[Forward-23]
FWD_CMT = WSWin forward
FWD_TYPE = WSWIN
FWD_URL = /opt/loxberry/log/plugins/foshkplugin/ # specify only the path here - the file name is always wswin.csv
FWD_INTERVAL = 60
FWD_ENABLE = True
#InfluxDB metric export (use INFLUXIMP for imperial values)
[Forward-24]
FWD_CMT = InfluxDB metric forward
FWD_TYPE = INFLUXMET
FWD_URL = http://server:port@database # use https for SSL connection
FWD_SID = username
FWD_PWD = password
FWD_INTERVAL = 60
FWD_ENABLE = True
#send to Windy in WU format
[Forward-25]
FWD_CMT = Windy
FWD_TYPE = WU
FWD_URL = https://stations.windy.com/pws/update/[windyAPIkey]?
FWD_INTERVAL = 300
FWD_ENABLE = True

Configuration-file:


[Config]
LOX_IP =                        # Loxone-IP or broadcast-address to send data to
LOX_PORT = 12340                # Loxone-Port - port to send data to
LB_IP =                         # Loxberry-IP
LBU_PORT = 12341                # Loxberry-Port - port to receive UDP-datagrams
LBH_PORT =                      # Loxberry-Port - port to receive HTML-in & out
LOX_TIME = True                 # adjust time base to 01.01.2009 (Loxone only)
USE_METRIC = True               # use metric instead of imperial values
IGNORE_EMPTY = True             # do not send -9999 or empty values
UDP_ENABLE = True               # set to False to disable UDP-sending
UDP_IGNORE =                    # comma-separated list of fields to not send via UDP
UDP_MAXLEN =                    # defines the length of a UDP datagram before deviding to several datagrams (default 2000)
UDP_STATRESEND = 0              # cycle sending of warnings via UDP in seconds
LANGUAGE = DE                   # remove or adjust to EN to use english output for wprogtxt and wnowtxt (or NL/SK/FR/ES)
AUTH_PWD =                      # if set, only incoming & outgoing http-requests containing this passphrase will be accepted
DEF_SID =                       # override the default identifier for outgoing UDP datagrams (default: FOSHKweather)
REBOOT_ENABLE = False           # enable remote reboot of weather station via UDP and http (default: False - danger!)
RESTART_ENABLE = False          # enable restarting FOSHKplugin via UDP and http (default: False - danger!)
 
[Weatherstation]
WS_IP =                         # IP-address of weather station
WS_PORT =                       # UDP-port of weather station
WS_INTERVAL = 60                # weather station will send data every n seconds (16..3600)
 
[Export]
EVAL_VALUES = True              # calculate some extra values on base of current data (dew point, windchill, heatIndex, feelsliketemp, AQI, ...)
ADD_ITEMS =                     # additional fixed strings to append to every raw-data-line
OUT_TEMP =                      # fake the temperature-value for outdoor-sensor with value of specific indoor-sensor e.g. temp1f
OUT_HUM =                       # fake the humidity-value for outdoor-sensor with value of specific indoor-sensor e.g. humidity1
OUT_TIME = False                # exchange incoming time string with time of receiving
FIX_LIGHTNING = True            # use last known lightning data as raw data in case of empty values
UDP_MINMAX = True               # send min/max values and their occurence via UDP
 
[Forward]
FWD_ENABLE = True               # to deactivate this forward temporarily just set to False instead of deleting the URL (default: True)
FWD_CMT = This is a permanent comment field for notes on this forward
FWD_URL =                       # URL of destination
FWD_INTERVAL =                  # interval in seconds in which lines will be forwarded
FWD_IGNORE =                    # comma-separated list of fields to not forward
FWD_TYPE =                      # WU/UDP/LD/RAW/EW/RAWEW/RAWUDP/AMB/RAWAMB/WC/MT/AWEKAS/WETTERCOM/WEATHER365/REALTIMETXT/CLIENTRAWTXT/CSVFILE/TXTFILE/WETTERSEKTOR/MQTTMET/MQTTIMP/RAWTEXT
                                # WU: WU-format
                                # UDP: UDP-String will be forwarded (default)
                                # LD: PM2.5 luftdaten.info
                                # EW: Ecowitt-format
                                # RAWEW: Ecowitt untouched
                                # RAW: as input
                                # RAWUDP: RAW via UDP
                                # AMB: Ambient-format
                                # RAWAMB: Ambient untouched
                                # WC: Weathercloud-format
                                # MT: Meteotemplate-format
                                # AWEKAS: Awekas API format
                                # WETTERCOM: wetter.com API format
                                # WEATHER365: weather365.net API format
                                # REALTIMETXT: export as realtime.txt
                                # CLIENTRAWTXT: export as clientraw.txt
                                # CSVFILE: export every single record via http(s)/POST, ftp(s) or save as a file in the filesystem
                                # TXTFILE: export every single record via http(s)/POST, ftp(s) or save as a file in the filesystem
                                # WETTERSEKTOR: Wettersektor-format
                                # MQTTMET: metric values to MQTT
                                # MQTTIMP: imperial values to MQTT
                                # RAWTEXT: export every single imperial record via http(s)/POST, ftp(s) or save as a file in the filesystem
FWD_SID =                       # username for forward if necessary (SensorID for luftdaten.info)
FWD_PWD =                       # password for this forward if necessary
FWD_STATUS = False              # FWD_TYPE=UDP only: if set to True attach current status on each outgoing datagram (default: False)
FWD_MQTTCYCLE = 0               # FWD_TYPE MQTTMET/MQTTIMP only: time in minutes to send the complete record while otherwise only the changes are sent (default: 0 - send everytime the complete record)
FWD_EXEC =                      # external script to be started immediately before sending, last line of the script's output is used as the new outstr for sending
FWD_WARNINT = 10                # threshold of unsuccessful forward attempts before warning
FWD_QUEUE =                     # type of file to save to if forward target can not be connected: NONE, INFLUX, AWEKAS, CMX, EW
FWD_QDIR =                      # dircetory to save the queued file(s)
 
# you additionally can use Forward-1..50
[Forward-1]
FWD_ENABLE = True               # to deactivate this forward temporarily just set to False instead of deleting the URL (default: True)
FWD_CMT = This is a permanent comment field for notes on this forward
FWD_URL =                       # URL of destination
FWD_INTERVAL =                  # interval in seconds in which lines will be forwarded
FWD_IGNORE =                    # comma-separated list of fields to not forward
FWD_TYPE =                      # WU/UDP/LD/RAW/EW/RAWEW/RAWUDP/AMB/RAWAMB/WC/MT/AWEKAS/WETTERCOM/WEATHER365/REALTIMETXT/CLIENTRAWTXT/CSVFILE/TXTFILE/WETTERSEKTOR/MQTTMET/MQTTIMP
FWD_SID =                       # username for forward if necessary (SensorID for luftdaten.info)
FWD_PWD =                       # password for this forward if necessary
FWD_STATUS = False              # FWD_TYPE=UDP only: if set to True attach current status on each outgoing datagram (default: False)
FWD_MQTTCYCLE = 0               # FWD_TYPE MQTTMET/MQTTIMP only: time in minutes to send the complete record while otherwise only the changes are sent (default: 0 - send everytime the complete record)
FWD_EXEC =                      # external script to be started immediately before sending, last line of the script's output is used as the new outstr for sending
FWD_WARNINT = 10                # threshold of unsuccessful forward attempts before warning
FWD_QUEUE =                     # type of file to save to if forward target can not be connected: NONE, INFLUX, AWEKAS, CMX, EW
FWD_QDIR =                      # dircetory to save the queued file(s)
 
[CSV]
CSV_NAME =                      # file name for csv-file (always metric!)
CSV_FIELDS =                    # fields in desired order, separated with ; or ,
CSV_INTERVAL =                  # interval in seconds in which lines are written to the csv-file
CSV_DAYFILE =                   # file name for CSV-dayfile with min/max values of each last day (will be appended every day after midnight)
 
[Warning]
WSDOG_WARNING = True            # warn if weather station did not report data within n send-intervals
WSDOG_INTERVAL = 3              # checking interval for WSDOG_WARNING
WSDOG_RESTART = 0               # automatically restart FOSHKplugin on n send-intervals without data from weatherstation
SENSOR_WARNING = False          # warn on missing sensor data
SENSOR_MANDATORY = wh65batt     # a comma-separated list of all mandatory sensors
BATTERY_WARNING = True          # warn if battery level of known sensors is critical
STORM_WARNING = True            # activate storm warning based on a change in air pressure
STORM_WARNDIFF = 1.75           # change of air pressure in hPa within one hour to get warning state
STORM_WARNDIFF3H = 3.75         # change of air pressure in hPa within three hours to get warning state
STORM_EXPIRE = 60               # minutes, warning will stay active since last over- and under-range indication
TSTORM_WARNING = True           # enable thunderstorm warning (needs WH57 lightning sensor)
TSTORM_WARNCOUNT= 1             # warn if more than n lightnings were detected
TSTORM_WARNDIST = 30            # warn only if lightning is closer than n km
TSTORM_EXPIRE = 15              # minutes, warning will stay active since last lightning
LEAKAGE_WARNING = False         # warn if leakage detected on any WH55
CO2_WARNING = False             # warn if co2 ppm exceeds CO2_WARNLEVEL
CO2_WARNLEVEL = 1000            # ppm threshold to trigger the co2 warning
INTVL_WARNING = False           # warn if receive interval not correspond to send interval
INTVL_PCT = 10                  # percentage value of the max. permissible exceeding of the send interval (default: 10)
REBOOT_WARNING = True           # check if current station runtime < last runtime and warn (log, pushover)
FWD_WARNING = True              # warn after n (defined by FWD_WARNINT) consecutive failed forward attempts (default: true)
FWD_WARNINT = 10                # Number of failed forward attempts until a warning occurs (default: 10)
 
[Logging]
logfile = REPLACEFOSHKPLUGINLOGDIR/log-foshkplugin.log      # default log - all start/stop/warn/error messages
rawfile = REPLACEFOSHKPLUGINLOGDIR/raw-foshkplugin.log      # logs raw messages coming from weather station only
sndfile = REPLACEFOSHKPLUGINLOGDIR/snd-foshkplugin.log      # logs outgoing messages from plugin (CSV, UDP, FWD)
IGNORE_LOG =                    # a comma-separated list of (sub)strings which will prevent logging a line containing these strings in standard-log
BUT_PRINT = True                # respect IGNORE_LOG also for outputs on the console (default: True)
LOG_LEVEL = ALL                 # with each log level fewer messages will be logged: ALL, INFO, WARNING, ERROR - a lower level includes the higher ones
 
[Update]
UPD_CHECK = True                # enable/disable firmware-update-check for weatherstation
UPD_INTERVAL = 86400            # interval in seconds of checking for firmware-updates
 
[Pushover]
PO_ENABLE = False               # enable/disable push notification via Pushover (default: False)
PO_URL =                        # keep empty to use the standard API-URL
PO_TOKEN =                      # generated API-Token from "Your Applications" at Pushover-Dashboard
PO_USER =                       # the user key shown at "Your User Key" at Pushover-Dashboard
 
[Coordinates]
# coordinates are only needed for calculating cloudbase or export to Awekas-API, clientraw.txt, Weather365.net
ALT =                           # altitude in m e.g. 53
LAT =                           # latitude in dec. grad e.g. 52.668759; North of the equator has no sign. South of the equator has a - sign.
LON =                           # longitude in dec. grad e.g. 13.266274; for longitudes left of Greenwich a - sign is needed. 
 
[Sunduration]
SUN_CALC = False                # enable for better sunhours calculation (LAT, LON needed), disable to use static threshold of 120W/m²
SUN_MIN = 0                     # from this value (W/m²) calculation starts
SUN_COEF = 0.8                  # adjustment factor also depends on the location
SUNSHINE_HOLD = 0               # Hold time in seconds for value sunshine, this time continues to be output sunshine = True, even if there is no sunshine (default: 0)


Attention!
After changes in the [Weatherstation] area, the new settings must be transferred to the weather station!
By calling ./foshkplugin.py -writeWSconfig, the weather station-specific values from config file are transmitted to the weather station and activated.

datapoints:
The names of the outgoing data points depend on the selected output system (metric or imperial). If USE_METRIC is active, the following data points are output to all configured exports (but not for format-specific forwards):

for Gateway DP1500/GW1000:
humidityin
tempinc


soil moisture sensors DP100/WH51:
soilbatt1..8 (battery in volt)
soilmoisture1..8


for Multi-Temp/Hum-sensors DP50/WH31:
batt1..8 (battery-Status; 1 = Alarm, 0 = ok)
humidity1..8
temp1..8c


for PM-sensors DP200/WH41/WH43:
pm25_avg_24h_ch1..4
pm25_ch1..4
pm25batt1..4 (Battery-Status; 5 = max)
pm25_AQI_ch1..4
pm25_AQI_avg_24h_ch1..4
pm25_AQIlvl_ch1..4 (Level 1..6)
pm25_AQIlvl_avg_24h_ch1..4 (Level 1..6)


Status/Activity/Tracker:
running (1 = startet, 0 = stopped)
loxtime (Loxone-time)
wswarning (weather station does not send data)
sensorwarning (mandatory sensor is missing)
batterywarning (Battery-warning)
stormwarning (Stormwarning)
tswarning (Thunderstorm-warning)
updatewarning (Firmware-update available)
leakwarning (Leakage present)


for lightning sensor WH57/DP60:
lightning (distance last lightning in km)
lightning_time (time of last lightning Unixtime)
lightning_loxtime (time of last lightning Loxone-time)
lightning_num (count of lightnings)
wh57batt (Battery-Status; 5 = max)


for soil/water-temp-sensor WN34:
tf_chNc (temperature in °C; N=1..8)
tf_battN (battery; N=1..8)
for water sensor WH55:
leak_ch1..4 (1=Alarm, 0=ok)
leakbatt1..4 (Battery-Status; 5 = max)


for 2- or 3-wing outdoor sensor WH3000SE All-In-One or HP1000SE All-In-One (WH65):
baromabshpa (abs. air pressure in hPa)
baromhpa
baromrelhpa
dailyrainmm
dewptc
eventrainmm
feelslikec
heatindexc
hourlyrainmm
monthlyrainmm
humidity
loxtime
maxdailygust
rainratemm
solarradiation
tempc
totalrainmm
uv
weeklyrainmm
wh65batt (1 for warning, 0=ok)
windchillc
winddir
windgustkmh
windspeedkmh
yearlyrainmm
ptrend1 (air pressure-trend 1h: 2=rapid rising,1=rising, 0=equal,-1=falling,-2 rapid falling)
pchange1 (air pressure change in 1h in hPa)
ptrend3 (air pressure-trend 3h: 2=rapid rising,1=rising, 0=equal,-1=falling,-2 rapid falling)
pchange3 (air pressure change in 3h in hPa)
wproglvl (weather prognose level)
wprogtxt (weather prognose text)
wnowlvl (current weather level)
wnowtxt (current weather text)


As output via UDP you will get this:

SID=FOSHKweather dateutc=2020-06-01+13:35:54 loxtime=360257754 tempinc=27.0 humidityin=30 baromrelhpa=1022.59 baromabshpa=1017.51 tempc=25.1 humidity=30 winddir=273 windspeedkmh=1.43 windgustkmh=7.19 maxdailygust=18.36 solarradiation=677.62 uv=5 rainratemm=0.0 eventrainmm=0.0 hourlyrainmm=0.0 dailyrainmm=0.0 weeklyrainmm=0.0 monthlyrainmm=0.0 yearlyrainmm=206.4 totalrainmm=206.4 temp2c=23.3 humidity2=40 temp3c=24.8 humidity3=34 soilmoisture1=34 soilmoisture2=37 soilmoisture3=41 soilmoisture4=52 pm25_ch1=11.0 pm25_avg_24h_ch1=9.8 lightning_num=0 leak_ch1=0 wh65batt=0 batt2=0 batt3=0 soilbatt1=1.6 soilbatt2=1.6 soilbatt3=1.9 soilbatt4=1.9 pm25batt1=5 wh57batt=5 leakbatt1=5 dewptc=6.3 windchillc=25.1 feelslikec=25.1 heatindexc=24.4 pm25_AQI_ch1=46 pm25_AQIlvl_ch1=1 pm25_AQI_avg_24h_ch1=41 pm25_AQIlvl_avg_24h_ch1=1 ptrend1=-1 pchange1=-0.3 wnowlvl=3 wnowtxt=sonnig ptrend3=-1 pchange3=-1.42 wproglvl=3 wprogtxt="baldiger Regen"

where you can easily pickup the required fields for further processing.
Activity and Tracker messages are event-based but also include the SID-token to state these messages are coming from FOSHKplugin:

SID=FOSHKweather stormwarning=1 time=351042104
SID=FOSHKweather stormwarning=0 time=351042135
SID=FOSHKweather tswarning=1 time=359550337
SID=FOSHKweather tswarning=0 time=359551236 start=359550337 end=359551236 last=359550330
SID=FOSHKweather wswarning=1 last=360086463 time=360086560
SID=FOSHKweather wswarning=0 last=360086567 time=360086590
SID=FOSHKweather sensorwarning=1 missed=pm25batt1 time=360169470
SID=FOSHKweather sensorwarning=0 back=pm25batt1 time=360170059

If LOX_TIME is deactivated, the Unixtime appears for all the given times instead of Loxone-time.

There are a some datapoints through which the plugin can be controlled via UDP:

System.reboot restart the GW1000/DP1500
Plugin.shutdown shutdown FOSHKplugin - if started as a system service (systemd) it will be restarted some seconds later
Plugin.getstatus requests the current status values from the plugin (running, wswarning, sensorwarning, …)
Plugin.debug=enable enable debug mode for some more information in log file
Plugin.debug=disable disable debug mode

By sending a string "SID=FOSHKplugin,System.reboot" the plugin causes the GW1000 to restart. If you send the string "SID=FOSHKplugin,Plugin.getstatus", the plugin replies with the current status values for wswarning, sensorwarning, stormwarning, …

legal notice:
I do not assume any guarantees regarding the use of this software - use is at your own risk.
Never make decisions that can lead to personal injury or property damage on the basis of this software.
Warnings generated by the program (e.g. storm or thunderstorm) may occur. However, the absence of these warnings does not imply that these things are not possible.

There is a more extensive documentation, although more Loxone-specific and currently in german only: https://foshkplugin.phantasoft.de/
However, the Google translator should be helpful: https://wiki-loxberry-de.translate.goog/plugins/foshkplugin/start?_x_tr_sl=de&_x_tr_tl=en&_x_tr_hl=de&_x_tr_pto=wapp

Recipes:

change sending interval to a shorter interval than 16 seconds


redistribute the Ecowitt stream of a GW1000 to several weewx


Saving or further processing of incoming data sets (set-wise)


Forwarding of the station data to an MQTT broker


Sending FOSHKplugin data to a MQTT-server (deprecated)


Installation of FOSHKplugin generic version for several PWT instances


Updating a current FOSHKplugin generic installation


get push notifications for critical status changes on the smartphone/tablet


Operation of multiple FOSHKplugin instances on one host


Upload to Ambient Weather


Set up a forward to PWSDashboard


Saving lightning values for the GW1000/DP1500 (WH2650/WH2600Pro)


modify outgoing data line (exec)


Export of a Cumulus export file realtime.txt or clientraw.txt (Weather Display)


Saving of daily values in a separate CSV file


Exporting the weather data to WSWin


Restarting FOSHKplugin after configuration changes


Supplying a database with data from the weather station (pull method)


native connection to an InfluxDB database (push method)


Log file handling


Submit station data to any number of Personal Weather Tablet (PWT) instances with ONE forward


Remapping keys/values (from v0.09)


Sending weather station data via APRS/CWOP (from v0.09)


Push notifications when limit values are fallen below or exceeded (getvalue)


problem solving


Set up a forward to CumulusMX (CMX)


be warned in case of failed forwards (from v0.10)


Adjust the output format for date and time (from v0.10)


get help from FOSHKplugin


store missed forwards and transfer them when the forward destination is available again (from v0.10)


scan all weather stations in your network (from v0.10)

2bc …