mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
mqtt2.template: changes to Hoymiles inverter
git-svn-id: https://svn.fhem.de/fhem/trunk@27513 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
d4ac3da2bc
commit
59376b3abf
@ -5572,10 +5572,13 @@ par:INVERTER_NR;INVERTER_NR - order nr. in your setup. Note: numbering starts wi
|
||||
par:RADIO_SINGLE;inverter has just one channel;{ undef }
|
||||
par:RADIO_DOUBLE;inverter has two channels;{ undef }
|
||||
par:RADIO_QUATTRO;inverter has four channels;{ undef }
|
||||
par:ICON;ICON as set, defaults to solar;{ AttrVal('DEVICE','icon','solar') }
|
||||
par:ICON;ICON as set, defaults to measure_photovoltaic_inst;{ AttrVal('DEVICE','icon','measure_photovoltaic_inst') }
|
||||
attr DEVICE icon ICON
|
||||
{ Svn_GetFile('contrib/AttrTemplate/99_attrT_Ahoy_Utils.pm', 'FHEM/99_attrT_Ahoy_Utils.pm', sub(){ CommandReload(undef, '99_attrT_Ahoy_Utils') }) }
|
||||
deletereading -q DEVICE .*_.*
|
||||
attr DEVICE webCmd :
|
||||
option:{ RADIO_SINGLE }
|
||||
attr DEVICE devStateIcon {FHEM::attrT_Ahoy_Utils::devStateIcon($name,1)}
|
||||
attr DEVICE readingList INVERTERLONG_ID/available:.* available\
|
||||
INVERTERLONG_ID/last_success:.* last_success\
|
||||
INVERTERLONG_ID/ch0/U_AC:.* U_AC\
|
||||
@ -5603,6 +5606,7 @@ attr DEVICE readingList INVERTERLONG_ID/available:.* available\
|
||||
INVERTERLONG_ID/ch1/YieldDay:.* YieldDay1\
|
||||
INVERTERLONG_ID/ch1/YieldTotal:.* YieldTotal
|
||||
option:{ RADIO_DOUBLE }
|
||||
attr DEVICE devStateIcon {FHEM::attrT_Ahoy_Utils::devStateIcon($name,2)}
|
||||
attr DEVICE readingList \
|
||||
INVERTERLONG_ID/available:.* available\
|
||||
INVERTERLONG_ID/last_success:.* last_success\
|
||||
@ -5637,6 +5641,7 @@ attr DEVICE readingList \
|
||||
INVERTERLONG_ID/ch2/YieldDay:.* YieldDay2\
|
||||
INVERTERLONG_ID/ch2/YieldTotal:.* YieldTotal2
|
||||
option:{ RADIO_QUATTRO }
|
||||
attr DEVICE devStateIcon {FHEM::attrT_Ahoy_Utils::devStateIcon($name)}
|
||||
attr DEVICE readingList \
|
||||
INVERTERLONG_ID/available:.* available\
|
||||
INVERTERLONG_ID/last_success:.* last_success\
|
||||
@ -5693,7 +5698,7 @@ attr DEVICE setList \
|
||||
limit_pct:slider,2,1,100 BASE_ID/ctrl/limit/INVERTER_NR $EVTPART1
|
||||
attr DEVICE setStateList on off
|
||||
attr DEVICE model hoymiles_microinverter_inverter
|
||||
setreading DEVICE attrTemplateVersion 20230313
|
||||
setreading DEVICE attrTemplateVersion 20230502
|
||||
|
||||
# contributed by tpm88, https://forum.fhem.de/index.php/topic,94495.msg1251265.html#msg1251265
|
||||
name:hoymiles_opendtu_hub_bridge
|
||||
|
85
fhem/contrib/AttrTemplate/99_attrT_Ahoy_Utils.pm
Normal file
85
fhem/contrib/AttrTemplate/99_attrT_Ahoy_Utils.pm
Normal file
@ -0,0 +1,85 @@
|
||||
##############################################
|
||||
# $Id$
|
||||
#
|
||||
|
||||
package FHEM::attrT_Ahoy_Utils; ## no critic 'Package declaration'
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Color;
|
||||
use GPUtils qw(GP_Import);
|
||||
|
||||
## Import der FHEM Funktionen
|
||||
#-- Run before package compilation
|
||||
BEGIN {
|
||||
|
||||
# Import from main context
|
||||
GP_Import(
|
||||
qw(
|
||||
FW_makeImage
|
||||
AttrVal
|
||||
InternalVal
|
||||
ReadingsVal
|
||||
ReadingsNum
|
||||
ReadingsAge
|
||||
defs
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
sub main::attrT_Ahoy_Utils_Initialize { goto &Initialize }
|
||||
|
||||
# initialize ##################################################################
|
||||
sub Initialize {
|
||||
my $hash = shift;
|
||||
return;
|
||||
}
|
||||
|
||||
# Enter you functions below _this_ line.
|
||||
|
||||
sub devStateIcon {
|
||||
my $devname = shift // return;
|
||||
my $panels = shift // 4;
|
||||
my $colors = shift // 0;
|
||||
|
||||
return if !defined $defs{$devname};
|
||||
|
||||
my $ret = ReadingsNum($devname,'available',0);
|
||||
$ret = $ret > 1 ? '10px-kreis-gruen' : isday() ? '10px-kreis-rot' :'10px-kreis-gelb';
|
||||
$ret = FW_makeImage($ret, 'edit_settings');
|
||||
my $col = substr(Color::pahColor(-10,50,70,ReadingsNum($devname,'temperature',0),$colors),0,6);
|
||||
$ret .= FW_makeImage("sani_solar_temp\@$col",'file_unknown@grey');
|
||||
$ret .= ' ';
|
||||
$ret .= ReadingsNum($devname,'temperature',0,1);
|
||||
$ret .= ' °C<br>';
|
||||
$ret .= ReadingsNum($devname,'P_AC',0);
|
||||
$ret .= ' W / ';
|
||||
$ret .= ReadingsNum($devname,'YieldDay',0);
|
||||
$ret .= ' Wh';
|
||||
|
||||
my $total = ReadingsNum($devname,'YieldTotal',0,1);
|
||||
if ( $total > 0 ) {
|
||||
$ret .= ' / ';
|
||||
$ret .= $total;
|
||||
$ret .= ' kWh';
|
||||
}
|
||||
|
||||
for (1..$panels) {
|
||||
$ret .= '<br>';
|
||||
$col = substr(Color::pahColor(0,50,100,ReadingsNum($devname,"Irradiation$_",0),$colors),0,6);
|
||||
$ret .= FW_makeImage("solar\@$col",'file_unknown@grey');
|
||||
$ret .= ' ';
|
||||
$ret .= ReadingsNum($devname,"P_DC$_",0);
|
||||
$ret .= ' W / ';
|
||||
$ret .= ReadingsNum($devname,"YieldDay$_",0);
|
||||
$ret .= ' Wh';
|
||||
$total = ReadingsNum($devname,"YieldTotal$_",0,1);
|
||||
if ( $total > 0 ) {
|
||||
$ret .= ' / ';
|
||||
$ret .= $total;
|
||||
$ret .= ' kWh';
|
||||
}
|
||||
}
|
||||
return qq(<div><p style="text-align:right">$ret</p></div>);
|
||||
}
|
Loading…
Reference in New Issue
Block a user