• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dimlevel to set Alarm Clock
#1
Hi,

I would like to turn on my light at a specific time as an alarm.

I managed to create the rule to turn the light on at given time in the rule.

But now I would like to set the time via the GUI, so I created two "generic-dimmers" to set the hour and minute and used xxx.dimlevel as a variable in the rule. Unfortunately it's not working.

My code:

Code:
"devices": {
"alarm_switch": {
            "protocol": [ "generic_switch" ],
            "id": [{
                "id": 9001
            }],
            "state": "off"    
        },
        "set_alarm_hour": {
            "protocol": [ "generic_dimmer" ],
            "id": [{
                "id": 9002
            }],
            "state": "off",
            "dimlevel": 0,
            "dimlevel-maximum": 24    
        },
        "set_alarm_minute": {
            "protocol": [ "generic_dimmer" ],
            "id": [{
                "id": 9003
            }],
            "state": "off",
            "dimlevel": 0,
            "dimlevel-maximum": 59    
        }
}

Code:
"rules": {
        "WeckerJonas": {
            "rule": "IF (date_time.hour == set_alarm_hour.dimlevel AND date_time.minute == set_alarm_minute.dimlevel AND date_time.second == 0 AND Steckdose2B.state IS off) AND alarm_switch IS on THEN switch DEVICE Steckdose2B TO on",
            "active": 1

Code:
"gui": {
"alarm_switch": {
            "name": "Wecker an/aus",
            "group": [ "Jonas" ],
            "media": [ "all" ]
        },
        "set_alarm_hour": {
            "name": "Weckzeit (Stunde)",
            "group": [ "Jonas" ],
            "media": [ "all" ]
        },
        "set_alarm_minute": {
            "name": "Weckzeit (Minute)",
            "group": [ "Jonas" ],
            "media": [ "all" ]
        }
        
    },
Thanks a lot!
 
Reply
#2
Please replace the php tags you used by code tags to make your post better readable.

In your config the "date_time" device you are refering in your rule is missing.
 
Reply
#3
(02-02-2017, 07:56 PM)Niek Wrote: Please replace the php tags you used by code tags to make your post better readable.

In your config the "date_time" device you are refering in your rule is missing.

I replaced it.

date_time is there, I just didn't post it. If I specifiy a value for the time in the rule, the rule is working.

Code:
    "date_time": {
            "protocol": [ "datetime" ],
            "id": [{
                "longitude": 11.5761,
                "latitude": 48.1371
            }],
            "year": 2017,
            "month": 2,
            "day": 2,
            "hour": 15,
            "minute": 58,
            "second": 20,
            "dst": 1,
            "weekday": 5
        },

Code:
    "rules": {
        "WeckerJonas": {
            "rule": "IF (date_time.hour == 5 AND date_time.minute == 0 AND date_time.second == 0 AND Steckdose2B.state IS off) AND alarm_switch IS on THEN switch DEVICE Steckdose2B TO on",
            "active": 1
            }

Thanks!
 
Reply
#4
Normally this rules with generic dimmers work very well.
I use many of them in my setup.
My project

I think you have to use

Code:
.... AND alarm-switch.state IS on ...

You forgot ".state"
Terrarium:  RPi Model B Rev 2 / pilight 8.1.2 / stretch
Aquarium: RPi Model B Plus Rev 1.2 / pilight 8.0.6 / jessie
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  alarm system using pilight rbrueckner 4 2,296 05-14-2016, 12:24 PM
Last Post: diman87
  pass dimlevel as argument to program device droptix 5 2,504 10-25-2015, 09:43 AM
Last Post: droptix

Forum Jump:


Browsing: 1 Guest(s)