I have a RaspPi running apache, php, and MPG123 and when I execute the above URL it will play a mp3 file named The_Front_Door_Has_Been_Opened.mp3 to a sound device (currently a powered speaker).
at that point you can use a browser on any machine to test and go to a test url http://192.168.0.201/sound.php?file=lgo&volume=100
if that works you add this code to the lower gate open scene on the vera
local http = require("socket.http")
-- 5 Second timeout
http.TIMEOUT = 5
result, status = http.request("http://192.168.0.201/sound.php?file=lgo&volume=95")
and when the scene exicutes the “sound playing RPi” server plays the sound.
I tried to execute the curl command from a terminal on several other RPis I have running and no joy.
well, I got my RPi and it’s up and running hassos.
I added the vera as a controler and it discovered all my “stuff”
While the documentation is fairly clear, it also assumes a higher level of understanding of the code.
I’m having trouble creating from scratch the equivalent of a vera scene.
I think if I had an example of HA/Vera code I could figure it out.
Can anyone using a vera show an example of your code with vera devices.
Basically, as and example, I’d like to turn on a light for 5 minutes after a door is opened and then off again and run this HA code along with the light coming on
so when door is opened
Kitchen_Door 1
Vera Device Id 65
binary_sensor.kitchen_door_1_65
turn on this light
Kit_Eat_Light_Dim
Vera Device Id 14
light.kit_eat_light_dim_14
I’m changing my example to the Laundry Room door and turning on two lights then off again. I’d also like to execute the playkitchenopen: curl “http://192.168.0.200/sound.php?file=kdo&volume=100” code but I’m not sure where or if I can in the blow code so I’m throwing it in as a WAG
auto.yaml
#################################################################
## Home Automation Related
#################################################################
- id: Laundry_Room_lights_on
alias: 'Turn on inside and outside LaundryRoom lights when door opened'
initial_state: 'on'
trigger:
- platform: state
entity_id: binary_sensor.laundyroomdoor_113
from: 'off'
to: 'on'
condition:
- condition: or
conditions:
- condition: state
entity_id: cover.LaundryRoom #<--- not sure what this was about,
state: 'closed'
- condition: state
entity_id: sun.sun
state: 'below_horizon'
action:
service: light.turn_on
data:
entity_id: light.laundryroom_29
data:
entity_id: light.lrdooroutside_123
brightness: 255
shell_command:
playLRDopen: curl “http://192.168.0.200/sound.php?file=ldo&volume=100”
and then turn the two lights off after a few minutes
- id: Laundry_Room_lights_off
alias: 'Turn off Laundry room lights'
initial_state: 'on'
trigger:
- platform: state
entity_id: binary_sensor.laundyroomdoor_113
to: 'off'
for: '00:00:30'
- platform: state
entity_id: light.laundryroom_29
to: 'on'
for: '00:05:00'
entity_id: light.lrdooroutside_123
to: 'on'
for: '00:05:00'
condition:
- condition: state
entity_id: light.laundryroom_29
state: 'on'
- condition: state
entity_id: light.lrdooroutside_123
state: 'on'
action:
service: light.turn_off
entity_id: light.laundryroom_29
entity_id: light.lrdooroutside_123
I’m I doing this right or do I need to call a script?
I’m thinking I don’t need this part as it came from a GARAGE door example
```
- condition: state
entity_id: cover.LaundryRoom #<--- not sure what this was about,
state: 'closed'
```
here is a test automation I plan to try when I get home
- id: frontdoor_open
alias: Front Door Open
trigger:
- platform: state
entity_id: binary_sensor.front_door_1_67
from: 'off'
to: 'on'
action:
- service: shell_command.play_fdo_sound
shell_command:
play_fdo_sound: curl "http://192.168.0.201/sound.php?file=fdo&volume=100"
- id: frontdoor_open
alias: Front Door Open
trigger:
- platform: state
entity_id: binary_sensor.front_door_1_67
from: 'off'
to: 'on'
action:
- service: rest_command.play_fdo_sound
rest_command:
play_fdo_sound:
url: 'http://192.168.0.201/sound.php?file=fdo&volume=100'