diff --git a/locales/en_US/LC_MESSAGES/terrariumpi.mo b/locales/en_US/LC_MESSAGES/terrariumpi.mo index b0c6b6ca1..88d3cc316 100644 Binary files a/locales/en_US/LC_MESSAGES/terrariumpi.mo and b/locales/en_US/LC_MESSAGES/terrariumpi.mo differ diff --git a/locales/en_US/LC_MESSAGES/terrariumpi.po b/locales/en_US/LC_MESSAGES/terrariumpi.po index 89987a85c..506be79c4 100644 --- a/locales/en_US/LC_MESSAGES/terrariumpi.po +++ b/locales/en_US/LC_MESSAGES/terrariumpi.po @@ -5,8 +5,8 @@ msgid "" msgstr "" "Project-Id-Version: TerrariumPI 3.9.3\n" -"POT-Creation-Date: 2019-01-13 16:33+CET\n" -"PO-Revision-Date: 2019-01-13 16:34+0100\n" +"POT-Creation-Date: 2019-01-28 22:45+CET\n" +"PO-Revision-Date: 2019-01-28 22:45+0100\n" "Last-Translator: Joshua (TheYOSH) Rubingh \n" "Language-Team: \n" "Language: en_US\n" @@ -520,78 +520,78 @@ msgstr "Holds a link to more information." msgid "Offline since" msgstr "Offline since" -#: terrariumWebserver.py:92 terrariumWebserver.py:172 +#: terrariumWebserver.py:92 terrariumWebserver.py:178 msgid "Authenticate to make any changes" msgstr "Authenticate to make any changes" -#: terrariumWebserver.py:92 terrariumWebserver.py:172 +#: terrariumWebserver.py:92 terrariumWebserver.py:178 #: views/system_settings.tpl:28 msgid "TerrariumPI" msgstr "TerrariumPI" -#: terrariumWebserver.py:92 terrariumWebserver.py:172 +#: terrariumWebserver.py:92 terrariumWebserver.py:178 #: views/system_settings.tpl:120 msgid "Authentication" msgstr "Authentication" -#: terrariumWebserver.py:226 +#: terrariumWebserver.py:232 msgid "Player command could ot be executed!" msgstr "Player command could ot be executed!" -#: terrariumWebserver.py:226 terrariumWebserver.py:246 -#: terrariumWebserver.py:258 terrariumWebserver.py:266 +#: terrariumWebserver.py:232 terrariumWebserver.py:252 +#: terrariumWebserver.py:264 terrariumWebserver.py:272 msgid "Error!" msgstr "Error!" -#: terrariumWebserver.py:234 terrariumWebserver.py:237 +#: terrariumWebserver.py:240 terrariumWebserver.py:243 msgid "OK!" msgstr "OK!" -#: terrariumWebserver.py:234 terrariumWebserver.py:237 +#: terrariumWebserver.py:240 terrariumWebserver.py:243 msgid "Player command executed!" msgstr "Player command executed!" -#: terrariumWebserver.py:246 +#: terrariumWebserver.py:252 msgid "File is not uploaded!" msgstr "File is not uploaded!" -#: terrariumWebserver.py:251 +#: terrariumWebserver.py:257 msgid "File '%s' is uploaded" msgstr "File '%s' is uploaded" -#: terrariumWebserver.py:251 terrariumWebserver.py:261 +#: terrariumWebserver.py:257 terrariumWebserver.py:267 msgid "Success!" msgstr "Success!" -#: terrariumWebserver.py:253 +#: terrariumWebserver.py:259 msgid "Duplicate file '%s'" msgstr "Duplicate file '%s'" -#: terrariumWebserver.py:258 +#: terrariumWebserver.py:264 msgid "Action could not be satisfied" msgstr "Action could not be satisfied" -#: terrariumWebserver.py:261 +#: terrariumWebserver.py:267 msgid "Audio file is deleted" msgstr "Audio file is deleted" -#: terrariumWebserver.py:266 +#: terrariumWebserver.py:272 msgid "Data could not be saved" msgstr "Data could not be saved" -#: terrariumWebserver.py:274 +#: terrariumWebserver.py:280 msgid "Data saved" msgstr "Data saved" -#: terrariumWebserver.py:275 +#: terrariumWebserver.py:281 msgid "Your changes are saved" msgstr "Your changes are saved" -#: terrariumWebserver.py:403 views/inc/menu.tpl:171 +#: terrariumWebserver.py:416 views/inc/menu.tpl:171 msgid "Log out" msgstr "Log out" -#: terrariumWebserver.py:404 +#: terrariumWebserver.py:417 msgid "You are now logged out" msgstr "You are now logged out" @@ -1120,7 +1120,7 @@ msgstr "Year" #: views/dashboard.tpl:794 views/dashboard.tpl:849 views/dashboard.tpl:904 #: views/dashboard.tpl:959 views/dashboard.tpl:1014 views/dashboard.tpl:1069 #: views/dashboard.tpl:1124 views/door_status.tpl:40 -#: views/inc/sensor_list.tpl:49 views/switch_status.tpl:40 +#: views/inc/sensor_list.tpl:49 views/switch_status.tpl:43 msgid "Export data" msgstr "Export data" @@ -2583,6 +2583,14 @@ msgstr "Dimmer environment step" msgid "No switches available" msgstr "No switches available" +#: views/switch_status.tpl:11 +msgid "in manual mode" +msgstr "in manual mode" + +#: views/switch_status.tpl:40 +msgid "Manual mode" +msgstr "Manual mode" + #: views/system_environment.tpl:16 msgid "Here you can configure your environment." msgstr "Here you can configure your environment." @@ -2998,14 +3006,14 @@ msgstr "When open" msgid "When closed" msgstr "When closed" -#: Missing text string -msgid "1Wire bus" -msgstr "1Wire bus" - #: Missing text string msgid "1Wire DS18B20 wiring scheme" msgstr "1Wire DS18B20 wiring scheme" +#: Missing text string +msgid "1Wire bus" +msgstr "1Wire bus" + #: Missing text string msgid "1Wire sensor 1" msgstr "1Wire sensor 1" @@ -3058,10 +3066,6 @@ msgstr "Current value" msgid "Current weather widget screenshot" msgstr "Current weather widget screenshot" -#: Missing text string -msgid "Delete file" -msgstr "Delete file" - #: Missing text string msgid "DHT22 GPIO wiring scheme" msgstr "DHT22 GPIO wiring scheme" @@ -3070,6 +3074,10 @@ msgstr "DHT22 GPIO wiring scheme" msgid "DHT22 temperature and humidity sensor" msgstr "DHT22 temperature and humidity sensor" +#: Missing text string +msgid "Delete file" +msgstr "Delete file" + #: Missing text string msgid "Dimmer environment step in %" msgstr "Dimmer environment step in %" @@ -3078,14 +3086,14 @@ msgstr "Dimmer environment step in %" msgid "Door history graph" msgstr "Door history graph" -#: Missing text string -msgid "Doors overview screenshot" -msgstr "Doors overview screenshot" - #: Missing text string msgid "Door status" msgstr "Door status" +#: Missing text string +msgid "Doors overview screenshot" +msgstr "Doors overview screenshot" + #: Missing text string msgid "Drop files here to upload" msgstr "Drop files here to upload" @@ -3118,10 +3126,6 @@ msgstr "Free memory" msgid "Free space" msgstr "Free space" -#: Missing text string -msgid "Github" -msgstr "Github" - #: Missing text string msgid "GPIO Magnetic door sensor" msgstr "GPIO Magnetic door sensor" @@ -3130,6 +3134,10 @@ msgstr "GPIO Magnetic door sensor" msgid "GPIO relay board wiring scheme" msgstr "GPIO relay board wiring scheme" +#: Missing text string +msgid "Github" +msgstr "Github" + #: Missing text string msgid "Height in cm" msgstr "Height in cm" @@ -3138,14 +3146,14 @@ msgstr "Height in cm" msgid "Holds the port number on which the OWFS software is running. Leave empty to disable OWFS support." msgstr "Holds the port number on which the OWFS software is running. Leave empty to disable OWFS support." -#: Missing text string -msgid "I2C bus" -msgstr "I2C bus" - #: Missing text string msgid "I2C bus adapter" msgstr "I2C bus adapter" +#: Missing text string +msgid "I2C bus" +msgstr "I2C bus" + #: Missing text string msgid "ID" msgstr "ID" @@ -3170,14 +3178,14 @@ msgstr "Load 5" msgid "No error messages" msgstr "No error messages" -#: Missing text string -msgid "Not playing" -msgstr "Not playing" - #: Missing text string msgid "No warning messages" msgstr "No warning messages" +#: Missing text string +msgid "Not playing" +msgstr "Not playing" + #: Missing text string msgid "Offset in cm" msgstr "Offset in cm" @@ -3218,14 +3226,14 @@ msgstr "Sensors overview screenshot" msgid "Server could not process the upload. Error code {{statusCode}}" msgstr "Server could not process the upload. Error code {{statusCode}}" -#: Missing text string -msgid "Switches overview screenshot" -msgstr "Switches overview screenshot" - #: Missing text string msgid "Switch history graph" msgstr "Switch history graph" +#: Missing text string +msgid "Switches overview screenshot" +msgstr "Switches overview screenshot" + #: Missing text string msgid "System environment screenshot" msgstr "System environment screenshot" @@ -3266,14 +3274,6 @@ msgstr "Total open for" msgid "Total space" msgstr "Total space" -#: Missing text string -msgid "Universal AC MAINS Dimmer - MPDMv4.1" -msgstr "Universal AC MAINS Dimmer - MPDMv4.1" - -#: Missing text string -msgid "Unknown date" -msgstr "Unknown date" - #: Missing text string msgid "USB Relay board" msgstr "USB Relay board" @@ -3282,6 +3282,14 @@ msgstr "USB Relay board" msgid "USB Webcam" msgstr "USB Webcam" +#: Missing text string +msgid "Universal AC MAINS Dimmer - MPDMv4.1" +msgstr "Universal AC MAINS Dimmer - MPDMv4.1" + +#: Missing text string +msgid "Unknown date" +msgstr "Unknown date" + #: Missing text string msgid "Used memory" msgstr "Used memory" diff --git a/locales/terrariumpi.pot b/locales/terrariumpi.pot index b3436a2ed..7f49ef96e 100644 --- a/locales/terrariumpi.pot +++ b/locales/terrariumpi.pot @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: TerrariumPI 3.9.3\n" -"POT-Creation-Date: 2019-01-13 16:33+CET\n" +"POT-Creation-Date: 2019-01-28 22:45+CET\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -519,78 +519,78 @@ msgstr "" msgid "Offline since" msgstr "" -#: terrariumWebserver.py:92 terrariumWebserver.py:172 +#: terrariumWebserver.py:92 terrariumWebserver.py:178 msgid "Authenticate to make any changes" msgstr "" -#: terrariumWebserver.py:92 terrariumWebserver.py:172 +#: terrariumWebserver.py:92 terrariumWebserver.py:178 #: views/system_settings.tpl:28 msgid "TerrariumPI" msgstr "" -#: terrariumWebserver.py:92 terrariumWebserver.py:172 +#: terrariumWebserver.py:92 terrariumWebserver.py:178 #: views/system_settings.tpl:120 msgid "Authentication" msgstr "" -#: terrariumWebserver.py:226 +#: terrariumWebserver.py:232 msgid "Player command could ot be executed!" msgstr "" -#: terrariumWebserver.py:226 terrariumWebserver.py:246 -#: terrariumWebserver.py:258 terrariumWebserver.py:266 +#: terrariumWebserver.py:232 terrariumWebserver.py:252 +#: terrariumWebserver.py:264 terrariumWebserver.py:272 msgid "Error!" msgstr "" -#: terrariumWebserver.py:234 terrariumWebserver.py:237 +#: terrariumWebserver.py:240 terrariumWebserver.py:243 msgid "OK!" msgstr "" -#: terrariumWebserver.py:234 terrariumWebserver.py:237 +#: terrariumWebserver.py:240 terrariumWebserver.py:243 msgid "Player command executed!" msgstr "" -#: terrariumWebserver.py:246 +#: terrariumWebserver.py:252 msgid "File is not uploaded!" msgstr "" -#: terrariumWebserver.py:251 +#: terrariumWebserver.py:257 msgid "File '%s' is uploaded" msgstr "" -#: terrariumWebserver.py:251 terrariumWebserver.py:261 +#: terrariumWebserver.py:257 terrariumWebserver.py:267 msgid "Success!" msgstr "" -#: terrariumWebserver.py:253 +#: terrariumWebserver.py:259 msgid "Duplicate file '%s'" msgstr "" -#: terrariumWebserver.py:258 +#: terrariumWebserver.py:264 msgid "Action could not be satisfied" msgstr "" -#: terrariumWebserver.py:261 +#: terrariumWebserver.py:267 msgid "Audio file is deleted" msgstr "" -#: terrariumWebserver.py:266 +#: terrariumWebserver.py:272 msgid "Data could not be saved" msgstr "" -#: terrariumWebserver.py:274 +#: terrariumWebserver.py:280 msgid "Data saved" msgstr "" -#: terrariumWebserver.py:275 +#: terrariumWebserver.py:281 msgid "Your changes are saved" msgstr "" -#: terrariumWebserver.py:403 views/inc/menu.tpl:171 +#: terrariumWebserver.py:416 views/inc/menu.tpl:171 msgid "Log out" msgstr "" -#: terrariumWebserver.py:404 +#: terrariumWebserver.py:417 msgid "You are now logged out" msgstr "" @@ -1119,7 +1119,7 @@ msgstr "" #: views/dashboard.tpl:794 views/dashboard.tpl:849 views/dashboard.tpl:904 #: views/dashboard.tpl:959 views/dashboard.tpl:1014 views/dashboard.tpl:1069 #: views/dashboard.tpl:1124 views/door_status.tpl:40 -#: views/inc/sensor_list.tpl:49 views/switch_status.tpl:40 +#: views/inc/sensor_list.tpl:49 views/switch_status.tpl:43 msgid "Export data" msgstr "" @@ -2582,6 +2582,14 @@ msgstr "" msgid "No switches available" msgstr "" +#: views/switch_status.tpl:11 +msgid "in manual mode" +msgstr "" + +#: views/switch_status.tpl:40 +msgid "Manual mode" +msgstr "" + #: views/system_environment.tpl:16 msgid "Here you can configure your environment." msgstr "" @@ -2998,11 +3006,11 @@ msgid "When closed" msgstr "" #: Missing text string -msgid "1Wire bus" +msgid "1Wire DS18B20 wiring scheme" msgstr "" #: Missing text string -msgid "1Wire DS18B20 wiring scheme" +msgid "1Wire bus" msgstr "" #: Missing text string @@ -3058,15 +3066,15 @@ msgid "Current weather widget screenshot" msgstr "" #: Missing text string -msgid "Delete file" +msgid "DHT22 GPIO wiring scheme" msgstr "" #: Missing text string -msgid "DHT22 GPIO wiring scheme" +msgid "DHT22 temperature and humidity sensor" msgstr "" #: Missing text string -msgid "DHT22 temperature and humidity sensor" +msgid "Delete file" msgstr "" #: Missing text string @@ -3078,11 +3086,11 @@ msgid "Door history graph" msgstr "" #: Missing text string -msgid "Doors overview screenshot" +msgid "Door status" msgstr "" #: Missing text string -msgid "Door status" +msgid "Doors overview screenshot" msgstr "" #: Missing text string @@ -3118,15 +3126,15 @@ msgid "Free space" msgstr "" #: Missing text string -msgid "Github" +msgid "GPIO Magnetic door sensor" msgstr "" #: Missing text string -msgid "GPIO Magnetic door sensor" +msgid "GPIO relay board wiring scheme" msgstr "" #: Missing text string -msgid "GPIO relay board wiring scheme" +msgid "Github" msgstr "" #: Missing text string @@ -3138,11 +3146,11 @@ msgid "Holds the port number on which the OWFS software is running. Leave empty msgstr "" #: Missing text string -msgid "I2C bus" +msgid "I2C bus adapter" msgstr "" #: Missing text string -msgid "I2C bus adapter" +msgid "I2C bus" msgstr "" #: Missing text string @@ -3170,11 +3178,11 @@ msgid "No error messages" msgstr "" #: Missing text string -msgid "Not playing" +msgid "No warning messages" msgstr "" #: Missing text string -msgid "No warning messages" +msgid "Not playing" msgstr "" #: Missing text string @@ -3218,11 +3226,11 @@ msgid "Server could not process the upload. Error code {{statusCode}}" msgstr "" #: Missing text string -msgid "Switches overview screenshot" +msgid "Switch history graph" msgstr "" #: Missing text string -msgid "Switch history graph" +msgid "Switches overview screenshot" msgstr "" #: Missing text string @@ -3266,19 +3274,19 @@ msgid "Total space" msgstr "" #: Missing text string -msgid "Universal AC MAINS Dimmer - MPDMv4.1" +msgid "USB Relay board" msgstr "" #: Missing text string -msgid "Unknown date" +msgid "USB Webcam" msgstr "" #: Missing text string -msgid "USB Relay board" +msgid "Universal AC MAINS Dimmer - MPDMv4.1" msgstr "" #: Missing text string -msgid "USB Webcam" +msgid "Unknown date" msgstr "" #: Missing text string diff --git a/static/js/terrariumpi.js b/static/js/terrariumpi.js index 376b1758e..1db3dd381 100644 --- a/static/js/terrariumpi.js +++ b/static/js/terrariumpi.js @@ -1955,6 +1955,14 @@ function toggle_power_switch(id) { }); } +function toggle_power_manual_mode(id) { + $.post('/api/switch/manual_mode/' + id,function(data){ + if (data.ok) { + $('div.row.switch#powerswitch_' + id).find('h2 span.manual_mode').toggle(); + } + }); +} + function add_power_switch_status_row(data) { if (source_row === null || source_row === '') { return false; @@ -1991,6 +1999,10 @@ function add_power_switch_status_row(data) { toggle_power_switch($(this).parentsUntil('div.row.switch').parent().attr('id').split('_')[1]); }); } + new_row.find('a.manual_mode').on('click',function(){ + toggle_power_manual_mode($(this).parentsUntil('div.row.switch').parent().attr('id').split('_')[1]); + }); + if (data.timer_enabled) { new_row.find('div.power_switch span.glyphicon').append($('').addClass('glyphicon glyphicon glyphicon-time')); new_row.find('div.power_switch.dimmer div').append($('').addClass('glyphicon glyphicon glyphicon-time')); @@ -2017,6 +2029,7 @@ function update_power_switch(data) { content_row.find('span.glyphicon').removeClass('blue green').addClass((on ? 'green' : 'blue')); content_row.find('h2 span.title').text(data.name); content_row.find('h2 small.current_usage').text(current_status_data); + content_row.find('h2 span.manual_mode').toggle(data.manual_mode); //switch_row.find('.knob').val(power_switch.state).trigger('change'); // Set the values only when empty diff --git a/terrariumConfig.py b/terrariumConfig.py index fea65c465..6efd09e74 100644 --- a/terrariumConfig.py +++ b/terrariumConfig.py @@ -686,7 +686,7 @@ def get_sensors(self): # Switches config functions def save_power_switch(self,data): - clearfields = ['state','current_power_wattage','current_water_flow'] + clearfields = ['state','current_power_wattage','current_water_flow','manual_mode'] if 'dimmer' not in data['hardwaretype']: clearfields += ['dimmer_duration','dimmer_off_duration','dimmer_off_percentage','dimmer_on_duration','dimmer_on_percentage'] diff --git a/terrariumEnvironment.py b/terrariumEnvironment.py index 5a25fc5af..cf32d7905 100644 --- a/terrariumEnvironment.py +++ b/terrariumEnvironment.py @@ -55,6 +55,10 @@ def __get_power_state(self,powerswitchlist): def __toggle_powerswitches(self,powerswitches,action = None): for switchid in powerswitches: + if powerswitches[switchid].in_manual_mode(): + logger.warning('Power switch \'{}\' is in manual mode and will not change state.'.format(powerswitches[switchid].get_name())) + continue + if 'on' == action: powerswitches[switchid].go_up() diff --git a/terrariumSwitch.py b/terrariumSwitch.py index 370d27383..df99716ce 100644 --- a/terrariumSwitch.py +++ b/terrariumSwitch.py @@ -37,6 +37,7 @@ def __init__(self, switchid, address, name = '', callback = None): logger.info('Initialising \'{}\' power switch object'.format(self.get_type())) self.power_wattage = 0.0 self.water_flow = 0.0 + self.manual_mode = False self.switchid = switchid self.set_name(name) @@ -182,6 +183,12 @@ def get_state(self): def stop(self): pass + def in_manual_mode(self): + return terrariumUtils.is_true(self.manual_mode) + + def set_manual_mode(self,mode): + self.manual_mode = terrariumUtils.is_true(mode) + def update(self): self.timer_update() data = self.get_hardware_state() @@ -208,7 +215,8 @@ def get_data(self): 'current_power_wattage' : self.get_current_power_wattage(), 'water_flow' : self.get_water_flow(), 'current_water_flow' : self.get_current_water_flow(), - 'state' : self.get_state()} + 'state' : self.get_state(), + 'manual_mode' : self.in_manual_mode()} data.update(self.timer.get_data()) diff --git a/terrariumWebserver.py b/terrariumWebserver.py index 7cc2b7c65..8d2a1477b 100644 --- a/terrariumWebserver.py +++ b/terrariumWebserver.py @@ -135,6 +135,12 @@ def __routes(self): apply=self.__authenticate(True) ) + self.__app.route('/api/switch/manual_mode/', + method=['POST'], + callback=self.__manual_mode_switch, + apply=self.__authenticate(True) + ) + self.__app.route('/api/switch/state//', method=['POST'], callback=self.__state_switch, @@ -384,6 +390,13 @@ def __toggle_switch(self,switchid): return {'ok' : False} + def __manual_mode_switch(self,switchid): + if switchid in self.__terrariumEngine.power_switches: + self.__terrariumEngine.power_switches[switchid].set_manual_mode(not self.__terrariumEngine.power_switches[switchid].in_manual_mode()) + return {'ok' : True} + + return {'ok' : False} + def __state_switch(self,switchid,value): if switchid in self.__terrariumEngine.power_switches: if value == 1: diff --git a/views/switch_status.tpl b/views/switch_status.tpl index 1c91cc0eb..cfb11858a 100644 --- a/views/switch_status.tpl +++ b/views/switch_status.tpl @@ -8,7 +8,7 @@
-

{{_('Switch')}}

+

{{_('Switch')}} {{_('in manual mode')}}