Re: FOSHKplugin
Verfasst: 16 Mär 2023, 21:58
Der Platz für alle wetterbegeisterten Hobbymeteorologen
https://www.wetterstationsforum.info/
Korrekt. Dieser Unix-Timestamp entspricht 16.03.2023 - 21:49:50.Ergebnis: &raspiruntime=1678999790
Guten Morgen Oliver,
Code: Alles auswählen
[Forward-37]
FWD_ENABLE = True
FWD_CMT = Banner-Test Wilfried
FWD_OPTION = bannerconfig=banner-mopped.conf
FWD_URL = ftps://der.entfernte.server/mit/dem/verzeichnis/banner/img/
FWD_INTERVAL =
FWD_IGNORE =
FWD_TYPE = BANNER
FWD_SID = ftpuser
FWD_PWD = ftppassword
FWD_EXEC = ./banner-mopped.sh
Code: Alles auswählen
[Banner]
image_name = banner-mopped.png # filename
image_width = 300
image_height = 115
#image_background = lightyellow # may be transparent, any color, http colorcode (with $ instead of +) or a filename
image_background = Khaki
dtime_format = "%A, %d.%m.%Y %H:%M:%S" # see https://www.w3schools.com/python/python_datetime.asp
#locale_format = "en_US.utf8" # use de_DE.utf8 for German terms in dates (Montag, Mai)
locale_format = "de_DE.UTF-8" # nutze en_US.UTF-8 für englische Wochentags- und Monatsnamen
rounded_corners = True # rounded corners; available for png/gif only, you may specify the radius by n instead of True (default: 10)
#logo_1 = y,x,name,condition # you may specify up to 100 logos, name them logo_2, logo_3, logo_4 ...
logo_1 = 10,230,foshkplugin.png,@lightning_num = 0 # the 4. column may be a condition to embed this logo: @fieldname >= value (e.g. @tempf <= 32)
logo_2 = 10,230,weather_thunderstorm72b.png,@lightning_num > 0
header_font_name = DejaVuSansMono.ttf # if font file is unavailable the font DejaVuSansMono.ttf will be used
header_font_color = black # may be any color name or the http color code (use $ instead of #)
header_font_size = 8 # font size in pixel
header_pre_count = 32 # length of the output value - padded with spaces if necessary
header_dec_count = # default of decimal places - will be rounded
#header_1 = y,key_pos,key,val_pos,value,uni, key_pos,key,val_pos,value,uni, key_pos,key,val_pos,value,uni, key_pos,key,val_pos,value,uni, key_pos,key,val_pos,value,uni
header_1 = 0,130,$datetime,,,,,,,,
custom_font_name = DejaVuSansMono.ttf
custom_font_color = black
custom_font_size = 14
custom_dtime_format = "%d.%m.%Y"
#line_1 = y,key_pos,key,val_pos,value,uni, key_pos,key,val_pos,value,uni, key_pos,key,val_pos,value,uni, key_pos,key,val_pos,value,uni, key_pos,key,val_pos,value,uni
custom_1 = 17,10,Windrun:,140,windrunkm, km,,,,,,,,,,
custom_2 = 32,10,Solarsumme:,140,srsum, W/m²,,,,,,,,,,
custom_3 = 47,10,Server is up,140,server_uptime,,,,,,,,,,,
custom1_font_name = DejaVuSansMono.ttf
custom1_font_color = black
custom1_font_size = 14
custom1_dec_count = 1
custom1_dtime_format = "%H:%M:%S"
custom1_1 = 62,10,since:,140,server_uptime,,,,,,,,,,,
custom1_2 = 77,10,runtime:,140,srv_uptime,,,,,,,,,,,
footer_font_name = DejaVuSansMono.ttf
footer_font_color = black
footer_font_size = 16
footer_1 = 95,10,PWS Hohen Neuendorf\, Germany,,,,,,,,
custom3_font_name = DejaVuSansMono.ttf # just to show the possibilities
custom3_font_color = red
custom3_font_size = 16
custom3_1 = 96,11,PWS Hohen Neuendorf\, Germany,,,,,,,,
special_font_name = DejaVuSansMono.ttf # just to show the possibilities
special_font_color = yellow
special_font_size = 16
special_1 = 97,12,PWS Hohen Neuendorf\, Germany,,,,,,,,
# you may define addituinal font types by custom4 and custom5 - each line then needs the name custom4_n, custom5_n and so on - where n is a unique number from 1-100
Code: Alles auswählen
#!/bin/bash
instr="$@"
# get Raspi runtime as timestamp
server_uptime=$(date -d "$(uptime -s)" +%s)
if [ ! -z "$server_uptime" ]; then srstring=" server_uptime=$server_uptime"; fi
# get Raspi runtime as string
diff=$(($(date +%s) - $(date -d "$(uptime -s)" +%s)))
days=$(($diff / 86400))
srv_uptime=$(date -d@$diff -u "+$days%%20Tage%%20%H:%M:%S")
if [ ! -z "$srv_uptime" ]; then sustring=" srv_uptime=$srv_uptime"; fi
# output added line
echo "in: ${instr}">>banner-mopped.log
echo "out: ${instr}${srstring}${sustring}">>banner-mopped.log
echo "${instr}${srstring}${sustring}"