Add update sensors notification command to Wear OS (#3774)

This commit is contained in:
Daniel Shokouhi 2023-08-10 10:55:54 -07:00 committed by GitHub
parent eb195b6687
commit 256835a380
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 3 deletions

View file

@ -154,7 +154,6 @@ class MessagingManager @Inject constructor(
const val COMMAND_BLUETOOTH = "command_bluetooth"
const val COMMAND_SCREEN_ON = "command_screen_on"
const val COMMAND_MEDIA = "command_media"
const val COMMAND_UPDATE_SENSORS = "command_update_sensors"
const val COMMAND_HIGH_ACCURACY_MODE = "command_high_accuracy_mode"
const val COMMAND_ACTIVITY = "command_activity"
const val COMMAND_WEBVIEW = "command_webview"
@ -213,7 +212,7 @@ class MessagingManager @Inject constructor(
COMMAND_WEBVIEW,
COMMAND_SCREEN_ON,
COMMAND_MEDIA,
COMMAND_UPDATE_SENSORS,
DeviceCommandData.COMMAND_UPDATE_SENSORS,
COMMAND_LAUNCH_APP,
COMMAND_APP_LOCK,
COMMAND_PERSISTENT_CONNECTION,
@ -477,7 +476,7 @@ class MessagingManager @Inject constructor(
sendNotification(jsonData)
}
}
COMMAND_UPDATE_SENSORS -> SensorReceiver.updateAllSensors(context)
DeviceCommandData.COMMAND_UPDATE_SENSORS -> SensorReceiver.updateAllSensors(context)
COMMAND_LAUNCH_APP -> {
if (!jsonData[PACKAGE_NAME].isNullOrEmpty()) {
handleDeviceCommands(jsonData)

View file

@ -13,6 +13,7 @@ object DeviceCommandData {
const val COMMAND_BEACON_MONITOR = "command_beacon_monitor"
const val COMMAND_BLE_TRANSMITTER = "command_ble_transmitter"
const val COMMAND_UPDATE_SENSORS = "command_update_sensors"
// Enable/Disable Commands
const val TURN_ON = "turn_on"

View file

@ -23,6 +23,7 @@ import io.homeassistant.companion.android.common.util.stopTTS
import io.homeassistant.companion.android.database.AppDatabase
import io.homeassistant.companion.android.database.notification.NotificationItem
import io.homeassistant.companion.android.database.sensor.SensorDao
import io.homeassistant.companion.android.sensors.SensorReceiver
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
@ -71,6 +72,7 @@ class MessagingManager @Inject constructor(
}
message == TextToSpeechData.TTS -> speakText(context, notificationData)
message == TextToSpeechData.COMMAND_STOP_TTS -> stopTTS()
message == DeviceCommandData.COMMAND_UPDATE_SENSORS -> SensorReceiver.updateAllSensors(context)
else -> sendNotification(notificationData, now)
}
}