2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-12 08:41:41 +00:00

70_Pushover: add html handling for glances

git-svn-id: https://svn.fhem.de/fhem/trunk@18779 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2019-03-03 14:37:59 +00:00
parent 9c04c19085
commit 5c0367c6a6

View File

@ -1140,6 +1140,20 @@ sub Pushover_SetMessage2 ($$$$) {
$values{text} = join ' ', @$a;
}
if ( $values{text} =~ /^\s*html:\s*(.*)$/i ) {
Log3 $name, 4, "Pushover $name: Interpreting glance text as HTML";
$values{html} = 1;
$values{text} = $1;
}
if ( $values{text} =~
m/\<(\/|)[biu]\>|\<(\/|)font(.+)\>|\<(\/|)a(.*)\>|\<br\s?\/?\>/i )
{
$values{html} = 1;
# replace \n by <br /> but ignore \\n
$values{text} =~ s/(?<!\\)(\\n)/<br \/>/g;
}
$values{subtext} = ( defined( $h->{subtext} ) ? $h->{subtext} : undef );
$values{count} = ( defined( $h->{count} ) ? $h->{count} : undef );
@ -1579,7 +1593,7 @@ sub Pushover_HttpUri ($$;$) {
The following options may be used to adjust message content and delivery behavior:<br>
<br>
<code><b>title</b>&nbsp;&nbsp;&nbsp;</code> - type: text(100 characters) - A description of the data being shown, such as "Widgets Sold".<br>
<code><b>text</b>&nbsp;&nbsp;&nbsp;&nbsp;</code> - type: text(100 characters) - The main line of data, used on most screens. Using this option takes precedence; non-option text content will be discarded.<br>
<code><b>text</b>&nbsp;&nbsp;&nbsp;&nbsp;</code> - type: text(100 characters) - The main line of data, used on most screens. Using this option takes precedence; non-option text content will be discarded. If you want your text to be interpreted as HTML by the Pushover client app, add the prefix 'html:' before the actual text (unless you already use HTML tags in it where it is automatically detected).<br>
<code><b>subtext</b>&nbsp;</code> - type: text(100 characters) - A second line of data.<br>
<code><b>count</b>&nbsp;&nbsp;&nbsp;</code> - type: integer(may be negative) - Shown on smaller screens; useful for simple counts.<br>
<code><b>percent</b>&nbsp;</code> - type: integer(0-100) - Shown on some screens as a progress bar/circle.<br>