So I have a motion sensor in the hallway which triggers my hallway light, which works fine. During the summer I rent my flat out occasionally, so then I would like to know when my guest arrive. So the idea is to use my motion rule:
rule "Update hallway light when motion happens"
when
Item HueMotionBathroom changed from CLOSED to OPEN
then
Presence_Home.sendCommand(ON)
Light_Hallway_Timer.sendCommand(ON)
if (Light_Hallway.state ==OFF) {
Light_Hallway.sendCommand(ON)
}
end
Which then will trigger this rule only once! (Until I manually reset it). Maybe a bit overload to check evrytime Presence_home changes to see state of Presence_WaitingForGuest, maybe move it to the rule above instead?
rule "Sensor update"
when
Item Presence_Home received update
then
Presence_Home_LastUpdate.postUpdate( new DateTimeType() )
if ( Presence_WaitingForGuest.state ==OFF) {
Presence_WaitingForGuest.sendCommand(ON)
}
end
And finally to my problem, how do I play a local file from RPI on chromecast?
rule "Guest Arrived"
when
Item Presence_WaitingForGuest CHANGED FROM OFF TO ON
then
// Send email to myself...
// Play notification on stereo, to make guest move to sofa
//Wait a minute or so
// Play video on chromecast from local file on rpi
end
NO, that’s the right way to do it or your could put your two rules into one:
rule "Update hallway light when motion happens"
when
Item HueMotionBathroom changed from CLOSED to OPEN
then
Presence_Home.sendCommand(ON)
Light_Hallway_Timer.sendCommand(ON)
if (Light_Hallway.state ==OFF) {
Light_Hallway.sendCommand(ON)
}
if (Presence_Home.state == OFF) {
Presence_Home.sendCommand(ON)
Presence_Home_LastUpdate.postUpdate( new DateTimeType() )
if ( Presence_WaitingForGuest.state ==OFF) {
Presence_WaitingForGuest.sendCommand(ON)
}
}
end
For your second question:
Your need the chromecast binding
A video file (mp4) that you put into the /conf/html folder
and link an item to the playuri channel
and send a command to the item with the location of the file :“/etc/openhab2/conf/html/welcome.mp4”
2018-08-28 00:20:53.057 [vent.ItemStateChangedEvent] - Chromecast_LivingRoom_Playuri changed from //etc/openHAB-conf/html/test.mp4 to /etc/openHAB-conf/html/test.mp4
2018-08-28 00:20:55.137 [hingStatusInfoChangedEvent] - 'chromecast:chromecast:chromecast_livingRoom' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Unable to load media
Why is it called playuri and not playurl? And what is valid commands? playStream("chromecast:chromecast:Chromecast_LivingRoom","http://st01.dlf.de/dlf/01/128/mp3/stream.mp3") does not work either, and I assume this is only for chromecast audio… However I can not confirm this and its not mentioned in the binding information.
Its still not able to load the media, i think it most be some be some permission errors. Can you confirm that you uses openhabian on rpi? Did you get youtube to work aswell?
I don’t use openHABbian on pi.
I use a standard installation on a linux box (Ubuntu)
YouTube works too.
I don’t know why your set-up doesn’t work, sorry
Thanks for your effort though, I suspect the openhabian user doesn’t have the right permission to cast. Because I can see the video if I double click on it on the samba share. So has anyone out here been able to cast video on an openhabian setup?