Connecting MT681 (energy meeter from enbw) to fhem with a esp8266

Begonnen von immi, 30 April 2016, 11:56:40

Vorheriges Thema - Nächstes Thema

immi

Hi Alfons & Christian
probiere folgende version zu verwenden mit folgende file (nicht vergessen fhem neue zu starten

define PowerMeter OBIS 10.0.2.22:1234
attr PowerMeter event-aggregator power:120:linear:mean,total_consumption:300:none:v,total_consumption_Ch1:300:none:v
attr PowerMeter event-on-change-reading .*


die verbindungsprobleme werden behoben: d.h. fhem wird "reconnect" zeigen in log

cs-online

Hallo Alfons,

wie bekommst Du denn denn die anderen Werte ? Ich bekomme nur power und total_consumption, hätte aber auch gerne die Werte wie Spannung und Phasen u.s.w.

Grüße Christian

Hi Immi,

I'll try your file and will Report, if the issue is fixed with it

Greetings Christian
FHEM auf RPI 4 4GB, HM-WLAN-Gateway, einige HM-Aktoren,2x EBUSD an Heizung+Solar, ESP8266 am Strom-,Gas-,Wasserzähler, in WLAN-Steckdosen und Relaisleisten, Sonoff S20, Shelly1,2 und 2.5,Lacrosse-Gateway und Sensoren,Sduino,Alexa-Fhem,Huawei PV mit Speicher, alles auf einem RPI und da geht noch mehr

cs-online

Hi Immi,

if I replace the original-file with yours and send "shutdown restart" to FHEM, I don't get new states, all values freeze. if I copy the old one and restart FHEM, all values run again.... I'm sorry.... my trick with the timer with "defmod..." the OBIS-device runs fine ;-)

Greetings Christian
FHEM auf RPI 4 4GB, HM-WLAN-Gateway, einige HM-Aktoren,2x EBUSD an Heizung+Solar, ESP8266 am Strom-,Gas-,Wasserzähler, in WLAN-Steckdosen und Relaisleisten, Sonoff S20, Shelly1,2 und 2.5,Lacrosse-Gateway und Sensoren,Sduino,Alexa-Fhem,Huawei PV mit Speicher, alles auf einem RPI und da geht noch mehr

AlfAb

Hallo Christian,
ich wohne im Saarland und der dortige Versorger (Energis/VSE) stellt auch die Leistungswerte (gesamt, L1, L2, L2) bereit. Mein Sohn wohnt in der Nähe von Stuttgart (Versorger EnBw) erhält mit gleichem EHZ nur die aktuelle Leistung, nicht aber die Phasen getrennt. Es liegt also am Versorger, welche Daten der Kunde an der optischen Schnittstelle erhält.
Mein MT681 liefert also (in binärer Form) auch die OBIS-Werte: 0100100700FF (P-total), 0100240700FF (P-L1), 0100380700FF (P-L2) und 01004C0700FF (P-L3). Um zu sehen was der MT681 liefert habe ich den Lesekopf über einen Ser-USB-Wandler (CP2104) am PC angeschlossen und mit HTERM ausgelesen. Dann mit Speicherformat "hex" das Logging gespeichert. Die Datei ist dann mit normalem Editor (npp) lesbar.
Gruß
Alfons

immi

Zitat von: cs-online am 24 März 2017, 21:31:45
Hi Immi,
if I replace the original-file with yours and send "shutdown restart" to FHEM, I don't get new states, all values freeze. if I copy the old one and restart FHEM, all values run again.... I'm sorry.... my trick with the timer with "defmod..." the OBIS-device runs fine ;-)
Greetings Christian
Hi Christian,
may I ask you to check again, because it is not plausible.
the only difference in my file is that fhem is sending a carriage return to the meeter every 60 or 120 seconds. Your wrote that you have not connected the tx (like i did), so on the worst  case it should not have any influence.
Can you also please post the config you use with my file?
thanks immi

ps could be that you have not waited enough. With my file you have a standard refresh interval of 120s
you can shorten it with the attribute intervall; e.g. for having a refreshperiod of 15 seconds
attr yourmeetername interval 15

AlfAb

Hallo immi,
der Intervall-Timer bringt tatsächlich nichts. Ich habe das interval auf 15 s gesetzt. Nach "lost connection" dauert es immer ca. 17 Minuten bis FHEM (DevIo-Obis) "lost connection" erkennt und dann sofort ein reconnect durchführt. icinger hat im Obis-Modul den Eintrag bei für den Timer bei "SML" eingetragen. Aber, wie schon gesagt, FHEM erkennt bei einem "write" nicht ob ein Server connected ist.

Hallo Christian,
ich würde gerne Deine Lösung bei mir einbauen, bin aber tatsächlich ein newbie was die Nutzung von FHEM-Funktionen betrifft. Könntest Du mir Deine Lösung zur Verfügung stellen. Gerne auch per E-Mail, wenn solche Sachen im Forum stören.

Grüße
Alfons

immi

Zitat von: AlfAb am 27 März 2017, 23:25:48
Hallo immi,
der Intervall-Timer bringt tatsächlich nichts.
Hi Alfons
have you used my file with intervall 30?
if it is the case, and still you do not see improvements, you should work on your esp8266 firmware. For me works very well with espeasy.
immi

cs-online

Hallo Alfons,

hier meine Timerdefinition, direkt aus der fhem.cfg:

define Stromwerte_Timer at +*00:01:00 {\

my $d3 = ReadingsAge("Stromzaehler","power",0);;\
if ($d3 >= 60) {fhem ("defmod Stromzaehler OBIS 192.168.2.61:23");;;;\
my $d4 = ReadingsVal("Stromzaehler","Anzahl_Neustarts",0);;\
$d4 = $d4 + 1;;\
fhem ("setreading Stromzaehler Anzahl_Neustarts $d4");;;;\
fhem ("setreading Stromzaehler Neustart ".TimeNow());;;;\
}\
#fhem ("set Stromdummy_HH Datenalter: $d3 s");;
}


Da wird also einmal pro Minute drauf geschaut, ob das Alter vom Reading >60s ist, dann wird über defmod die Defnition des OBIS "verändert", tatsächlich wieder mit den selben Parametern gespeichert, dann läuft der sofort wieder los. Wenn Du die # vor dem Stromdummy entfernst, dann wird, bei vorhandenem Stromdummy das Datenalter geschrieben, darauf habe ich ein LOG mit einem Chart

Damit habe ich dann die Werte in Echtzeit und nach spätestens einer Minute auch wieder aktuelle Werte.

@Immi: Is there another way to restart OBIS by Perl ?

Grüße

Christian
FHEM auf RPI 4 4GB, HM-WLAN-Gateway, einige HM-Aktoren,2x EBUSD an Heizung+Solar, ESP8266 am Strom-,Gas-,Wasserzähler, in WLAN-Steckdosen und Relaisleisten, Sonoff S20, Shelly1,2 und 2.5,Lacrosse-Gateway und Sensoren,Sduino,Alexa-Fhem,Huawei PV mit Speicher, alles auf einem RPI und da geht noch mehr

immi

Zitat von: cs-online am 29 März 2017, 08:51:57
@Immi: Is there another way to restart OBIS by Perl ?
yes there are other ways e.g. with doif... but not much better than yours.

Please consider that restarting OBIS every 60 seconds is a pragmatic solution, but not a good one.
The real solution is to restart the IP-connection in obis if lost. The OBIS module should control the connection to the esp8266
Stefan (aka icinger)  has implemented a first fix.
In oder to use it,

update
shutdown restart
define Stromzaehler OBIS 192.168.2.61:23 SML
attr  Stromzaehler interval 15

immi

cs-online

Hi Immi,

I don't restart OBIS every 60s, only if the readingAge is greater than 60s. Restarts about 4-6 times a day. Without "interval" I get power and total_consumption in realtime, Switch something on and I see what power it has... that's nice

greetings Christian
FHEM auf RPI 4 4GB, HM-WLAN-Gateway, einige HM-Aktoren,2x EBUSD an Heizung+Solar, ESP8266 am Strom-,Gas-,Wasserzähler, in WLAN-Steckdosen und Relaisleisten, Sonoff S20, Shelly1,2 und 2.5,Lacrosse-Gateway und Sensoren,Sduino,Alexa-Fhem,Huawei PV mit Speicher, alles auf einem RPI und da geht noch mehr

immi

Zitat von: cs-online am 29 März 2017, 19:27:52
Without "interval" I get power and total_consumption in realtime, Switch something on and I see what power it has... that's nice
for this feature set interval to 1s when you want to monitor in real time.
For the rest of the year
- I use interval 30s
- I store the avarage of power over 2 min.
- I store the energy every 5 min.
- I make some statistics on energy (month, year...)


define PowerMeter OBIS 10.0.2.2:1234 SML
attr PowerMeter event-aggregator power:120:linear:mean,total_consumption:300:none:v,total_consumption_Ch1:300:none:v
attr PowerMeter event-on-change-reading .*
attr PowerMeter interval 30
define PowerMeterLOG FileLog /opt/fhem/log/powerSingle-%Y-%m.log PowerMeter
attr PowerMeterLOG room energy
define SVG_PowerMeter SVG PowerMeterLOG:SVG_PowerMeterLOG_1:CURRENT
attr SVG_PowerMeter  title "TodayEnergy ".ceil($data{sum1}).", MaxPower $data{max1}, CurrentPower $data{currval1}"


define PowerMeterDouble OBIS 10.0.2.2:4321 SML
attr PowerMeterDouble event-aggregator power:120:linear:mean,total_consumption:300:none:v,total_consumption_Ch1:300:none:v,total_consumption_Ch2:300:none:v
attr PowerMeterDouble event-on-change-reading .*
attr PowerMeter interval 30
define PowerMeterDoubleLOG FileLog /opt/fhem/log/powerDouble-%Y-%m.log PowerMeterDouble

define PowerStats statistics PowerM.*
attr deltaReadings total_consumption,total_consumption_Ch1,total_consumption_Ch2
attr ignoreDefaultAssignments 1

cs-online

Hi Immi,

what happens when running the command "get <devicename> update" within the OBIS-Device ? would that be an alternate to the modify command ?
FHEM auf RPI 4 4GB, HM-WLAN-Gateway, einige HM-Aktoren,2x EBUSD an Heizung+Solar, ESP8266 am Strom-,Gas-,Wasserzähler, in WLAN-Steckdosen und Relaisleisten, Sonoff S20, Shelly1,2 und 2.5,Lacrosse-Gateway und Sensoren,Sduino,Alexa-Fhem,Huawei PV mit Speicher, alles auf einem RPI und da geht noch mehr

immi

Zitat von: cs-online am 01 April 2017, 23:35:47
Hi Immi,
what happens when running the command "get <devicename> update" within the OBIS-Device ? would that be an alternate to the modify command ?
no, it does not reopen the interface; some work should be done

cs-online

FHEM auf RPI 4 4GB, HM-WLAN-Gateway, einige HM-Aktoren,2x EBUSD an Heizung+Solar, ESP8266 am Strom-,Gas-,Wasserzähler, in WLAN-Steckdosen und Relaisleisten, Sonoff S20, Shelly1,2 und 2.5,Lacrosse-Gateway und Sensoren,Sduino,Alexa-Fhem,Huawei PV mit Speicher, alles auf einem RPI und da geht noch mehr

jack_1

Danke, hat mir sehr geholfen. :) Funktioniert auch mit Easymeter Q3D.