[ENGLISH PLEASE] Very simple "notify / if" NOOB question

Begonnen von xypzo, 20 August 2017, 15:22:10

Vorheriges Thema - Nächstes Thema

xypzo

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



Bennemannc

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
Cubietruck, Fhem 5.8
CC-RT-DN|LC-SW2-FM|RC-12|RC-19|LC-SW4-BA-PCB|LCp-SW1-BA-PCB|ES-PMSw1-Pl|LC-Bl1PBU-FM|PBI-4-FM|CC-VD|CC-TC|SEC-SC(2)|RC-KEY3-B|LC-Sw1PBU-FM|PB-2-FM|WDS100-C6-O|WDC7000|LC-Bl1-FM
Module: Dewpoint,FB_Callmonitor,HCS,Panstamp,at,notify,THRESHOLD,average,DOIF

Otto123

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
Viele Grüße aus Leipzig  ⇉  nächster Stammtisch an der Lindennaundorfer Mühle
RaspberryPi B B+ B2 B3 B3+ ZeroW,HMLAN,HMUART,Homematic,Fritz!Box 7590,WRT3200ACS-OpenWrt,Sonos,VU+,Arduino nano,ESP8266,MQTT,Zigbee,deconz

xypzo


xypzo

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|


Prof. Dr. Peter Henning

Use DOIF for that, it allows numerical comparison as well as logical conditions.

LG

pah

xypzo

Cool thanks, never checked that function out actually.

xypzo

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?