Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

soshial
Copy link
Contributor

@soshial soshial commented Jan 29, 2022

No description provided.

@soshial
Copy link
Contributor Author

soshial commented Jan 29, 2022

BTW, what is the difference between ALARM_LOW_BATTERY and ALARM_LOW_POWER, @tananaev?

@@ -1,9 +1,16 @@
#set($subject = "$device.name: alarm!")
#{if} ($position.getString("alarm") == "lowBattery")
#set($batteryPercentage = $position.getString('batteryLevel'))
#set($batteryVolts = $position.getString('battery'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe batteryVoltage for consistency?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed.

#{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})")
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Member

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 %.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment on lines 4 to 5
#set($batteryVolts = $position.getString('battery'))
#set($batteryString = " (#{if}(${batteryPercentage})${batteryPercentage}% #{else}#${end}#{if}(${batteryVolts})${batteryVolts}V#{else}#${end})")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@tananaev
Copy link
Member

Low power means low external power (e.g. vehicle battery). Low battery means low internal battery in the device.

@soshial
Copy link
Contributor Author

soshial commented Jan 29, 2022

Low power means low external power (e.g. vehicle battery). Low battery means low internal battery in the device.

So KEY_POWER = "power" is for vehicle battery and KEY_BATTERY = "battery" is for internal device battery?
May I add a short documentation to the Position class to these constants?

@tananaev
Copy link
Member

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.
Copy link
Member

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.

Comment on lines +2 to +22
#{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}
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants