Closed tabilzad closed 3 years ago
Hey thx for reporting this issue...I will look at it soon.
You cannot call this method from the main function since it would be called before KHOME is fully ready. Usually you do not want to get a message directly after starting your (khome) application. But if you want to you can do it like this:
fun main() {
KHOME.onApplicationReady {
KHOME.notifyMobileApp(Device.from("mmy_phone")) {
title = "Application ready"
message = "KHOME is ready to serve you."
}
}
KHOME.runBlocking()
}
Otherwise just use KHOME::notifyMobileApp
from any other observable like this:
val KHOME = khomeApplication()
val gardenShedContact = KHOME.ContactSensor("gardenshed".objectId)
fun main() {
gardenShedContact.onOpened {
KHOME.notifyMobileApp(Device.from("my_phone")) {
title = "INTRUDER ALARM"
message = "Garden shed door opened"
}
}
KHOME.runBlocking()
}