Hallo,
ich benutze FHEM seit 2014 und dachte mir nun endlich einmal ich könnte auch mal Statistiken führen :)
Daher richtie ich gerade das Statistics Modul ein. Das erste "Projekt": Wie lange schaue ich eigentlich am Tag in die Glotze?
Dazu habe ich mir ein Statistics angelegt für meinen HarmonyHub:
Internals:
CFGFN
DEF HarmonyHub
DEV_REGEXP HarmonyHub
FUUID 6333be49-f33f-f685-165e-77580b988f648301
NAME StatDeviceHarmony
NOTIFYDEV global,HarmonyHub
NR 610772
NTFY_ORDER 10-StatDeviceHarmony
PREFIX stat
STATE Updated stats for: HarmonyHub
TYPE statistics
eventCount 274
READINGS:
2022-09-28 05:26:21 monitoredDevicesharmony HarmonyHub
2022-09-29 15:59:55 nextPeriodChangeCalc 2022-09-29 16:59:55
2022-09-29 16:34:02 state Updated stats for: HarmonyHub
fhem:
modulVersion $Date: 2022-07-12 07:25:06 +0200 (Tue, 12 Jul 2022) $
nextPeriodChangeTime 1664463595
hmccu:
Attributes:
durationReadings currentActivity
excludedReadings state
Dieser schreibt nun brav Statistiken für meine "currentActivity". Funktioniert super:
statCurrentActivityDay
Kodi: 00:53:40 Kodi_Count: 1 PowerOff: 15:40:21 PowerOff_Count: 1 starting_Kodi: 00:00:06 starting_Kodi_Count: 1
2022-09-29 16:34:02
Nun würde ich das ganze nun natürlich auch in ein FileLog schreiben, zum Plotten.
Ich habe ein Filelog für meinen HarmonyHub:
Internals:
DEF ./log/harmonyhub-%Y.log HarmonyHub:.*
FD 25
FUUID 5d02a590-f33f-1e42-df5d-d7d3fea5e6494ed2
FVERSION 92_FileLog.pm:0.263290/2022-08-17
NAME FileLog_harmonyhub
NOTIFYDEV HarmonyHub
NR 142
NTFY_ORDER 50-FileLog_harmonyhub
REGEXP HarmonyHub:.*
STATE active
TYPE FileLog
currentlogfile ./log/harmonyhub-2022.log
eventCount 3
logfile ./log/harmonyhub-%Y.log
READINGS:
2022-09-29 16:28:08 linesInTheFile 33714
Attributes:
room Wohnzimmer
So nun das Problem: Die stat Readings werden nicht im FileLog protokolliert. Ich kann beim editieren des Filelogs auch für addRegexpPart in der Dropdown Liste gar nicht die stat Readings auswählen. Ist ja eigentlich auch egal. Ich habe ja .* gesetzt.
Was mache ich falsch?!
Danke!
Gruß desmo
Zitat von: desmoloch am 29 September 2022, 16:41:17
Was mache ich falsch?!
Kein list des devices anfügen, um das es eigentlich geht.
Sind da ggf. event-on-change-.*-Attribute gesetzt?
Zitat von: Beta-User am 30 September 2022, 11:56:59
Kein list des devices anfügen, um das es eigentlich geht.
Sind da ggf. event-on-change-.*-Attribute gesetzt?
Verdammte Axt. Ich dachte ich hab an alles gedacht!
Hier das list:
Internals:
CONNECTS 65
ConnectionState LoggedIn
DEF 192.168.1.59
FD 43
FUUID 5d02a591-f33f-1e42-9975-6bc1098b7e73c9ff
FVERSION 37_harmony.pm:0.191700/2019-04-13
LAST_CONNECT 2022-09-29 20:33:43
LAST_DISCONNECT 2022-09-29 20:33:41
NAME HarmonyHub
NOTIFYDEV global
NR 141
NTFY_ORDER 50-HarmonyHub
STATE Aktuelle Aktivität: PowerOff
Letzte Aktivität: Kodi
TYPE harmony
activityStatus 0
currentActivityID -1
eventCount 4882
hubSwVersion 4.15.307
hubUpdate 0
ip 192.168.1.59
previousActivityID 49298458
protocol XMPP
syncStatus 0
OLDREADINGS:
READINGS:
2022-09-30 07:14:32 activity PowerOff
2022-09-30 07:14:33 currentActivity PowerOff
2022-09-30 07:14:32 previousActivity Kodi
2022-09-30 16:59:55 statCurrentActivityDay Kodi: 00:24:13 Kodi_Count: 1 PowerOff: 16:35:34 PowerOff_Count: 2 starting_Kodi: 00:00:07 starting_Kodi_Count: 1 stopping_Kodi: 00:00:06 stopping_Kodi_Count: 1
2022-09-29 23:59:55 statCurrentActivityDayLast Kodi: 04:01:53 Kodi_Count: 2 PowerOff: 19:57:46 PowerOff_Count: 3 starting_Kodi: 00:00:12 starting_Kodi_Count: 2 stopping_Kodi: 00:00:09 stopping_Kodi_Count: 2
2022-09-30 16:59:55 statCurrentActivityMonth Kodi: 07:37:38 Kodi_Count: 6 PowerOff: 2d 03:52:36 PowerOff_Count: 7 starting_Kodi: 00:00:38 starting_Kodi_Count: 6 stopping_Kodi: 00:00:30 stopping_Kodi_Count: 6 (since: 2022-09-28_05:28:33)
2022-09-30 16:59:55 statCurrentActivityYear Kodi: 07:37:38 Kodi_Count: 6 PowerOff: 2d 03:52:36 PowerOff_Count: 7 starting_Kodi: 00:00:38 starting_Kodi_Count: 6 stopping_Kodi: 00:00:30 stopping_Kodi_Count: 6 (since: 2022-09-28_05:28:33)
2022-09-29 20:33:43 state Connected
config:
activity:
HASH(0x55a96a6107d8)
HASH(0x55a96c8771a8)
HASH(0x55a96e223978)
HASH(0x55a96c816370)
HASH(0x55a96c869d28)
HASH(0x55a96c83bfe0)
content:
contentDeviceHost https://content.dhg.myharmony.com/1.0/Device;{deviceProfileUri}
contentImageHost https://d1tk8oqnnsddt5.cloudfront.net/1.0/station/{stationId}/image;maxX=40;maxY=40
contentServiceHost https://content.dhg.myharmony.com/1.0/Service/{providerId}
contentUserHost https://content.dhg.myharmony.com/1.0/User;{userProfileUri}
householdUserProfileUri svcs.myharmony.com/res//household/1197166-GVYQqnDJmQYItEj5AKRTyuBuIPjgSgAlLDwpRfEBpX8=/user/default
device:
HASH(0x55a96c84e8c0)
HASH(0x55a96e3c8a08)
HASH(0x55a96db9f698)
HASH(0x55a96c837ce0)
HASH(0x55a96c8379f8)
HASH(0x55a96debb238)
global:
locale de-DE
timeStampHash e6caf222-4c14-46ba-ae6a-03126388cb4a3e595b21-8d68-4e9a-9b35-553b55e444dd/8f75c670-4b62-449e-aad1-e6b04fd685b7fe106360-f7ae-4a99-8f3a-acbadd39648530204e5e-54cf-45f3-b808-699a77776e6710273830Harmony+Hubde-DEjanvanscheidt@hotmail.comDEMS-5d0ccc7f-0e96-4d89-9a03-21871c02600e0-1571004301False-1871086257europe%2fberlinTrue-4525369801;1be62fb7c6f9debed067376af7f4d23f
sequence:
sla:
latestSLAAcceptedDate /Date(1521747698580+0000)/
discoveryinfo:
accountId 9401029
current_fw_version 4.15.307
discoveryServerUri https://svcs.myharmony.com/Discovery/Discovery.svc
discoveryServerUriCF https://cf-svcs.myharmony.com/Discovery/Discovery.svc
email janvanscheidt@hotmail.com
friendlyName Harmony Hub
host_name Harmony Hub
hubId 106
hubProfiles {Harmony="2.0"}
ip 192.168.1.59
minimumOpenApiClientVersionRequired 1
mode 3
openApiVersion 2
port 5222
productId Pimento
protocolVersion {XMPP="1.0", HTTP="1.0", RF="1.0", WEBSOCKET="1.0"}
recommendedOpenApiClientVersion 1
remoteId 10273830
setupSessionClient MS-5d0ccc7f-0e96-4d89-9a03-21871c02600e
setupSessionIsStale true
setupSessionSetupType
setupSessionType 0
setupStatus 0
uuid 5cfbd4df245aa53e75a8e69ad25ca57d46cfef59
helper:
PARTIAL
UserAuthToken
_98_statistics StatDeviceHarmony
hmccu:
Attributes:
event-on-change-reading .*
group Multimedia
room Wohnzimmer
stateFormat Aktuelle Aktivität: activity
Letzte Aktivität: previousActivity
webCmd activity
Und ja ich habe ein Event-on-change-reading mit .* gesetzt.
Erkennt jemand den Fehler? Danke!
Also so langsam wird ein Schuh draus...
Warum auch immer wird das Stat Reading "statCurrentActivityDay" nicht ins log geschrieben. Alle anderen schon...
Hier musste ich halte bis 23:59 warten, denn da erzeugt / aktualisiert das Modul das Reading:
2022-09-28_23:59:55 HarmonyHub statCurrentActivityDayLast: Kodi: 03:11:32 Kodi_Count: 3 PowerOff: 15:19:16 PowerOff_Count: 4 starting_Kodi: 00:00:19 starting_Kodi_Count: 3 stopping_Kodi: 00:00:15 stopping_Kodi_Count: 3 (since: 2022-09-28_05:28:33)
Nun habe ich im Statistics Modul noch ein "singularReadings" hinzugefügt und nun habe ich auch die Tages readings im Log:
2022-10-02_07:59:55 HarmonyHub statActivityDayKodi: 00:19:33
Ich habe keine Erklärung warum es vorher nicht ging, aber nun gehst. Fall gelöst!