- alias: "Open shutters in the morning if motion detected"
trigger:
platform: state
entity_id: binary_sensor.fibaro_system_fgms001_motion_sensor_sensor_24_0
to: 'on'
action:
- condition: template
value_template: '{{ states.cover.fibaro_system_fgrm222_roller_shutter_controller_2_level_21_0.attributes.current_position < 95 }}'
- condition: time
after: '07:20:00'
- condition: time
before: '11:00:00'
- service: homeassistant.turn_on
entity_id: script.shutter_living_up
Today I detected the following happening: The shutter went up in the morning after it detected me. In the evening I get back from work and as it darkens I press the shutter down button in the wall. The shutter goes down for probably about 5-10% (first condition?) and then the shutter gets up again to be fully opened to then just go down again to close fully! I tested once and the shutter went 5% down, went up and then down to 100% closed and then (that was special!) it went up again to fully opened…
For testing purposes I changed the condition time before to 21:00 and triggered the automation by walking by the motion sensor. Then I disabled the automation at the time where the shutter went up fully. Then I pressed the shutter button and the shutter went down as it should. So everything is fine when the automation is deactivated… Not a problem of the fibaro shutter as it seems.
Ive seen this come up a few times, it seems that putting the conditions in the actions either a) doesn’t work as you and I suspect or b) needs some notation added as a number of people are running into the issue.
My solution to the issue is the same as yours and Zens. I know that method works.
Yeah, add my voice to the choir here. I gave up trying to make them work and use the same method and run into less issues trying to make things work and more time enjoying automations.
I have a rain notification that I like to limit to no more than once every thirty minutes. This is the quick and dirty way I do it - no doubt others will show you their way as well. In my case, I just turn off the automation and add a delay as one of the actions. Then after the delay I turn it back on.
# Rain Alert
- alias: 'Raining'
trigger:
platform: state
entity_id: sensor.dark_sky_precip_intensity
from: '0'
action:
- service: tts.google_say
entity_id: media_player.living_room_home
data_template:
message: 'Excuse me Robert, but is currently {{ states.sensor.dark_sky_precip.state }}ing and it is {{ states.sensor.dark_sky_temperature.state | int }}degrees outside. Forecast says {{ states.sensor.dark_sky_minutely_summary.state }}.'
cache: false
- service: automation.turn_off
entity_id: automation.raining
- delay: 00:30:00
- service: automation.turn_on
entity_id: automation.raining
That’s an elegant way! Didn’t think it through this way It’s obvious I don’t have the the full overview of all the HASS components.
Something I’am trying at the moment is:
- alias: "turn off stair ligth after 10 minutes without motion"
trigger:
platform: template
value_template: "{{ as_timestamp(now()) - as_timestamp(states.binary_sensor.fibaro_system_fgms001_motion_sensor_sensor_14_0.last_changed) > 600 }}"
action:
- service: switch.turn_off
data:
entity_id: switch.fibaro_system_fgs223_double_relay_switch_28_0
So the key is a value_template: value_template: "{{ as_timestamp(now()) - as_timestamp(states.YOUR-ENTITY-ID.last_changed) > 600 }}"
For 24h it has to check against 86400 seconds. It’s a start but not much more… The condition checks the time from last change and this is not always the same moment. I have to think about an aditional “or condition” to reenable my automation somehow.
It’s my understanding that condition: and connects all child conditions with an logical and. So the result is only true if everything is true.
The first scheme does not work. It says mapping not allowed.
Second works but the shutters run crazy as initially posted: I can reconstruct the behavior most of the time. I let trigger the automation by moving by the motion sensor and wait till the shutters are up. Then I wait past the before time (11:00:00) press the shutter to go down and go by the motion sensor to trigger the automation again while the shutter is moving down. And tada: The shutter suddenly (or not suddenly, it’s the motion sensor I suspect!) goes up completely first (while it was going down!). At top arrived it starts rolling down again.
Now everything works again as expected… I don’t understand it anymore. Perhaps the upgrade of HASS changed something. I have to observe more and come back again.
Yesterday I had a lot of ghost movement again. Nothing was in the logs and specially no z-wave commands were sent. It had to be the fibaro device itself.
Searching the web gave a clue (don’t know anymore where I found it): set parameter 29 - the calibration mode - of the devices manually to 0. The manual says the parameter 29 is automatically set back to 0 after you changed it to 1. In calibration mode your fibaro device goes up once and down once.
Perhaps this problem is solved with newer firmware. At the moment there is no existing solution that I know of to update the firmware of fibaro devices without using fibaro’s home center.
Long story short: Change parameter 29 to 0 manually for your fibaro fgmr-222 / fgr-222 if you have ghost movements.
Two months later I still have ghost movements. I think my shutter devices randomly start to calibrate themselves… No idea why.
@Zen: You have fibaro shutters, don’t you? Have you never seen ghost movements or unwanted calibrations?
I am desperate. Perhaps I need to upgrade the firmware. But I’m not aware of any upgrade function without involving a fibaro home center. That’s an enormous disadvantage of fibaro devices.