Hi Sondrev,
First – welcome to Home Assistant! You will love it and this community is awesome – extremely helpful.
One thing though, this community complains when people paste code that is not properly formatted. So click on the </> in the menu bar to paste code.
I have the Fibaro switches – generally happy. I did have to disable the LED when powered off to please my wife while sleeping – you do that by settings in Configuration / Zwave.
Here is sample of how I trigger via motion sensor (Fibaro) and turn on Light switch plug (Fibaro).
- alias: 'Motion in LR'
trigger:
platform: state
entity_id: binary_sensor.fibaro_system_fgms001zw5_motion_sensor_sensor
to: 'on'
action:
service: homeassistant.turn_on
entity_id: switch.fibaro_system_fgwpef_wall_plug_gen5_switch
BTW, you will also want to verify YAML with tools like LINT. I used to have problems with tabs inserted. I use Cloud9 IDE Add-in via Hassio add-ins (makes editing much easier). And when things break, check the HhomeAssistant.log file.
Enjoy, and ping back if your need help. I’m a student of HomeAssistant.
My apologies. I see now how that first code lost its formatting when I posted it. It looked fine when I pasted it, but i guess the “whitespace” goes away when you post it…
In my Config.yaml I have a line that says:
automation: !include automations.yaml
in the automations.yaml file I have the following code: (hopefully with formatting)
I haven’t done much with automations, but I do know that yaml file are very particular about indentations and capitalization.
Normal indents are 2 spaces, most things are lower case. i.e. action and service.
# Example of entry in configuration.yaml
automation:
# Turns on lights 1 hour before sunset if people are home
# and if people get home between 16:00-23:00
- alias: 'Rule 1 Light on in the evening'
trigger:
# Prefix the first line of each trigger configuration
# with a '-' to enter multiple
- platform: sun
event: sunset
offset: '-01:00:00'
- platform: state
entity_id: group.all_devices
to: 'home'
condition:
# Prefix the first line of each condition configuration
# with a '-'' to enter multiple
- condition: state
entity_id: group.all_devices
state: 'home'
- condition: time
after: '16:00:00'
before: '23:00:00'
action:
service: homeassistant.turn_on
entity_id: group.living_room
If automations are in a separate file (as they should be) you have to omit the “automation:” label and move the definitions to top-level. File should look like:
Also: Mind uppercase/lower case, usually it’s all lower-case. And - this type of automation can easily be modelled using the embedded automation editor (at the “Configuration” menu). And finally, I used “switch.turn_on” instead of “homeassistant.turn_on”, because the only entity is a switch, so no need to use the generic service.
Don’t know about the device tracker, I’ll assume that you group the tracked devices and check if the group is ‘home’ or ‘not_home’.
For the motion sensor: It depends. I have motion sensors that are binary_sensor type, so they are ‘on’ if movement is present and ‘off’ otherwise. I think that Fibaro is different with various numeric states.
So the trigger would be based on numeric state being at, above or below a certain value. Or you could use a template trigger, with an evaluation expression that resolves to True or False.