I try to change the stateformat of my tv , to show also the start and end time of a program.
The script is working only de devstateicon is not working anymore, any idea how I can solve this. I want to see the icon and after the icon the text
attr TV devStateIcon on:control_standby@orange:off off:control_standby@grey:on
stateFormat {
# Haal de readings op
my ($startDateTime, $durationSec, $power, $channel, $currentTitle) = (
ReadingsVal("TV", "ci_startDateTime", ""),
ReadingsVal("TV", "ci_durationSec", 0),
ReadingsVal("TV", "power", "off"), # Default naar 'off'
ReadingsVal("TV", "channel", "unknown"),
ReadingsVal("TV", "currentTitle", "unknown")
);
# Starttijd parsen
my ($hour, $minute) = ($startDateTime =~ /T(\d{2}):(\d{2})/);
# Duur berekenen in uren en minuten
my $endTimestamp = time_str2num($startDateTime) + $durationSec;
my ($endHour, $endMinute) = (strftime("%H", localtime($endTimestamp)), strftime("%M", localtime($endTimestamp)));
# Begin met power-status, zodat devStateIcon correct werkt
return sprintf("%s, %s / %s [%02d:%02d-%02d:%02d]",
$power, $channel, $currentTitle, $hour, $minute, $endHour, $endMinute);
}
BRAVIA:
TV (on, NPO 3 / NOS Voetbal [22:45-23:20])
If I am not mistaken, the state is "on, NPO 3 / NOS Voetbal [22:45-23:20]".
devstateicon currently expects "on" or "off".
It should work if you change it to
on.*:control_standby@orange:off off:control_standby@grey:on
This is just guessing, since i do not have all the details.
"Copy for forum.de" in TV details could help.
Ok that works, only I see the icon, and I only see the text when I hover over the icon. I would like to see the icon , and near that in the webinterface the text
hi,
ICON and TXT 1 (https://forum.fhem.de/index.php?topic=99439.0)
ICON and TXT 2 (https://forum.fhem.de/index.php?topic=38332.0)
ICON and TXT 3 (https://forum.fhem.de/index.php?topic=105598.0)
gruss
Hallo,
Hack:
ergänze einen Zeilenumbruch in der stateFormat-Definition
return sprintf("%s
%s / %s [%02d:%02d-%02d:%02d]",$power, $channel, $currentTitle, $hour, $minute, $endHour, $endMinute);
Gruß Thomas
Yes, that was the trick. Thnx