Skip to content

Commit 38ee79a

Browse files
committed
Add SHOWBATTERYLEVEL action
1 parent 7288dd6 commit 38ee79a

File tree

5 files changed

+17
-9
lines changed

5 files changed

+17
-9
lines changed

config.example.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ key_mapping:
3030
BUTTON_CLICK:
3131
- "OPENHAB.Switch.TOGGLE"
3232
- "OPENHAB.CustomSwitch.TOGGLEIFPLAYER" # Workaround making default Player elements work without extra config. Toggles PLAY/PAUSE if it's a player element.
33-
SWIPE_UP: "MENUE.PARENT"
34-
SWIPE_DOWN: "MENUE.CHILD"
33+
#SWIPE_UP: "MENUE.PARENT"
34+
SWIPE_DOWN: "MENUE.SHOWBATTERYLEVEL"
3535
SWIPE_LEFT:
3636
- "OPENHAB.CustomSwitch.<<" # Workaround making default Player elements work without extra config
3737
SWIPE_RIGHT:

examples/keymaps/default.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ key_mapping:
1212
BUTTON_CLICK:
1313
- "OPENHAB.Switch.TOGGLE"
1414
- "OPENHAB.CustomSwitch.TOGGLEIFPLAYER" # Workaround making default Player elements work without extra config. Toggles PLAY/PAUSE if it's a player element.
15-
SWIPE_UP: "MENUE.PARENT"
16-
SWIPE_DOWN: "MENUE.CHILD"
15+
#SWIPE_UP: "MENUE.PARENT"
16+
SWIPE_DOWN: "MENUE.SHOWBATTERYLEVEL"
1717
SWIPE_LEFT:
1818
- "OPENHAB.CustomSwitch.<<" # Workaround making default Player elements work without extra config
1919
SWIPE_RIGHT:

led_icons

Submodule led_icons updated from e2eda42 to be949fc

nuimo_menue/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ Changes the mode currently active to the specified `mode_name`.
1616

1717
Shows the icon of the app currently active via LED matrix
1818

19+
### SHOWBATTERYLEVEL
20+
21+
Shows the battery level of the Nuimo on the LED matrix (the icon schema configured by the `rotation_icon` parameter
22+
within config.yml is used).
23+
1924
### PREVIOUS
2025

2126
Changes the currently active app to the previous app and shows the icon of the previous app via LED matrix.

nuimo_menue/listener.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,19 @@ def handle_gesture_event(self, event):
5555
elif mappedCommand == "SHOWAPP":
5656
logging.debug("Name: "+self.nuimoMenue.getCurrentApp().getName())
5757
self.nuimoMenue.showIcon()
58-
elif mappedCommand == "WHEELNAVIGATION":
59-
self.wheelNavigation(event)
58+
elif mappedCommand == "SHOWBATTERYLEVEL":
59+
self.nuimoMenue.controller.display_matrix(nuimo.LedMatrix(icons["battery"]))
60+
time.sleep(1)
61+
self.showPercentageIcon(self.nuimoMenue.controller.battery_level)
62+
elif mappedCommand == "WHEELNAVIGATION": self.wheelNavigation(event)
6063

6164
if mappedCommand != "WHEELNAVIGATION":
6265
self.wheelReminder = 0
6366
else:
6467
gestureResult = self.nuimoMenue.getCurrentApp().getListener().received_gesture_event(event)
6568
if gestureResult is not None:
6669
if event.gesture == nuimo.Gesture.ROTATION:
67-
self.showRotationState(percent=gestureResult)
70+
self.showPercentageIcon(percent=gestureResult)
6871
else:
6972
self.show_command_icon(fqCommand=gestureResult)
7073

@@ -113,7 +116,7 @@ def wheelNavigation(self, event):
113116
self.nuimoMenue.navigateToNextApp()
114117
self.wheelReminder = 0
115118

116-
def showRotationState(self, percent):
119+
def showPercentageIcon(self, percent):
117120
if "digit" in config["rotation_icon"]:
118121
self.showRotationStateDigits(percent)
119122
else:

0 commit comments

Comments
 (0)