Thanks for the hint.
Never thought about looking for an online editor & validator ^^ But used one as you mentioned.
Here’s what i get as respond on the nfirst 3 i tried:
(< unknown >): did not find expected key while parsing a block mapping at line 1 column 3
ERROR:
while parsing a block mapping
in “< unicode string >”, line 1, column 3:
- id: ‘1532005437294’
^
expected < block end >, but found ‘-’
in “< unicode string >”, line 19, column 3:
- delay: ‘30’
^
Error : You cannot define a sequence item when in a mapping
Line : undefined undefined
So, i’m not really able to make a head or tail of this …
Seems like there is a problem with the id. And what is a “block end”, which seems to be missing there?
it’s the indenting and spaces…and, not sure, but there’s a trailing _ after the entity_id motion_sensor. That seems incorrect, or at least incomplete…
try:
- id: '1532005437294'
alias: Flur AN durch Bewegung
trigger:
platform: state
entity_id: binary_sensor.tradfri_motion_sensor_
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: light.flur_2
state: 'off'
- condition: time
after: '19:00:00'
before: 01:00:00
action:
- service: light.turn_on
entity_id: light.flur_2
- delay: 00:00:30
- service: light.turn_off
entity_id: light.flur_2
After try and fail for a while i got it (and wanted to post it a bit earlier, in case someone has the same issue ^^):
i had to put a “-” in front of “data” in the “action” part.
Rest keeps the same, it works and hassibian does not complain any more.
But meanwhile i got another problem.
As mentioned the code keeps pretty much the same. But for better overview here it comes:
- id: '1532005437294'
alias: Flur AN durch Bewegung abends
trigger:
- entity_id: binary_sensor.tradfri_bewegungsmelder
from: 'off'
platform: state
to: 'on'
condition:
- condition: state
entity_id: light.flur_2
state: 'off'
- after: '19:00:00'
before: 01:00:00
condition: time
action:
- data:
entity_id: light.flur_2
service: light.turn_on
- delay: '30'
- data:
entity_id: light.flur_2
service: light.turn_off
I did an update to hassbian and deconz. This renamed my motion sensor device from “binary_sensor.tradfri_motion_sensor_” to “binary_sensor.tradfri_bewegungsmelder”. So it was just translated in german.
I noticed, that the automation was not working anymore, found this out and corrected the name in the automation rule.
There is nothing hassbian complains about! Also the rule seels to work first as i want, but now it ignores the condition
- condition: state
entity_id: light.flur_2
state: 'off'
so i got the same thing, which i try to prevent: when i turn on the light by hand, it should not turn off, when the motion sensor recognizes movement. The automation rule should not be triggered at all, as the condition is not met, but it is
I turn on the light by hand, walk through the room and 30 seconds later the light turns off itself.
PS: the rule still follows the condition “only by the time of 19h to 01h”.
So i’m confused, why it only follows one condition, but not the other
which would only be necessary for ‘or’ conditions.
Default is ‘and’ in which case one can simply list them, each condition having the ‘-’ in front.
btw, If you keep things tidy, automations become much easier to read.
For me that is beginning an action with the service, followed by the entity_id. If the service needs data to or from the entity_id, specify below the entity_id.
That would prevent the confusion here, about having to put a ‘-’ in front of the data field, which is not the case…
Note that for turning on/off a light, without further transitions or color settings, no data field is required.
same goes for the trigger…
entity_id: binary_sensor.tradfri_bewegungsmelder
from: ‘off’
platform: state
to: ‘on’
would better be written as:
- platform: state
entity_id: binary_sensor.tradfri_bewegungsmelder
from: 'off'
to: 'on'
see Automation Trigger - Home Assistant explaining the event is the trigger, on the various Platforms. List that first, then the entity_id, then the states being checked.
Ty guys.
This file was generated my HoAs, as i created a rule over GUI, so i tried to change as less as possible to avoid errors.
Just one more thing (so far ) :
I want to add another “time” for the light to switch on/off in the morning.
Will the “lights are off AND it’s 19 to 01 OR it’s 05 to 07” condition work?
Will the system read it like “X AND (Y OR Z)” or like “(X AND Y) OR Z” so i would have to add another X like “(X AND Y) OR (X AND Z)”?
not sure… maybe try to formulate this in Yaml first, then let us help?
btw, what is your binary_sensor.tradfri_bewegungsmelder ? Is that a self made binary? I have many physical sensors here, but not Hassio sensors are made, only these:
No On/Off…
Since they’re connected to lights, and those lights do have on/off states, one can (and i have done so) read motion/presence from the light being On/Off, and one can create a Binary sensor template for that? Is that what you have done?
I didn’t creaty anything by hand.
I installed deConz and connected only the motion sensor directly to my Rapsberry over the Phoscon GUI, instead to the Tradfri gateway (for mentioned reasons).
After this i just started the HoAs GUI and the motion sensor was auto-discovered. It also was discovered twice. Once as " binary_sensor.tradfri_bewegungsmelder" and once as “binary_sensor.vpir_bewegung” (bewegungsmelder = motion sensor and bewegung = motion)
As both are doing the same, i porefered to youse the “motion sensor” thing before VPIR
Yep, this is this module with additional GUI, which looks like Home Assistant “lite”.
It got just basic settings and replaces the Gateway adding just a bit more functionality.
If you want, i can add some screenshots vor overview
@Mariusthvdb i rearranged my automations, so i think this looks easier to read now, just as you mentioned …
- id: '0101'
alias: Flur ON
trigger:
- platform: state
entity_id: binary_sensor.tradfri_bewegungsmelder
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: light.flur_2
state: 'off'
- condition: or
conditions:
- condition: time
after: '19:00:00'
before: '01:00:00'
- condition: time
after: '05:00:00'
before: '07:00:00'
action:
- service: light.turn_on
entity_id: light.flur_2
- delay: 00:00:30
- service: light.turn_off
entity_id: light.flur_2
and also @Robban i guess i found the logical failure in my rule …
It’s not that easy and guess you could not see it.
My lights are called 1, 2 and 3 and they were summed up in a group “flur”. Also the group and the lights are arranged in Google Assistant in the room “flur”. BUT “light.flur_2” is only the group. So when i say "ok google, turn on “flur” google turn on all lights in the room “flur”, which means, it turns on 1, 2 and 3, but not the group element itself. This is why the rule keeps on triggering the lights, even i dont want it to.
I will rework this by tomorrow, so it wil take a look at 1, 2 and 3 to be all off, instead of the group.
trigger:
- platform: state
entity_id: binary_sensor.tradfri_bewegungsmelder
from: 'off'
to: 'on'
write:
trigger:
platform: state
entity_id: binary_sensor.tradfri_bewegungsmelder
to: 'on'
why? since you only have 1 trigger, you dont need the list '-' and since it is a binary_sensor, which is only On or Off, you can state only the to: or from: state, there’s no other option anyway
and you might want to change the id into something humanely understandable: simply use ‘Flur ON’ again.(you dont want to use the built-in editor anyway, so you might even leave it out completely…)
It’s me again
I cleaned up the code a bit and optimized my structure. So it works now, but still not as i want it to…
i tried different syntax, but found no working way except of listing lights 1, 2 and 3 as every own condition. maybe you know a nicer way?
the rule is not triggered in the morning, but works fine in the evening. My code seems to be right. Maybe you see anything wrong here?
as soon as i un-comment the data-brightness part, lights stay off. I can’t find a way to turn on lights by the brightness of like 10% (would be like 25 of 254). When commented out, they turn on by the brightness of last state. Any hints on this?
nice! indeed useful extensions to the regular ikea interface, and on the browser… I only have an App, which stopped working because i use iOs12 beta…
so all you do is put the Raspbee on the Hassio Pi, and then everything is supposed to find each other? Or do you have the Raspbee on another Pi than your Hassio?
Please. could you screenshot some of the HomeAssistant things this Raspbee creates? Frontend maybe, and the yaml configuration so I can get a better idea of how these 2 systems work together?
They recommend you to use one device per “server”. But i installed HA on the raspberry and installed deconz as standalone package. Then you just have to install the dependencies, which are missing (linux will do automaticly, when you tell it) and just activate the GPIO (which will deactivate your bluetooth on Pi 3!).
After this you go to HA frontend, Settings, Integrations and “pair” the deconz server with HA installation. Thats it.
Every device connected to deconz will be automaticly discovered by HA.
Screenshots will follow later
great. I take it you don’t use Hassio? Ot else how could you have installed the deconz as standalone package?
There is a Deconz import tool in the Hassio, but i dont suppose it would enable using only the Raspbee board on the Hassio/Pi.
Guess it’s a biot of missunderstanding …
I installed hassbian on my RPi 2. Then put the raspbee shield on it and installed deConz from git (downloading the deb file). Then you are able to run deconz and hassio at the same device and don’t need to splitz them.
Although you have not all features (as you have no real backend from deconz), but still you have the funcionality.
In addition:
Finnaly I splitted the rule into two identical with one time each.
Yesterday (and today) i noticed, the rule for the evening still works fine. The rule for the morning does not!
As the one rule is just an exact copy of the other, it must be the time-part, which breaks up