Open sebbacon opened 2 years ago
OK so conclusion
The webui eventlog doesn't work, but I can see events from the telnet interface with:
fhem> inform timer
fhem> 2022-09-19 13:04:42 CUL CUL_0 credit10ms: 3600
2022-09-19 13:04:42 CUL_MAX cm CUL_0:ok
2022-09-19 13:04:42 MAX bethroom lastTimeSync: 2022-09-19 13:04:42
2022-09-19 13:04:43 MAX bethroom valveposition: 0
2022-09-19 13:04:43 MAX bethroom 11.0
2022-09-19 13:04:43 MAX bethroom desiredTemperature: 11.0
2022-09-19 13:04:43 MAX bethroom RSSI: -63.5
I'm interested in all valvepositions, so I need to listen using notify
(docs). Maybe
define recordvalve notify valveposition set lamp $EVTPART1
You can do "perl oneliners" in the notify
(docs)
define recordvalve notify valveposition { fhem "set lamp $EVTPART1" }
To show them all in one (docs):
define TRVs readingsGroup <room>,<valve>,<target>,<temp>,<mode>,<battery> type=HeatingThermostat:valveposition,desiredTemperature,temperature,mode,battery
But to read them all programmatically, I think I want a script something like this (how to write scripts of doing this is to use the integrated editor)):
##############################################
# $Id: myUtilsTemplate.pm 21509 2020-03-25 11:20:51Z rudolfkoenig $
#
# Save this file as 99_myUtils.pm, and create your own functions in the new
# file. They are then available in every Perl expression.
package main;
use strict;
use warnings;
sub
myUtils_Initialize($$)
{
my ($hash) = @_;
}
# Enter you functions below _this_ line.
sub CheckAllValves() {
my $total = 0;
foreach my $dev (devspec2array("room=MAX")) {
$total = $total + ReadingsVal($dev, "valveposition", 0);
}
Log(0, "Total valve position is " . $total);
if ($total > 0) {
fhem ( "set boiler_switch on" );
} else {
fhem ( "set boiler_switch off" );
}
}
1;
Which I could then call with:
define recordvalve notify .*valveposition.* {CheckAllValves()}
And test with
trigger livingroom.front valveposition: 80
I've got it working with this configuration:
Now trying to work out how I can set week profiles. From here, I discovered the
weekprofile
module (full docs here):Device-specific configuration also includes the weekProfile, e.g. the desired temperature for each day and each hour. The format is quite simple and starts with an implicit 00:00 (midnight) and ends with an implicit 24:00 (midnight next day). In between desired temperatures are specificed interleaving with hours, seperated by ,s. Temperature is specific in degrees celsius. Example:
will set 17 degrees from midnight to 06:00am, 21 degrees 06:00am to 20:00 (8:00pm) and then again 17 degrees until midnight. Such profiles are defined for each day (Mon, Tue, Wed, Thu, Fri, Sat, Sun) and set with the weekProfile command:
Supposedly there's a UI for it, but I can't work out how to make it work, other than you have to
sudo apt-get install libjson-pp-perl
. (source)