diff --git a/pwnagotchi/defaults.toml b/pwnagotchi/defaults.toml index 0dc692b7..7e51b672 100644 --- a/pwnagotchi/defaults.toml +++ b/pwnagotchi/defaults.toml @@ -9,8 +9,6 @@ main.whitelist = [ main.confd = "/etc/pwnagotchi/conf.d/" main.custom_plugin_repos = [ "https://github.com/jayofelony/pwnagotchi-torch-plugins/archive/master.zip", - "https://github.com/tisboyo/pwnagotchi-pisugar2-plugin/archive/master.zip", - "https://github.com/nullm0ose/pwnagotchi-plugin-pisugar3/archive/master.zip", "https://github.com/Sniffleupagus/pwnagotchi_plugins/archive/master.zip", "https://github.com/NeonLightning/pwny/archive/master.zip", "https://github.com/marbasec/UPSLite_Plugin_1_3/archive/master.zip" @@ -60,6 +58,8 @@ main.plugins.onlinehashcrack.dashboard = "" main.plugins.onlinehashcrack.single_files = false main.plugins.pisugarx.enabled = false +main.plugins.pisugarx.rotation = false +main.plugins.pisugarx.default_display = "percentage" main.plugins.session-stats.enabled = true main.plugins.session-stats.save_directory = "/var/tmp/pwnagotchi/sessions/" diff --git a/pwnagotchi/plugins/default/pisugarx.py b/pwnagotchi/plugins/default/pisugarx.py index 2f82b734..b8de3362 100644 --- a/pwnagotchi/plugins/default/pisugarx.py +++ b/pwnagotchi/plugins/default/pisugarx.py @@ -29,8 +29,11 @@ class PiSugar(plugins.Plugin): self._agent = None self.is_new_model = False self.options = dict() - conn, event_conn = connect_tcp() - self.ps = PiSugarServer(conn, event_conn) + try: + conn, event_conn = connect_tcp() + self.ps = PiSugarServer(conn, event_conn) + except Exception as e: + logging.error("[PiSugarX] error: %s" % repr(e)) self.ready = False self.lasttemp = 69 self.drot = 0 # display rotation @@ -96,14 +99,15 @@ class PiSugar(plugins.Plugin): padding-bottom: 10px; } table { - width: 100%; + width: 40%; border-collapse: collapse; margin: 20px 0; } table th, table td { border: 1px solid #ccc; - padding: 10px; + padding: 5px; text-align: left; + font-size: 12px; } table thead { background-color: #f9f9f9; @@ -129,26 +133,18 @@ class PiSugar(plugins.Plugin): ret += f''' Server version{self.ps.get_version()} PiSugar Model{self.ps.get_model()} - Firmware Version{self.ps.get_fireware_version() if self.ps.get_model() == 'Pisugar 3' else 'Not supported'} Battery Level{self.ps.get_battery_level()}% Battery Voltage{self.ps.get_battery_voltage()}V Battery Current{self.ps.get_battery_current()}A Battery LED Amount{self.ps.get_battery_led_amount() if self.ps.get_model() == 'Pisugar 2' else 'Not supported'} - Battery Power Plugged In{'Yes' if self.ps.get_battery_power_plugged() and self.is_new_model else 'No'} Battery Allow Charging{'Yes' if self.ps.get_battery_allow_charging() and self.is_new_model else 'No'} - Battery Charging Range{self.ps.get_battery_charging_range() if self.is_new_model or self.ps.get_model() == 'Pisugar 3' else 'Not supported'}% - Battery Charging{'Yes' if self.ps.get_battery_charging() else 'No'} - Battery Input Protect Enabled{'Yes' if self.ps.get_battery_input_protect_enabled() else 'No'} - Battery Output Enabled{'Yes' if self.ps.get_battery_output_enabled() else 'No'} + Battery Charging Range{self.ps.get_battery_charging_range() if self.is_new_model or self.ps.get_model() == 'Pisugar 3' else 'Not supported'} Duration of Keep Charging When Full{self.ps.get_battery_full_charge_duration} seconds Battery Safe Shutdown Level{self.ps.get_battery_safe_shutdown_level() if self.ps.get_battery_safe_shutdown_level() is not None else 'Not set'}% Battery Safe Shutdown Delay{self.ps.get_battery_safe_shutdown_delay()} seconds Battery Auto Power On{'Yes' if self.ps.get_battery_auto_power_on() else 'No'} - Battery Soft Power Off Enabled{'Yes' if self.ps.get_battery_soft_poweroff and self.ps.get_model() == 'Pisugar 3' else 'No'} + Battery Soft Power Off Enabled{'Yes' if self.ps.get_battery_soft_poweroff() and self.ps.get_model() == 'Pisugar 3' else 'No'} System Time{self.ps.get_system_time()} - RTC Time{self.ps.get_rtc_time()} - RTC Alarm Time{self.ps.get_rtc_alarm_time()} - RTC Alarm Enabled{'Yes' if self.ps.get_rtc_alarm_enabled() else 'No'} RTC Adjust PPM{self.ps.get_rtc_adjust_ppm() if self.ps.get_model() == 'Pisugar 3' else 'Not supported'} RTC Alarm Repeat{self.ps.get_rtc_alarm_repeat()} Single Tap Enabled{'Yes' if self.ps.get_tap_enable(tap='single') else 'No'}