FHEM Forum

FHEM => Anfängerfragen => Thema gestartet von: xypzo am 20 August 2017, 15:22:10

Titel: [ENGLISH PLEASE] Very simple "notify / if" NOOB question
Beitrag von: xypzo am 20 August 2017, 15:22:10
Hi

I am trying to get my sunshades down automaticly when the measured light level is above 10000 lux.

Sensor: Licht_RegenSensor1
Reading: brightness (value between 0 and 50000 or so)
Sunshade: Zonnescherm (up or down command)

So i tried:
define ZonneschermLichtDown notify Licht_RegenSensor1:.*brightness:.*>10000.* set Zonnescherm down
define ZonneschermLichtDown notify IF ([Licht_RegenSensor1:brightness] > 10000) (set Zonnescherm down)


and about 10 variants on this, but nothing works.

Anybody have a good idea about this?
thanks, Peter


Titel: Antw:[ENGLISH PLEASE] Very simple "notify / if" NOOB question
Beitrag von: Bennemannc am 20 August 2017, 15:32:47
Hello,

first of all - I used THRESHOLD for things like this. If you use IF you may use ReadingsVal to get the value of the Reading brigtness.
define xxx notify Sensor:brightness IF (ReadingsVal(Sensor, reading, default) > 10000) (set ....)

Gruß Christoph
Titel: Antw:[ENGLISH PLEASE] Very simple "notify / if" NOOB question
Beitrag von: Otto123 am 20 August 2017, 15:48:02
Hi Peter,

the important hint from Christoph is: you need a trigger pattern!
ZitatDefine
define <name> notify <pattern> <command>

Execute a command when received an event for the definition <pattern>.

In your case the device Licht_RegenSensor1 could be the trigger or more sharp: a certain event from this device - may be Licht_RegenSensor1:brightness or Licht_RegenSensor1:.*brightness:.*
I don't know the events from this device. You could use the Event monitor to look for Events and generate the notify himself!

Especially for "IF" the syntax IF ([Licht_RegenSensor1:brightness] > 10000) (set Zonnescherm down) should be working too. In the same way like IF (ReadingsVal(Sensor, reading, default) > 10000) (set ....)

Regards Otto
Titel: Antw:[ENGLISH PLEASE] Very simple "notify / if" NOOB question
Beitrag von: xypzo am 20 August 2017, 18:35:27
Thanks guys, I am going to try some stuff out!
Titel: Antw:[ENGLISH PLEASE] Very simple "notify / if" NOOB question
Beitrag von: xypzo am 20 August 2017, 19:02:31
Ok, so this works:

define ZonneschermLicht THRESHOLD Licht_RegenSensor1:brightness:6000:10000 Zonnescherm|set @ down|set @ up

But I want to add a second reading; rain. If it rains, it should never go out.

Would that be something like:

define ZonneschermLicht THRESHOLD Licht_RegenSensor1:brightness:6000:10000 AND Licht_RegenSensor1:regen1:off Zonnescherm|set @ down|set @ up|

Titel: Antw:[ENGLISH PLEASE] Very simple "notify / if" NOOB question
Beitrag von: Prof. Dr. Peter Henning am 20 August 2017, 19:25:49
Use DOIF for that, it allows numerical comparison as well as logical conditions.

LG

pah
Titel: Antw:[ENGLISH PLEASE] Very simple "notify / if" NOOB question
Beitrag von: xypzo am 20 August 2017, 22:23:30
Cool thanks, never checked that function out actually.
Titel: Antw:[ENGLISH PLEASE] Very simple "notify / if" NOOB question
Beitrag von: xypzo am 10 September 2017, 11:50:03
Ok, to make it a little more difficult  ;D :

I need a buffer. I want the sunscreen to not DIRECTLY respond, but when the lux value has been over/under threshold for a specific time (say, 2 minutes). Is that possible?