-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improve alarm message (low battery) #4805
base: master
Are you sure you want to change the base?
Conversation
BTW, what is the difference between ALARM_LOW_BATTERY and ALARM_LOW_POWER, @tananaev? |
templates/full/alarm.vm
Outdated
@@ -1,9 +1,16 @@ | |||
#set($subject = "$device.name: alarm!") | |||
#{if} ($position.getString("alarm") == "lowBattery") | |||
#set($batteryPercentage = $position.getString('batteryLevel')) | |||
#set($batteryVolts = $position.getString('battery')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe batteryVoltage
for consistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed.
templates/full/alarm.vm
Outdated
#{if} ($position.getString("alarm") == "lowBattery") | ||
#set($batteryPercentage = $position.getString('batteryLevel')) | ||
#set($batteryVolts = $position.getString('battery')) | ||
#set($batteryString = " (#{if}(${batteryPercentage})${batteryPercentage}% #{else}#${end}#{if}(${batteryVolts})${batteryVolts}V#{else}#${end})") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove trailing space?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added space between lowBattery
and the opening bracket on purpose so that it looks like this:
DeviceA alarm: lowBattery (11.2V) at 2022-01-29 06:05:24
instead of this
DeviceA alarm: lowBattery(11.2V) at 2022-01-29 06:05:24
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm talking about trailing space after the %.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
templates/short/alarm.vm
Outdated
#set($batteryVolts = $position.getString('battery')) | ||
#set($batteryString = " (#{if}(${batteryPercentage})${batteryPercentage}% #{else}#${end}#{if}(${batteryVolts})${batteryVolts}V#{else}#${end})") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Low power means low external power (e.g. vehicle battery). Low battery means low internal battery in the device. |
So |
Correct. I guess you can add a short note there. |
@@ -46,11 +46,11 @@ | |||
public static final String KEY_VIDEO = "video"; | |||
public static final String KEY_AUDIO = "audio"; | |||
|
|||
// The units for the below four KEYs currently vary. | |||
// The units for the below six KEYs currently vary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove this completely.
#{if} ($position.getString("alarm") == "lowBattery") | ||
#set($batteryPercentage = $position.getString('batteryLevel')) | ||
#set($batteryVoltage = $position.getString('battery')) | ||
#{if} ($batteryPercentage || $batteryVoltage) | ||
#set($batteryInfo = " (${batteryPercentage}%${batteryVoltage}V)") | ||
#{else} | ||
#set($batteryInfo = "") | ||
#{end} | ||
#{else} | ||
#set($batteryInfo = "") | ||
#{end} | ||
#{if} ($position.getString("alarm") == "lowPower") | ||
#set($powerVoltage = $position.getString('power')) | ||
#{if} (${powerVoltage}) | ||
#set($powerInfo = $numberTool.format(" (0.0V)", $powerVoltage)) | ||
#{else} | ||
#set($powerInfo = "") | ||
#{end} | ||
#{else} | ||
#set($powerInfo = "") | ||
#{end} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please provide examples of what you expect it to look like in different scenarios.
No description provided.