ChriD / Raumserver

Raumserver - A HTTP Request Server to control the RF-Multiroom System
32 stars 11 forks source link

"Currently Playing" feature for HomeAutomation #20

Open davidspr opened 8 years ago

davidspr commented 8 years ago

A "Currently Playing" feature would enhance the usage of Raumserver with any http-based HomeAutomation connection. With the current set of features, one can send Home-information to Raumfeld via Raumserver (e.g a door bell, alarm, reminder,...). However, after the Home-information was played on Raumfeld devices, there is no way to switch back to the music, radio, playlist,... that was "Currently Playing".

ChriD commented 8 years ago

I can imagin doing request like

storeCurrentState?id=livingroom&stateId=bellring
... do the bellring ...
loadCurrentState?id=livingroom&stateId=bellring

wich will save the current loaded uri/container, volume and the progress state of the stream (into an xml file) to resume playing where it has stopped. There should be the ability for saving several states (in fact one state for each zone would be fine enough but not that much effort to create this for multiple states) This one will NOT store the current zone configuration, only the state of the virtual renderer which can be appied on any other virtual renderer or itself.

Added to Milstone 1.1.0.

davidspr commented 8 years ago

This is a great solution to the doorbell usecase! By the way there is also a "Last Played Log" in the Raumfeld-App, maybe that Log can be used too if accessible.

holli73 commented 8 years ago

hello,

this would be nice too - if you need a script i have this already in place - here is an extrace from my script file:

    curl --tcp-nodelay --max-time 15 "http://192.168.250.94:8080/raumserver/json/getrendererstate?_" |json -aM .value |json -aM .zoneName .volume .transportState .zoneUDN > /home/dss/ds/raumfeld/state.txt
            curl --tcp-nodelay --max-time 15 "http://192.168.250.94:8080/raumserver/room/Kueche/pause";
            curl --tcp-nodelay --max-time 15 "http://192.168.250.94:8080/raumserver/room/Kueche/loadPlayList?name=klingel";
            curl --tcp-nodelay --max-time 15 "http://192.168.250.94:8080/raumserver/room/Kueche/volume?value=80";
            curl --tcp-nodelay --max-time 15 "http://192.168.250.94:8080/raumserver/room/Kueche/play";
            curl --tcp-nodelay --max-time 15 "http://192.168.250.94:8080/raumserver/room/Kueche/playMode?value=3";
            sleep 30;
            curl --tcp-nodelay --max-time 15 "http://192.168.250.94:8080/raumserver/room/Kueche/volume?value=25";
            curl --tcp-nodelay --max-time 15 "http://192.168.250.94:8080/raumserver/room/Kueche/pause";
            uuid="$(cat /home/dss/ds/raumfeld/state.txt |grep Kueche |cut -d ' ' -f4)";
            uuid="$(echo "$uuid" | sed 's/:/%3A/g')";
            laststate="$(cat /home/dss/ds/raumfeld/state.txt |grep Kueche |cut -d ' ' -f 3)";
            lastvol="$(cat /home/dss/ds/raumfeld/state.txt |grep Kueche |cut -d ' ' -f 2)";
            if [ "$laststate" = "PLAYING" ]; then
                curl --tcp-nodelay --max-time 15 "http://192.168.250.94:8080/raumserver/room/$uuid/volume?value=$lastvol";
                curl --tcp-nodelay --max-time 25 "http://192.168.250.94:8080/raumserver/room/Kueche/loadUri?uri=http%3A%2F%2F192.168.250.80%3A9120%2Foe3.mp3"
                curl --tcp-nodelay --max-time 15 "http://192.168.250.94:8080/raumserver/room/$uuid/play";
            fi
        else
            echo "OFF";
            curl --tcp-nodelay --max-time 15 "http://192.168.250.94:8080/raumserver/room/Kueche/pause";
        fi

holli

davidspr commented 8 years ago

Hi Holli, would this start a Raumfeld device that is either in eco-mode or switched-off? Since switching on/off is possible in the Raumfeld app maybe there is a way to implement this feature as a Raumserver command, which can be called before saving the state and calling a door-bell playlist. David

holli73 commented 8 years ago

hi David,

i use this script and the dorbell is starting my devices even if they are off/standy ( or the new eco off) -> if the devices are power off (switch on the device itself) this will not work.

but the 'PAUSE' + 'LOAD' + 'PLAY' will start the device and after some time the devices will power off again till some new request is made.

best regards holli

ChriD commented 8 years ago

I'm not sure until now but after some thinking i might add the zone configuration to the state files. So the whole state of the system would be stored an can be restored. But there are some pitfalls with the position of the curren stream... Hmm.....