FHEM Forum

FHEM => Anfängerfragen => Thema gestartet von: docb am 20 Juni 2013, 10:53:45

Titel: Problem beim Aufräumen, fhem.cfg schimpft beim speichern
Beitrag von: docb am 20 Juni 2013, 10:53:45
Hallo mal wieder,
ich habe ein kleines Problem beim Aufräumen meiner fhem.cfg. Ich habe die knapp 1000 Zeilen in mehrere Dateien ausgelagert und bekomme immer den Fehler:

at_BA_Jal_hoch already defined, delete it first at_Hitzebeschattung already defined, delete it first

Ich kann mir nicht erklären woher das kommt. Auch wenn ich einen delte ausführe, kann ich zwar 1x wieder ohne diese Fehlermeldung speichern, aber beim nächsten mal kommt sie wieder. Ich komme einfach nicht dahinter. Ich poste mal meine fhem.cfg und auto.conf in der Hoffnung, dass jemand den Fehler entdecken kann:

fhem.cfg:

attr global autoload_undefined_devices 1
attr global holiday2we bayern
attr global latitude 48.115740
attr global logfile ./log/fhem-%Y-%m.log
attr global longitude 11.737120
attr global modpath .
attr global motd none
attr global statefile ./log/fhem.save
attr global uniqueID ./FHEM/FhemUtils/uniqueID
attr global userattr devStateIcon devStateStyle icon sortby webCmd
attr global verbose 3
attr global room Z_System
### für detaillierte Protokollierung:
#attr global mseclog 1
#attr global verbose 1
#attr LANInterface loglevel 1

###############
#Original
############################################

define telnetPort telnet 7072 global
attr telnetPort room Z_System

#unterdrückt die Warnmeldung Security check

define WEB FHEMWEB 8083 global
attr WEB stylesheetPrefix dark
attr WEB room Z_System

define WEBphone FHEMWEB 8084 global
attr WEBphone stylesheetPrefix smallscreen
attr WEBphone room Z_System

define WEBtablet FHEMWEB 8085 global
attr WEBtablet stylesheetPrefix touchpad
attr WEBtablet room Z_System

# Fake FileLog entry, to access the fhem log from FHEMWEB
define Logfile FileLog ./log/fhem-%Y-%m.log fakelog
attr Logfile room Z_Logfiles

define autocreate autocreate
attr autocreate autosave 1
attr autocreate device_room %TYPE
attr autocreate filelog ./log/%NAME-%Y.log
attr autocreate weblink 1
attr autocreate weblink_room Plots
attr autocreate room Z_System

# Disable this to avoid looking for new USB devices on startup
#define initialUsbCheck notify global:INITIALIZED usb create


# If the above notify did not helped, then you probably have to enable some of
# the following lines.  Verify first that /dev/xxx ist correct.

#define FHZ FHZ /dev/USB0
#define CUL CUL /dev/ttyACM0@9600 1234
#attr CUL rfmode HomeMatic

#define EUL TCM 310 /dev/ttyACM0@57600
#define BscBor TCM 120 /dev/ttyUSB0@9600
#define BscSmartConnect TCM 310 /dev/ttyUSB0@57600
#attr WEB basicAuth {use FritzBoxUtils;;FB_checkPw("localhost","$password") }
#attr WEBphone basicAuth {use FritzBoxUtils;;FB_checkPw("localhost","$password") }
#attr WEBtablet basicAuth {use FritzBoxUtils;;FB_checkPw("localhost","$password") }
#attr telnetPort password {use FritzBoxUtils;;FB_checkPw("localhost","$password") }

###############
#Eigene
############################################

############

define bayern holiday
attr bayern room Z_System

############


##### Includes
include ./BB/devices.conf
include ./BB/auto.conf
include ./BB/notify.conf
include ./BB/test.conf
#include ./BB/watchdog.conf



auto.conf:

###################################
### Automatisierung
###################################

#Rolladen Runter
define at_BA_Jal_runter at *{sunset(-1300,"17:00","21:45")} set BA_Jal Runter;; set TagNacht off
attr at_BA_Jal_runter room Z_Automatisierung
define at_WZKU_Jal_runter at *{sunset(-1100,"17:00","21:45")} set WZ_Jal_Links,WZ_Jal_Mitte,KU_Jal_Rechts,SZ_Jal_Rechts Runter;; set TagNacht off
attr at_WZKU_Jal_runter room Z_Automatisierung
define at_WZKU_Jal_40_runter at *{sunset(-1100,"17:00","21:45")} set WZ_Jal_Rechts 60;; set TagNacht off
attr at_WZKU_Jal_40_runter room Z_Automatisierung
define at_SZ_Jal_runter at *{sunset(-1100,"17:00","21:45")} set SZ_Jal_Rechts Runter;; set SZ_Jal_Links 30;; set TagNacht on
attr at_SZ_Jal_runter room Z_Automatisierung

#Rolladen Hoch
define at_WZKU_Jal_hoch at *{sunrise(+1100,"06:00","08:30")} set WZ_Jal_Links,WZ_Jal_Mitte,WZ_Jal_Rechts,KU_Jal_Links,KU_Jal_Rechts Hoch;; set TagNacht on
attr at_WZKU_Jal_hoch room Z_Automatisierung
define at_BA_Jal_hoch at 09:00:00 set BA_Jal Hoch;; set TagNacht on
attr at_BA_Jal_hoch room Z_Automatisierung
define at_KZ_Jal_hoch at *08:00 set KZ_Jal Hoch;; set TagNacht on
attr at_KZ_Jal_hoch room Z_Automatisierung
define at_SZ_Jal_hoch at *10:00 set SZ_Jal_Rechts, SZ_Jal_Links on;; set TagNacht on
attr at_SZ_Jal_hoch room Z_Automatisierung

#Hitzebeschattung
define at_Hitzebeschattung at 09:30:00 { Hitzebeschattung() }
attr at_Hitzebeschattung room Z_Automatisierung

#Updatecheck
define at_CheckUpdatesAvailable at +*12:00:00 {\
my $a = `wget -qO - http://fhem.de/fhemupdate4/svn/controls_fhem.txt | cat - FHEM/controls_fhem.txt | sort | uniq -u | cut -d " " -f 4 | uniq`."-";;\
fhem ("set UpdatesAvailable $a");;\
}
attr at_CheckUpdatesAvailable room Z_Automatisierung



Sonst sind die beiden at in keinem anderen File erwähnt.

Viele Grüße
doc
Titel: Aw: Problem beim Aufräumen, fhem.cfg schimpft beim speichern
Beitrag von: Puschel74 am 20 Juni 2013, 11:09:45
Hallo,

wenn du das delete ausführst werden die zugehörigen at gelöscht.
Das speichern nach dem delete muss zwangsläufig ohne Fehlermeldung funktionieren da die beiden at noch nicht angelegt wurden.
Nach dem speichern legt fhem die beiden at wieder an - ein erneutes aufräumen und speichern ohne delete bringt besagt Fehlermeldung.

Möglichkeiten:
a) Einfach ignorieren - beeinträchtig die Funktion in keinster Weise, ist nur unschön.
b) Beide at so umbauen das es geprüft wird ob schon das at exisitiert und ggf. löschen um es dann neu anlegen zu lassen oder das anlegen unterbinden wenn es bereits vorhanden ist.

Unvollständiger Auszug aus einem meiner Schnippsel:

if (Value("Laptop_Laden") eq "") {
      fhem ("define Laptop_Laden at +01:01:00 set Laptop_Lader on");
    }

hier wird geprüft ob Laptop_Laden equal "" (leer) ist, wenn ja wird das define angelegt.
So verhindere ich die Fehlermeldung im Logfile
ZitatLaptop_Laden already defined, delete it first

Wie gesagt. Ist aber nur Kosmetik da die Funktion nicht beeinträchtigt wird dadurch.

Grüße
Titel: Aw: Problem beim Aufräumen, fhem.cfg schimpft beim speichern
Beitrag von: docb am 20 Juni 2013, 11:17:28
Ah ok, danke. Aber wieso macht fhem das nur, warum meckert er die anderen at nicht an, sondern nur diese beiden?
Das verstehe ich nicht ganz...
Werde einfach dein Codeschnipsel umbauen - danke ;-)
viele Grüße
doc
Titel: Aw: Problem beim Aufräumen, fhem.cfg schimpft beim speichern
Beitrag von: Puschel74 am 20 Juni 2013, 11:29:08
Hallo,

was steht den im FHEM Logfile?

Grüße
Titel: Aw: Problem beim Aufräumen, fhem.cfg schimpft beim speichern
Beitrag von: docb am 20 Juni 2013, 11:47:41
Tja, das Logfile gibt mir auch keinen Aufschluss...

2013.06.20 11:46:39 1: Including fhem.cfg
2013.06.20 11:46:39 3: telnetPort: port 7072 opened
2013.06.20 11:46:39 3: WEB: port 8083 opened
2013.06.20 11:46:39 3: WEBphone: port 8084 opened
2013.06.20 11:46:39 3: WEBtablet: port 8085 opened
2013.06.20 11:46:39 1: Including ./BB/devices.conf
2013.06.20 11:46:39 3: Opening LANInterface device 192.168.2.3:1000
2013.06.20 11:46:39 3: LANInterface device opened
2013.06.20 11:46:41 1: Including ./BB/auto.conf
2013.06.20 11:46:42 1: Including ./BB/notify.conf
2013.06.20 11:46:42 1: Including ./BB/test.conf
2013.06.20 11:46:42 1: Including ./log/fhem.save
Titel: Aw: Problem beim Aufräumen, fhem.cfg schimpft beim speichern
Beitrag von: docb am 20 Juni 2013, 13:17:10
Hallo, das Problem hat sich von selbst erledigt. Nach 2x shutdown reboot kommt die Fehlermeldung nicht mehr. Da ist wohl irgendwo was hängen geblieben...
Dankeschön!