I like what you’ve done there
Purely for the crack, I had a hunt around the internet and played with what I found…
FYI, I copied doorbell.mp3 from /etc/openhab/sounds into the /etc/openhab/html folder
This works, but I have no idea how to vary the sound file, or build it into a widget.
I look forward to seeing what you come up with
<!doctype html> <html> <head> <meta charset="ISO-8859-1" />
<title>Auto play doorbell.mp3</title>
<body>
<EMBED SRC="doorbell.mp3" autostart="true" width=0 height=0 >
</body>
<html>
Update…
Now here’s an observation (remembering that I’m a wires guy, not a programmer, so anything I can make work in software feels like I’ve won a lottery)
If I create a SymLink from within the html folder of /etc/openhab/html like this
ln -s ../sounds sounds
Then the following html page also works…
<!doctype html> <html> <head> <meta charset="ISO-8859-1" />
<title>Auto play barking.mp3</title>
<body>
<EMBED SRC="sounds/barking.mp3" autostart="true" width=0 height=0 >
</body>
<html>
So…
Is it possible to create a SymLink to a folder on another machine / drive that holds your answering machine messages?
00:20 late night ramblings… Feel free to ignore the following…
As the html file is tiny, is there a way to use an Exec Binding command to send the voicemail file name into a script that recreates the entire file into the html folder, for HabPanel to call when a (monitored) item changes?
Something like…
rule "new VM"
when
Item New_VM_Filename changed
then
create_new_html_script.sendCommand(New_VM_Filename.state)
Item_monitored_by_HabPanel.sendCommand(New_Voicemail)
end
and the command line script looks something like this…
#Usage :- new_vm_html.sh --value={voicemail filename (& path)}
#Output will be a file called new_vm.html with the path to the voicemail file
while [ "$#" -gt 0 ]; do
case "$1" in
-v) value="$2"; shift 2;;
--value=*) value="${1#*=}"; shift 1;;
--value) echo "$1 requires an argument"
>&2; exit 1;;
-*) echo "unknown option: $1" >&2; exit 1;;
*) handle_argument "$1"; shift 1;;
esac
echo $value
echo $(date +%F" "%T),$value >> new_vm.log
# recreate new_vm.html file from two halves of a donor
rm new_vm.html
touch new_vm.html
cat new_vm.donor1 >> new_vm.html
echo $value >> new_vm.html
cat new_vm.donor2 >> new_vm.html
done
Where new_vm.donor1 looks like this
<!doctype html> <html> <head> <meta charset="ISO-8859-1" />
<title>Auto play barking.mp3</title>
<body>
<EMBED SRC="sounds/
And new_vm.donor2 looks like this
" autostart="true" width=0 height=0 >
</body>
<html>
FYI
@01:22
It’s only WORKING !
I have only tried it by swapping between
./new_vm_html.sh --value=doorbell.mp3
and
./new_vm_html.sh --value=barking.mp3
then refreshing a web browser, but that’s good enough for me right now