fhem Befehl absetzen bei "Raumaufruf"

Begonnen von bejxonojo, 10 April 2020, 11:28:52

Vorheriges Thema - Nächstes Thema

bejxonojo

Hallo Zusammen,

ich habe da mal eine Frage.
Ich habe einen Solarlader von Victron, dessen Daten logge ich in eine fhem Datenbank.
Nun möchte ich einzelne Messwerte (den jeweils letzten gemessenen Wert) gerne in einem dummy Device in einem eigenen Raum anzeigen.

Bis jetzt bin ich soweit gekommen das ich mit jeweils einem DbRep Device den Wert in einen dummy Device im Raum Solar schreiben kann.
Allerdings werden die Daten nur dann aktualisiert wenn ich einen "fetchrow current" Befehl des zugehörigen DbRep Devices absetze.

Das ist für mich an sich auch kein Problem, nun würde ich es gerne so einrichten das diese "fetchrow" Befehle (sieben Einzelwerte) dann abgesetzt werden wenn ich den Raum "Solar" aufrufe.

Ist das möglich, bzw mit welchem Schwierigkeitsgrad?
Alternativen? Habe zuerst daran gedacht ein AT zu nutzen, aber eigentlich benötige ich die Aktualisierung nur wenn der Raum aufgerufen wird...

Konfigbeispiel:
define rep.tracker_operation_mode DbRep dblog
attr rep.tracker_operation_mode autoForward {\
".*MPPT.*" => "dum.tracker_op_mode => state",\
}
attr rep.tracker_operation_mode device solar_charger
attr rep.tracker_operation_mode reading MPPT
attr rep.tracker_operation_mode room Solar

define dum.tracker_operation_mode dummy
attr dum.tracker_operation_mode room Solar


PS: Falls der Post nicht im richtigen Unterforum ist bitte verschieben.

lg Stefan

rudolfkoenig

Mit dem devStateIcon Attribut kann man auch ein Perl-Expression ausfuehren.
Da ich "fetchrow current" nicht kenne, kann ich nicht sagen, ob es passt.

bejxonojo

Wow, Danke für die schnelle Antwort  :).

Wusste nicht dass das devStateIcon das kann.
Ich habe es mal mit dem folgenden Code ausprobiert:attr rep.tracker_operation_mode devStateIcon { fhem 'set rep.tracker_operation_mode fetchrows current' }
Das hat auch soweit gut geklappt, doch habe ich im Event monitor und im Log gesehen das der Befehl nicht nur einmal ausgeführt wir (hatte ich eigentlich so erwartet) sondern kontinuierlich in einer Schleife. Was dazu führt das eine menge Anfragen von DbRep gestellt werden die sich gegenseitig blockieren...

2020.04.10 12:24:31 1: DbRep rep.yield_today -> BlockingCall  pid: Timeout: process terminated
2020.04.10 12:24:31 2: DbRep rep.yield_today - Database command aborted due to "Timeout: process terminated"
2020.04.10 12:26:25 3: DbRep rep.max_power_today - WARNING - old process 5322 will be killed now to start a new BlockingCall
2020.04.10 12:26:25 1: DbRep rep.max_power_today -> BlockingCall  pid: Timeout: process terminated
2020.04.10 12:26:25 1: PERL WARNING: Use of uninitialized value in concatenation (.) or string at ./FHEM/93_DbRep.pm line 1959.
2020.04.10 12:26:25 3: DbRep rep.max_power_today - WARNING - old process  will be killed now to start a new BlockingCall
2020.04.10 12:26:25 2: DbRep rep.max_power_today - Database command aborted due to "Timeout: process terminated"
2020.04.10 12:26:25 3: DbRep rep.max_power_today - WARNING - old process 5333 will be killed now to start a new BlockingCall
2020.04.10 12:26:25 1: DbRep rep.max_power_today -> BlockingCall  pid: Timeout: process terminated
2020.04.10 12:26:25 2: DbRep rep.max_power_today - Database command aborted due to "Timeout: process terminated"
2020.04.10 12:26:43 3: DbRep rep.max_power_today - WARNING - old process 6089 will be killed now to start a new BlockingCall
2020.04.10 12:26:43 3: DbRep rep.max_power_today - WARNING - old process 6101 will be killed now to start a new BlockingCall
2020.04.10 12:26:43 1: DbRep rep.max_power_today -> BlockingCall  pid: Timeout: process terminated
2020.04.10 12:26:43 3: DbRep rep.max_power_today - WARNING - old process  will be killed now to start a new BlockingCall
2020.04.10 12:26:43 2: DbRep rep.max_power_today - Database command aborted due to "Timeout: process terminated"
2020.04.10 12:26:43 3: DbRep rep.max_power_today - WARNING - old process 6102 will be killed now to start a new BlockingCall
2020.04.10 12:26:43 1: DbRep rep.max_power_today -> BlockingCall  pid: Timeout: process terminated
2020.04.10 12:26:43 2: DbRep rep.max_power_today - Database command aborted due to "Timeout: process terminated"
2020.04.10 12:29:04 3: DbRep rep.yield_total - WARNING - old process 9347 will be killed now to start a new BlockingCall
2020.04.10 12:29:04 1: DbRep rep.yield_total -> BlockingCall  pid: Timeout: process terminated
2020.04.10 12:29:04 2: DbRep rep.yield_total - Database command aborted due to "Timeout: process terminated"


020-04-10 12:29:20 dummy dum.max_power_today 86 W
2020-04-10 12:29:20 DbRep rep.max_power_today 2020-04-10_11-15-08__1__solar_charger__H21: 86 W
2020-04-10 12:29:20 DbRep rep.max_power_today number_fetched_rows: 1
2020-04-10 12:29:20 DbRep rep.max_power_today done
2020-04-10 12:29:20 DbRep rep.max_power_today running
2020-04-10 12:29:20 dummy dum.max_power_today 86 W
2020-04-10 12:29:20 DbRep rep.max_power_today 2020-04-10_11-15-08__1__solar_charger__H21: 86 W
2020-04-10 12:29:20 DbRep rep.max_power_today number_fetched_rows: 1
2020-04-10 12:29:20 DbRep rep.max_power_today done
2020-04-10 12:29:20 DbRep rep.max_power_today running
2020-04-10 12:29:20 dummy dum.state_of_operation Absorption 
2020-04-10 12:29:20 DbRep rep.state_of_operation 2020-04-10_11-15-08__1__solar_charger__CS: Absorption 
2020-04-10 12:29:20 DbRep rep.state_of_operation number_fetched_rows: 1
2020-04-10 12:29:20 DbRep rep.state_of_operation done
2020-04-10 12:29:20 DbRep rep.state_of_operation running
2020-04-10 12:29:20 dummy dum.tracker_op_mode Limited 
2020-04-10 12:29:20 DbRep rep.tracker_operation_mode 2020-04-10_11-15-08__1__solar_charger__MPPT: Limited 
2020-04-10 12:29:20 DbRep rep.tracker_operation_mode number_fetched_rows: 1
2020-04-10 12:29:20 DbRep rep.tracker_operation_mode done
2020-04-10 12:29:20 DbRep rep.tracker_operation_mode running
2020-04-10 12:29:20 dummy dum.yield_today 0.11 kWh
2020-04-10 12:29:20 DbRep rep.yield_today 2020-04-10_12-02-08__1__solar_charger__H20: 0.11 kWh
2020-04-10 12:29:20 DbRep rep.yield_today number_fetched_rows: 1
2020-04-10 12:29:20 DbRep rep.yield_today done
2020-04-10 12:29:20 DbRep rep.yield_today running
2020-04-10 12:29:20 dummy dum.error No error 
2020-04-10 12:29:20 DbRep rep.error 2020-04-03_11-50-06__1__solar_charger__ERR: No error 
2020-04-10 12:29:20 DbRep rep.error number_fetched_rows: 1
2020-04-10 12:29:20 DbRep rep.error done
2020-04-10 12:29:20 DbRep rep.error running
2020-04-10 12:29:20 dummy dum.load_output 1 
2020-04-10 12:29:20 DbRep rep.load_output 2020-04-03_11-50-06__1__solar_charger__LOAD: 1 
2020-04-10 12:29:20 DbRep rep.load_output number_fetched_rows: 1
2020-04-10 12:29:20 DbRep rep.load_output done
2020-04-10 12:29:20 DbRep rep.load_output running
2020-04-10 12:29:20 dummy dum.yield_total 2.73 kWh
2020-04-10 12:29:20 DbRep rep.yield_total 2020-04-10_12-02-08__1__solar_charger__H19: 2.73 kWh
2020-04-10 12:29:20 DbRep rep.yield_total number_fetched_rows: 1
2020-04-10 12:29:20 DbRep rep.yield_total done
2020-04-10 12:29:20 DbRep rep.yield_total running
2020-04-10 12:29:20 dummy dum.load_output 1 
2020-04-10 12:29:20 DbRep rep.load_output 2020-04-03_11-50-06__1__solar_charger__LOAD: 1 
2020-04-10 12:29:20 DbRep rep.load_output number_fetched_rows: 1
2020-04-10 12:29:20 DbRep rep.load_output done
2020-04-10 12:29:20 DbRep rep.load_output running
2020-04-10 12:29:20 dummy dum.error No error 
2020-04-10 12:29:20 DbRep rep.error 2020-04-03_11-50-06__1__solar_charger__ERR: No error 
2020-04-10 12:29:20 DbRep rep.error number_fetched_rows: 1
2020-04-10 12:29:20 DbRep rep.error done
2020-04-10 12:29:20 DbRep rep.error running
2020-04-10 12:29:20 dummy dum.state_of_operation Absorption 
2020-04-10 12:29:20 DbRep rep.state_of_operation 2020-04-10_11-15-08__1__solar_charger__CS: Absorption 
2020-04-10 12:29:20 DbRep rep.state_of_operation number_fetched_rows: 1
2020-04-10 12:29:20 DbRep rep.state_of_operation done
2020-04-10 12:29:20 DbRep rep.state_of_operation running
2020-04-10 12:29:20 dummy dum.yield_today 0.11 kWh
2020-04-10 12:29:20 DbRep rep.yield_today 2020-04-10_12-02-08__1__solar_charger__H20: 0.11 kWh
2020-04-10 12:29:20 DbRep rep.yield_today number_fetched_rows: 1
2020-04-10 12:29:20 DbRep rep.yield_today done
2020-04-10 12:29:20 DbRep rep.yield_today running
2020-04-10 12:29:20 dummy dum.yield_total 2.73 kWh
2020-04-10 12:29:20 DbRep rep.yield_total 2020-04-10_12-02-08__1__solar_charger__H19: 2.73 kWh
2020-04-10 12:29:20 DbRep rep.yield_total number_fetched_rows: 1
2020-04-10 12:29:20 DbRep rep.yield_total done
2020-04-10 12:29:20 DbRep rep.yield_total running
2020-04-10 12:29:20 dummy dum.tracker_op_mode Limited 
2020-04-10 12:29:20 DbRep rep.tracker_operation_mode 2020-04-10_11-15-08__1__solar_charger__MPPT: Limited 
2020-04-10 12:29:20 DbRep rep.tracker_operation_mode number_fetched_rows: 1
2020-04-10 12:29:20 DbRep rep.tracker_operation_mode done
2020-04-10 12:29:20 DbRep rep.tracker_operation_mode running
2020-04-10 12:29:20 dummy dum.max_power_today 86 W
2020-04-10 12:29:20 DbRep rep.max_power_today 2020-04-10_11-15-08__1__solar_charger__H21: 86 W
2020-04-10 12:29:20 DbRep rep.max_power_today number_fetched_rows: 1
2020-04-10 12:29:20 DbRep rep.max_power_today done
2020-04-10 12:29:20 DbRep rep.max_power_today running
2020-04-10 12:29:20 dummy dum.max_power_today 86 W
2020-04-10 12:29:20 DbRep rep.max_power_today 2020-04-10_11-15-08__1__solar_charger__H21: 86 W
2020-04-10 12:29:20 DbRep rep.max_power_today number_fetched_rows: 1
2020-04-10 12:29:20 DbRep rep.max_power_today done
2020-04-10 12:29:20 DbRep rep.max_power_today running
2020-04-10 12:29:20 dummy dum.state_of_operation Absorption 
2020-04-10 12:29:20 DbRep rep.state_of_operation 2020-04-10_11-15-08__1__solar_charger__CS: Absorption 
2020-04-10 12:29:20 DbRep rep.state_of_operation number_fetched_rows: 1
2020-04-10 12:29:20 DbRep rep.state_of_operation done
2020-04-10 12:29:20 DbRep rep.state_of_operation running
2020-04-10 12:29:20 dummy dum.tracker_op_mode Limited 
2020-04-10 12:29:20 DbRep rep.tracker_operation_mode 2020-04-10_11-15-08__1__solar_charger__MPPT: Limited 
2020-04-10 12:29:20 DbRep rep.tracker_operation_mode number_fetched_rows: 1
2020-04-10 12:29:20 DbRep rep.tracker_operation_mode done
2020-04-10 12:29:20 DbRep rep.tracker_operation_mode running
2020-04-10 12:29:20 dummy dum.yield_today 0.11 kWh
2020-04-10 12:29:21 DbRep rep.yield_today 2020-04-10_12-02-08__1__solar_charger__H20: 0.11 kWh
2020-04-10 12:29:21 DbRep rep.yield_today number_fetched_rows: 1
2020-04-10 12:29:21 DbRep rep.yield_today done
2020-04-10 12:29:21 DbRep rep.yield_today running
2020-04-10 12:29:21 dummy dum.error No error 
2020-04-10 12:29:21 DbRep rep.error 2020-04-03_11-50-06__1__solar_charger__ERR: No error 
2020-04-10 12:29:21 DbRep rep.error number_fetched_rows: 1
2020-04-10 12:29:21 DbRep rep.error done
2020-04-10 12:29:21 DbRep rep.error running
2020-04-10 12:29:21 dummy dum.load_output 1 
2020-04-10 12:29:21 DbRep rep.load_output 2020-04-03_11-50-06__1__solar_charger__LOAD: 1 
2020-04-10 12:29:21 DbRep rep.load_output number_fetched_rows: 1
2020-04-10 12:29:21 DbRep rep.load_output done
2020-04-10 12:29:21 DbRep rep.load_output running
2020-04-10 12:29:21 dummy dum.yield_total 2.73 kWh
2020-04-10 12:29:21 DbRep rep.yield_total 2020-04-10_12-02-08__1__solar_charger__H19: 2.73 kWh
2020-04-10 12:29:21 DbRep rep.yield_total number_fetched_rows: 1
2020-04-10 12:29:21 DbRep rep.yield_total done
2020-04-10 12:29:21 DbRep rep.yield_total running
2020-04-10 12:29:21 dummy dum.load_output 1 
2020-04-10 12:29:21 DbRep rep.load_output 2020-04-03_11-50-06__1__solar_charger__LOAD: 1 
2020-04-10 12:29:21 DbRep rep.load_output number_fetched_rows: 1
2020-04-10 12:29:21 DbRep rep.load_output done
2020-04-10 12:29:21 DbRep rep.load_output running


Gibt es die Möglichkeit die Ausführung auf ein Mal, oder einmal in der Minute zu begrenzen?

lg Stefan