Hi All, ive found a way to display the next alarm time set on our android phone, so u can display it in pimatic or let pimatic do thinks for you after you wake up based on your alarm time.
IMPORTANT: in the lines DATA/File the space between this \ " ‘%alarm’ \ " should be deleted, its because the forum format delete it when i wrote it without space here.
What does it do?
The Task looks first if you are at home in your network,
after that it sets a variable with day of next alarm and the alarm time, after that it splits the raw variable to use the time.
Now it test if alarm is on or off on your phone, if it is off it sends an off string to pimatic and stop the task, if it is on it sends the time, the day_time and a on string.
Pimatic Setup:
- Add Variable $alarm
- Add Variable $alarm_day
- Add Variable $alarm_status
Tasker Setup:
- go to Setting and klick UI
- disable beginner mode
- go to main menu and then to VAR
- Add Variable %address with your pimatic ip
- Add Variable %user with your username
- Add Variable %pass with your password
- Add a Task with the following
Test Net with type SSID, result %wifi
If %wifi = YOURWIFI SSID
Auto Alarm
Set Variable %alarm to %raw
Split Variable %alarm Splitter: .,
If %alarm2 is set
Else If %alarm2 is not set
HTTP Post
Server:Port http://USER:PASS@YOURIP:PORT
Path: api/execute-action
Data/File: {"actionString":"set $alarm_status to \ "%off\ ""}
Content Typ: application/json
EndIf
If
HTTP Post
Server:Port http://%user:%pass@%address
Path: api/execute-action
Data/File: {"actionString":"set $alarm_status to \ "%on\ ""}
Content Typ: application/json
HTTP Post
Server:Port http://%user:%pass@%address
Path: api/execute-action
Data/File: {"actionString":"set $alarm_status to \ "%alarm2\ ""}
Content Typ: application/json
HTTP Post
Server:Port http://%user:%pass@%address
Path: api/execute-action
Data/File: {"actionString":"set $alarm_status to \ "%alarm\ ""}
Content Typ: application/json
EndIf
EndIf
- go to Profil
- Add Profile (APP -> click Service and choice Clock)
Click long on the green arrow in the contexmenu click … to exit so the file changes to red.
Then the task will be executet when you left your clock/alarm set menu and gives the values pimatic
Now you can create your Rule:
if it is $alarm and $alarm_status is "on" then turn on the Radio
You can additionale add a Variable device, to show the next alarm in pimatic.
{
"variables": [
{
"name": "Next Alarm",
"expression": "$alarm_day",
"type": "string",
"label": "",
"discrete": false
},
{
"name": "Alarm Status",
"expression": "$alarm_status",
"type": "string",
"label": "",
"discrete": false,
"acronym": "Alarm"
} ],
"xLink": "",
"id": "alarm",
"name": "Alarm",
"class": "VariablesDevice"
}
@sweetpi it will be nice if we could do something like this:
if it is 1 minute after $alarm then turn Radio on
because when i decide to sleep 15 minutes longer, is set the alarm to + 15 minute. so the pimatic value change and the rule not trigger, so actually the rule triggers when the android alarm starts.
let me know if it works for you.
Thanks