Asystent AI
Sofar 8,8 KTX pobie...
 
Powiadomienia
Wyczyść wszystko

Domoticz Sofar 8,8 KTX pobieranie danych do Domoticza

6 Wpisów
3 Użytkownicy
0 Reactions
2,431 Wyświetleń
(@wiktor_m)
Wpisów: 68
Kontrybutor
Autor tematu
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 
[#3003]

Cześć, mam inwerter Sofar'a wpięty przez WIFI do sieci lokalnej i z dostępem do Internetu. Czy mogę bez dodatkowego sprzętu wrzucić monitorowanie do Domoticza ? Chciałbym odczytywać temperatury, generacje prądu i sterować dodatkowym chłodzeniem aktywnym (zależnie od temp. inwertera).

 

pozdrawiam

Wiktor


 
Dodane : 20/07/2022 10:00 am
(@witekp)
Wpisów: 3
Świeżak
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Takie coś dla siebie zrobiłem dla 6,6KTL-X, nie sądzę aby coś innego było w twoim. Tu tylko to co daje strona http falownika. Trochę przydługi bo rozwiązuje problem padu domoticza (np. po wyłączeniu zasilania). Dodatkowo oszczędzam procesor w okresie braku słońca. Trzeba zainstalować dla debiana biblioteki perla LWP::UserAgent, MIME::Base64, JSON (Sys::Syslog chyba domyślnie w gołym systemie jest). Niestety admin zabronił uploadu plików tekstowych *.pl więc muszę wkleić:

#!/usr/bin/perl
use LWP::UserAgent;
use MIME::Base64;
use JSON;
use Sys::Syslog;

#CONF
my $SCRIPTNAME='GETSOFARFORDOMOTICZ';
my $checksun=0; #if 1 before checking SOFAR checks whether the sun is shining - set 1 by default - for disable set 0
my $checkdomoticzandstart=1; #if 1 before checking SOFAR checks DOMOTICZ (possibly restarts)
my $restartdomoticz="sudo systemctl restart domoticz"; #How you can restart DOMOTICZ
my $usesyslog=1; # if 1 logs problems to the syslog
#DOMOTICZCONF
my $userdomoticz='user'; #Your username in DOMOTICZ
my $passdomoticz='pass'; #Your password in DOMOTICZ
my $urldomoticz=' usunięty link '; #DOMOTICZ URL
my $idx_status=47; #Device IDX for status (text device)
my $idx_energy=49; #Device IDX for Power and Energy
#SOFARCONF:
my $username='usersofar'; #Your username in SOFAR default admin
my $password='passsofar'; #Your password in SOFAR
my $inverter='192.168.1.88'; # Change to your inverter's IP/hostname
##############END OF CONFIG##################################
my $isSUN=0;
my $ua=LWP::UserAgent->new;
$ua->timeout(5);
$userdomoticz = encode_base64($userdomoticz);
$passdomoticz = encode_base64($passdomoticz);
my $usrsaut="username=$userdomoticz&password=$passdomoticz";

if ($checkdomoticzandstart)
{
if (! &checkdomoticz){
&wsyslog('DOMOTICZ is not running, starting.');
`$restartdomoticz`;
sleep(10);
if (! &checkdomoticz){&wsyslog('DOMOTICZ is not running, cannot start.');exit(1);}else{&wsyslog('DOMOTICZ is started, continue.')}
}
}

if ($checksun)
{
my $sendv=$urldomoticz.' usunięty link '&type=command&param=getSunRiseSet';
my $response = $ua->get($sendv);
my $jsonref = decode_json $response->decoded_content;
my $srvtime=&get_time($$jsonref{ServerTime});
if (&daytimestamp($$jsonref{Sunrise})<&daytimestamp($srvtime) && &daytimestamp($$jsonref{Sunset})>&daytimestamp($srvtime)) {$isSUN=1}
}

if ($checksun & (! $isSUN)){
send_status('Offline');
exit (0);
}

# READ DATA FROM SOFAR
my $pol="curl -s --user $username:$password usunięty link ";
my $re=`$pol`;$re=~s/\r\n\r\n/--x--/g;$re=~s/\r\n//g;$re=~s/--x--/\n/g;
my ($re)=($re=~m/var webdata([^\n]+)/);$re='webdata'.$re;$re=~s/var\s|\"//g;
my %TVALS=split /\;|\s*\=\s*/,$re;
if (! $TVALS{cover_ap_mac}){
&send_status('Error while getting data from SOFAR.');
&wsyslog ("Error while getting data from SOFAR.");
exit(1);
}

&send_status('Online');

#WRITE DATA TO DOMOTICZ
#ENERGY AND POWER (in sofar data: webdata_today_e,webdata_now_p)
&wsyslog("Update executed: $TVALS{webdata_today_e}kWh, $TVALS{webdata_now_p}W.");
$TVALS{webdata_today_e}=1000*$TVALS{webdata_today_e};
$sendv=$urldomoticz.' usunięty link '&type=command&param=udevice&idx='.$idx_energy.'&nvalue=0&svalue='."$TVALS{webdata_now_p};$TVALS{webdata_today_e}";
$res=$ua->put($sendv);
unless ($res->is_success) {&wsyslog ($res->status_line)};

#DEBUG DATA FROM SAFO
my $debugdata=0;
if ($debugdata){
foreach my $key (keys %TVALS){print "$key=>$TVALS{$key}\n"}
}

sub get_time{@_[0]=~s/^[^\s]+//;return @_[0];}
sub daytimestamp{my @t=split /\:/,@_[0];return $t[0]*60+$t[1];}
sub wsyslog{if ($usesyslog){openlog($SCRIPTNAME, '', LOG_CRON);syslog("info", @_[0]);closelog();}}
sub checkdomoticz
{
my $ret=0;
my $sendv=$urldomoticz.' usunięty link '&type=command&param=getversion';
my $response = $ua->get($sendv);
if ($response->is_success)
{
my $jsonref = decode_json $response->decoded_content;
if ($$jsonref{status} eq 'OK'){$ret=1;}
}
return $ret;
}
sub send_status
{
my $sendv=$urldomoticz.' usunięty link '&type=command&param=udevice&idx='.$idx_status.'&nvalue=0&svalue='.$_[0];
my $res=$ua->put($sendv);unless ($res->is_success) {&wsyslog ($res->status_line)};
}

 


 
Dodane : 23/09/2022 6:50 pm
(@wiktor_m)
Wpisów: 68
Kontrybutor
Autor tematu
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Witek, dzięki ale ja tego nie ogarnę, mam postawionego domoticza na synology ...


 
Dodane : 25/09/2022 1:51 pm
(@witekp)
Wpisów: 3
Świeżak
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Zerknij na https://www.domoticz.com/forum/viewtopic.php?f=56&t=39112 tam też opublikowałem, dodałem rozszerzenie - instrukcję, bo mnie poproszono. Tam też łatwiej bo administrator pozwala na uploadowanie pików. Jakby co będę od czasu do czasu czytał pocztę google - rzadko z niej korzystam, ale postaram się pomóc.


 
Dodane : 28/09/2022 4:07 pm
(@wiktor_m)
Wpisów: 68
Kontrybutor
Autor tematu
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

OK, w sobotę mam trochę czasu to popatrzę na Twoje opisy - dzięki


 
Dodane : 28/09/2022 7:56 pm
(@kosiarz78)
Wpisów: 10
Bywalec
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Hej czy ten skrypt czyta po wifi? jakie parametry można wyciągnąć skryptem? Jeśli zadziała na moim sofar solar hyd10 to będzie super!!


 
Dodane : 12/03/2023 12:03 pm
Udostępnij: