diff --git a/docs/changelog.txt b/docs/changelog.txt index 1aa3f8b..b685123 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -2,6 +2,24 @@ Changelog ========= +1.4 +=== + +* Small improvment on @donneMoi in begin.rive (fr_FR) +* Add network test (fr_FR) +* Add user management feature for the 'name' information (fr_FR) +* Upgrades to do commands and get sensors : add the ability to use the command or sensor reference (used) + +1.3 +=== + +* Big internal upgrades to had more capabilities to commands and sensors management. +* Add DT_ColorRGBHexa management. +* Complete DT_Bool and childs management. +* Add management of basic sensors : DT_Number, DT_Bool, DT_String. +* Various minor improvments. +* en_US and nl_NL features are not as complete as fr_FR. See the 'TODO' tags in the .rive files for more informations. + 1.2 === diff --git a/info.json b/info.json index f8102c8..ae6fded 100644 --- a/info.json +++ b/info.json @@ -15,7 +15,7 @@ "domogik_min_version": "0.5.0", "name": "base", "type": "brain", - "version": "1.2" + "version": "1.4" }, "json_version": 2 } diff --git a/lib/color_command.py b/lib/color_command.py new file mode 100644 index 0000000..3ea6796 --- /dev/null +++ b/lib/color_command.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +def color_command(log, args, cfg_i18n): + from domogik.butler.brain import do_command + from domogik.butler.brain import remove_accents + + log.debug("color_command > get i18n informations") + basic_colors = cfg_i18n['BASIC_COLORS'] + colors = cfg_i18n['COLORS'] + DONE = cfg_i18n['DONE'] + UNKNOWN_DEVICE = cfg_i18n['UNKNOWN_DEVICE'] + UNKNOWN_COLOR = cfg_i18n['UNKNOWN_COLOR'] + TXT_BASIC_COLORS_1 = cfg_i18n['TXT_BASIC_COLORS_1'] + TXT_BASIC_COLORS_2 = cfg_i18n['TXT_BASIC_COLORS_2'] + TXT_COLOR_LIST = cfg_i18n['TXT_COLOR_LIST'] + + # put all keys lower case + log.debug("color_command > preprocess color list") + raw_colors = colors + colors.update(basic_colors) + colors = dict((remove_accents(k.lower()), v) for k, v in colors.iteritems()) + + log.debug("color_command > process args") + tab_args = ' '.join(args).split(",") + print(tab_args) + locale = tab_args[0].strip() + dt_type_list = tab_args[1].strip() + device = tab_args[2].strip() + value = tab_args[3].strip() + # optionnal parameter to get informations about a color + if len(tab_args) > 4: + arg4 = tab_args[4].strip() + + log.debug("color_command > do the action") + if value in colors: + value = colors[value] + + elif value == "listcolors": + resp = u"{0}".format(TXT_BASIC_COLORS_1) + for a_color in basic_colors: + resp += u", {0}".format(a_color) + resp += u". {0}".format(TXT_BASIC_COLORS_2) + return resp + + elif value == "detailcolor": + resp = u"{0} {1}".format(TXT_COLOR_LIST, arg4) + search_color = remove_accents(arg4.lower()) + for a_color in raw_colors: + the_color = remove_accents(a_color.lower()) + if search_color in the_color: + resp += u", {0}".format(a_color) + return resp + + else: + return u"{0}".format(UNKNOWN_COLOR) + res = do_command(log, locale, dt_type_list=dt_type_list, device=device, value=value) + if res == None: + return u"{0} : {1}".format(UNKNOWN_DEVICE, device) + else: + return u"{0}".format(DONE) diff --git a/lib/network.py b/lib/network.py new file mode 100644 index 0000000..e5a0a6b --- /dev/null +++ b/lib/network.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +import subprocess + +def test_internet(log, cfg_i18n): + """ Test ping on interner + 1. test a ping on an ip to check if network is ok + 2. test a ping on an url to check if DNS is working + """ + ip = "8.8.8.8" # google dns server + log.debug("Ping '{0}'...".format(ip)) + response_ip = ping(log, ip) # Google DNS server + + # ip ping ko + if response_ip != 0: + log.warning("Unable to ping '{0}'".format(ip)) + return cfg_i18n['NO_IP_ACCESS'] + # ip ping ok + else: + log.debug("Ping OK") + dom = "www.free.fr" + log.debug("Ping '{0}'".format(dom)) + response_dns = ping(log, dom) + if response_dns != 0: + log.warning("Unable to ping '{0}'".format(dom)) + return cfg_i18n['NO_DNS_ACCESS'] + else: + log.debug("Ping OK") + return cfg_i18n['OK'] + +def ping(log, remote): + cmd = ["/bin/ping", "-c1", "-w2", remote] + log.debug("Ping command : {0}".format(cmd)) + ping_action = subprocess.Popen(cmd, stdout=subprocess.PIPE) + ping_action.communicate() + return ping_action.returncode + diff --git a/rs/en_US/DT_Basic_sensors.rive b/rs/en_US/DT_Basic_sensors.rive new file mode 100644 index 0000000..d1e4325 --- /dev/null +++ b/rs/en_US/DT_Basic_sensors.rive @@ -0,0 +1,15 @@ +// DT_Basics is a file for all sensors of : +// - DT_Number +// - DT_String +// - DT_Bool + + +// shortcut +// double ,, because no unit ++ shortcut basic * +- The value is get_sensor_value en_US, DT_Number|DT_String|DT_Bool, , + ++ give me the value (of|at) * +@shortcut basic + + diff --git a/rs/en_US/DT_Bool.rive b/rs/en_US/DT_Bool.rive index dc620fe..27987d9 100644 --- a/rs/en_US/DT_Bool.rive +++ b/rs/en_US/DT_Bool.rive @@ -1,5 +1,5 @@ + shortcut bool command * dev * val * -- trigger_bool_command en_US__SEP____SEP____SEP__ +- do_command en_US, , , + switch * on @shortcut bool command DT_Switch dev val 1 @@ -12,3 +12,7 @@ + disable * @shortcut bool command DT_Enable dev val 0 + + +// TODO : get the status of switches and open/close sensors +// See fr_FR for the example diff --git a/rs/en_US/DT_ColorRGBHexa.rive b/rs/en_US/DT_ColorRGBHexa.rive new file mode 100644 index 0000000..1e07231 --- /dev/null +++ b/rs/en_US/DT_ColorRGBHexa.rive @@ -0,0 +1,8 @@ + ++ shortcut color command * dev * val * +- do_color_command en_US, , , + ++ change the color (of|at) * to * +@ shortcut color command DT_ColorRGBHexa dev val + +// TODO : complete with questions to ask about the colors. See fr_FR for the example diff --git a/rs/en_US/DT_Humidity.rive b/rs/en_US/DT_Humidity.rive index 277da9a..4170677 100644 --- a/rs/en_US/DT_Humidity.rive +++ b/rs/en_US/DT_Humidity.rive @@ -1,13 +1,10 @@ -// raccourci +// shortcut + shortcut humidity * -- The humidity at is get_sensor_value en_US DT_Humidity pourcents +- The humidity at is get_sensor_value en_US, DT_Humidity, pourcents, -// phrases + what is the humidity (at|of) * @shortcut humidity -+ humidity * -@shortcut humidity diff --git a/rs/en_US/DT_Temp.rive b/rs/en_US/DT_Temp.rive index 00c9249..2907e68 100644 --- a/rs/en_US/DT_Temp.rive +++ b/rs/en_US/DT_Temp.rive @@ -1,6 +1,6 @@ -// raccourci +// shortcut + shortcut temperature * -- The temperature at is get_sensor_value en_US DT_Temp degres +- The temperature at is get_sensor_value en_US, DT_Temp, degres, + what is the temperature (at|of) * @shortcut temperature diff --git a/rs/en_US/DT_Trigger.rive b/rs/en_US/DT_Trigger.rive new file mode 100644 index 0000000..fa26427 --- /dev/null +++ b/rs/en_US/DT_Trigger.rive @@ -0,0 +1,12 @@ + +/* ##suggest## +? .* execute.* ((?:la |le |l ).*) +@ execute +*/ + ++ shortcut trigger command * dev * +- do_command fr_FR, , + ++ (execute) * +@ shortcut trigger command DT_Trigger dev + diff --git a/rs/en_US/begin.rive b/rs/en_US/begin.rive new file mode 100644 index 0000000..e300f4a --- /dev/null +++ b/rs/en_US/begin.rive @@ -0,0 +1,5 @@ +////////////////////////////////////////////////// +// shortcuts + +// TODO. See fr_FR for examples + diff --git a/rs/en_US/datetime.rive b/rs/en_US/datetime.rive index 00d8104..5611c0e 100644 --- a/rs/en_US/datetime.rive +++ b/rs/en_US/datetime.rive @@ -7,12 +7,15 @@ import locale import time + import traceback + from domogik.common.utils import ucode now = time.localtime(time.time()) try: - locale.setlocale(locale.LC_ALL, LOCALE) + locale.setlocale(locale.LC_ALL, str(LOCALE)) except: + rs.log.error(u"Error : {0}".format(traceback.format_exc())) return ERROR_LOCALE - return time.strftime(DISPLAY_FORMAT, now) + return ucode(time.strftime(DISPLAY_FORMAT, now)) < object > object get_date python @@ -24,12 +27,15 @@ import locale import time + import traceback + from domogik.common.utils import ucode now = time.localtime(time.time()) try: - locale.setlocale(locale.LC_ALL, LOCALE) + locale.setlocale(locale.LC_ALL, str(LOCALE)) except: + rs.log.error(u"Error : {0}".format(traceback.format_exc())) return ERROR_LOCALE - return time.strftime(DISPLAY_FORMAT, now) + return ucode(time.strftime(DISPLAY_FORMAT, now)) < object diff --git a/rs/en_US/python_do_color_command.rive b/rs/en_US/python_do_color_command.rive new file mode 100644 index 0000000..5b856aa --- /dev/null +++ b/rs/en_US/python_do_color_command.rive @@ -0,0 +1,255 @@ +> object do_color_command python + """ + @param 0 : locale + @param 1 : list of data type separated by a | + @param 2 : device + @param 3 : color value + """ + from domogik_packages.brain_base.lib.color_command import color_command + + # source : https://gist.githubusercontent.com/lunohodov/1995178/raw/cb8cf1ebe1d1b8fa5759e287ebd6eaecbe3bc3e4/ral_standard.csv + # regexp to generate the dictionnary content : + # cat ral_standard.csv | sed "s/^.*,#\(......\),.*,.*,\(.*\),.*,.*,.*$/\"\2\" : \"\1\",/" + # first part of the dictionnary is manually made to get the basic colors. The second part is build as described the lines before. + basic_colors = { + "Black" : "000000", + "White" : "ffffff", + "Red" : "ff0000", + "Green" : "00ff00", + "Blue" : "0000ff", + "Yellow" : "ffff00", + "Pink" : "fd6c9e", + "Brown" : "582900", + "Purple" : "660099", + "Orange" : "ed7f10", + "Grey" : "606060" + } + + colors = { + "Green beige" : "BEBD7F", + "Beige" : "C2B078", + "Sand yellow" : "C6A664", + "Signal yellow" : "E5BE01", + "Golden yellow" : "CDA434", + "Honey yellow" : "A98307", + "Maize yellow" : "E4A010", + "Daffodil yellow" : "DC9D00", + "Brown beige" : "8A6642", + "Lemon yellow" : "C7B446", + "Oyster white" : "EAE6CA", + "Ivory" : "E1CC4F", + "Light ivory" : "E6D690", + "Sulfur yellow" : "EDFF21", + "Saffron yellow" : "F5D033", + "Zinc yellow" : "F8F32B", + "Grey beige" : "9E9764", + "Olive yellow" : "999950", + "Rape yellow" : "F3DA0B", + "Traffic yellow" : "FAD201", + "Ochre yellow" : "AEA04B", + "Luminous yellow" : "FFFF00", + "Curry" : "9D9101", + "Melon yellow" : "F4A900", + "Broom yellow" : "D6AE01", + "Dahlia yellow" : "F3A505", + "Pastel yellow" : "EFA94A", + "Pearl beige" : "6A5D4D", + "Pearl gold" : "705335", + "Sun yellow" : "F39F18", + "Yellow orange" : "ED760E", + "Red orange" : "C93C20", + "Vermilion" : "CB2821", + "Pastel orange" : "FF7514", + "Pure orange" : "F44611", + "Luminous orange" : "FF2301", + "Luminous bright orange" : "FFA420", + "Bright red orange" : "F75E25", + "Traffic orange" : "F54021", + "Signal orange" : "D84B20", + "Deep orange" : "EC7C26", + "Salmon range" : "E55137", + "Pearl orange" : "C35831", + "Flame red" : "AF2B1E", + "Signal red" : "A52019", + "Carmine red" : "A2231D", + "Ruby red" : "9B111E", + "Purple red" : "75151E", + "Wine red" : "5E2129", + "Black red" : "412227", + "Oxide red" : "642424", + "Brown red" : "781F19", + "Beige red" : "C1876B", + "Tomato red" : "A12312", + "Antique pink" : "D36E70", + "Light pink" : "EA899A", + "Coral red" : "B32821", + "Rose" : "E63244", + "Strawberry red" : "D53032", + "Traffic red" : "CC0605", + "Salmon pink" : "D95030", + "Luminous red" : "F80000", + ""Luminous bright red"" : "FE0000", + "Raspberry red" : "C51D34", + "Pure  red" : "CB3234", + "Orient red" : "B32428", + "Pearl ruby red" : "721422", + "Pearl pink" : "B44C43", + "Red lilac" : "6D3F5B", + "Red violet" : "922B3E", + "Heather violet" : "DE4C8A", + "Claret violet" : "641C34", + "Blue lilac" : "6C4675", + "Traffic purple" : "A03472", + "Purple violet" : "4A192C", + "Signal violet" : "924E7D", + "Pastel violet" : "A18594", + "Telemagenta" : "CF3476", + "Pearl violet" : "8673A1", + "Pearl black berry" : "6C6874", + "Violet blue" : "354D73", + "Green blue" : "1F3438", + "Ultramarine blue" : "20214F", + "Saphire blue" : "1D1E33", + "Black blue" : "18171C", + "Signal blue" : "1E2460", + "Brillant blue" : "3E5F8A", + "Grey blue" : "26252D", + "Azure blue" : "025669", + "Gentian blue" : "0E294B", + "Steel blue" : "231A24", + "Light blue" : "3B83BD", + "Cobalt blue" : "1E213D", + "Pigeon blue" : "606E8C", + "Sky blue" : "2271B3", + "Traffic blue" : "063971", + "Turquoise blue" : "3F888F", + "Capri blue" : "1B5583", + "Ocean blue" : "1D334A", + "Water blue" : "256D7B", + "Night blue" : "252850", + "Distant blue" : "49678D", + "Pastel blue" : "5D9B9B", + "Pearl gentian blue" : "2A6478", + "Pearl night blue" : "102C54", + "Patina green" : "316650", + "Emerald green" : "287233", + "Leaf green" : "2D572C", + "Olive green" : "424632", + "Blue green" : "1F3A3D", + "Moss green" : "2F4538", + "Grey olive" : "3E3B32", + "Bottle green" : "343B29", + "Brown green" : "39352A", + "Fir green" : "31372B", + "Grass green" : "35682D", + "Reseda green" : "587246", + "Black green" : "343E40", + "Reed green" : "6C7156", + "Yellow olive" : "47402E", + "Black olive" : "3B3C36", + "Turquoise green" : "1E5945", + "May green" : "4C9141", + "Yellow green" : "57A639", + "Pastel green" : "BDECB6", + "Chrome green" : "2E3A23", + "Pale green" : "89AC76", + "Olive drab" : "25221B", + "Traffic green" : "308446", + "Fern green" : "3D642D", + "Opal green" : "015D52", + "Light green" : "84C3BE", + "Pine green" : "2C5545", + "Mint green" : "20603D", + "Signal green" : "317F43", + "Mint turquoise" : "497E76", + "Pastel turquoise" : "7FB5B5", + "Pearl green" : "1C542D", + "Pearl opal green" : "193737", + "Pure green" : "008F39", + "Luminous green" : "00BB2D", + "Squirrel grey" : "78858B", + "Silver grey" : "8A9597", + "Olive grey" : "7E7B52", + "Moss grey" : "6C7059", + "Signal grey" : "969992", + "Mouse grey" : "646B63", + "Beige grey" : "6D6552", + "Khaki grey" : "6A5F31", + "Green grey" : "4D5645", + "Tarpaulin grey" : "4C514A", + "Iron grey" : "434B4D", + "Basalt grey" : "4E5754", + "Brown grey" : "464531", + "Slate grey" : "434750", + "Anthracite grey" : "293133", + "Black grey" : "23282B", + "Umbra grey" : "332F2C", + "Concrete grey" : "686C5E", + "Graphite grey" : "474A51", + "Granite grey" : "2F353B", + "Stone grey" : "8B8C7A", + "Blue grey" : "474B4E", + "Pebble grey" : "B8B799", + "Cement grey" : "7D8471", + "Yellow grey" : "8F8B66", + "Light grey" : "D7D7D7", + "Platinum grey" : "7F7679", + "Dusty grey" : "7D7F7D", + "Agate grey" : "B5B8B1", + "Quartz grey" : "6C6960", + "Window grey" : "9DA1AA", + "Traffic grey A" : "8D948D", + "Traffic grey B" : "4E5452", + "Silk grey" : "CAC4B0", + "Telegrey 1" : "909090", + "Telegrey 2" : "82898F", + "Telegrey 4" : "D0D0D0", + "Pearl mouse grey" : "898176", + "Green brown" : "826C34", + "Ochre brown" : "955F20", + "Signal brown" : "6C3B2A", + "Clay brown" : "734222", + "Copper brown" : "8E402A", + "Fawn brown" : "59351F", + "Olive brown" : "6F4F28", + "Nut brown" : "5B3A29", + "Red brown" : "592321", + "Sepia brown" : "382C1E", + "Chestnut brown" : "633A34", + "Mahogany brown" : "4C2F27", + "Chocolate brown" : "45322E", + "Grey brown" : "403A3A", + "Black brown" : "212121", + "Orange brown" : "A65E2E", + "Beige brown" : "79553D", + "Pale brown" : "755C48", + "Terra brown" : "4E3B31", + "Pearl copper" : "763C28", + "Cream" : "FDF4E3", + "Grey white" : "E7EBDA", + "Signal white" : "F4F4F4", + "Signal black" : "282828", + "Jet black" : "0A0A0A", + "White aluminium" : "A5A5A5", + "Grey aluminium" : "8F8F8F", + "Pure white" : "FFFFFF", + "Graphite black" : "1C1C1C", + "Traffic white" : "F6F6F6", + "Traffic black" : "1E1E1E", + "Papyrus white" : "D7D7D7", + "Pearl light grey" : "9C9C9C", + "Pearl dark grey" : "828282" + } + + cfg_i18n = {} + cfg_i18n['BASIC_COLORS'] = basic_colors + cfg_i18n['COLORS'] = colors + cfg_i18n['DONE'] = u"OK" + cfg_i18n['UNKNOWN_DEVICE'] = u"I don't known what is : " + cfg_i18n['UNKNOWN_COLOR'] = u"I don't knownthis color" + cfg_i18n['TXT_BASIC_COLORS_1'] = u"Basic colors are" + cfg_i18n['TXT_BASIC_COLORS_2'] = u"There are also plenty of other colors available. You can ask me declensions for a base color." + cfg_i18n['TXT_COLOR_LIST'] = u"Here are the declensions of " + + return color_command(rs.log, args, cfg_i18n) +< object diff --git a/rs/en_US/python_do_command.rive b/rs/en_US/python_do_command.rive new file mode 100644 index 0000000..812dd63 --- /dev/null +++ b/rs/en_US/python_do_command.rive @@ -0,0 +1,19 @@ +> object do_command python + """ + @param 0 : locale + @param 1 : a list of datatypes separated by | + @param 2 : device name + @param 3 : value + """ + from domogik.butler.brain import do_command + tab_args = ' '.join(args).split(",") + locale = tab_args[0].strip() + dt_type_list = tab_args[1].strip() + device = tab_args[2].strip() + value = tab_args[3].strip() + res = do_command(rs.log, locale, dt_type_list=dt_type_list, device=device, value=value) + if value == None: + return "Error" + else: + return "OK" +< object diff --git a/rs/en_US/python_do_command_per_reference.rive b/rs/en_US/python_do_command_per_reference.rive new file mode 100644 index 0000000..0365e83 --- /dev/null +++ b/rs/en_US/python_do_command_per_reference.rive @@ -0,0 +1,25 @@ +> object do_command_per_reference python + """ + @param 0 : locale + @param 1 : a list of datatypes separated by | + @param 2 : command reference (set_fat for the body plugin for example) + @param 3 : device name + @param 4 : value + """ + from domogik.butler.brain import do_command + tab_args = ' '.join(args).split(",") + locale = tab_args[0].strip() + dt_type_list = tab_args[1].strip() + command_reference = tab_args[2].strip() + device = tab_args[3].strip() + if len(tab_args) > 4: + value = tab_args[4].strip() + else: + value = None + res = do_command(rs.log, locale, dt_type_list=dt_type_list, device=device, value=value, command_reference=command_reference) + if res == None: + return u"Error" + else: + return u"OK" +< object + diff --git a/rs/en_US/python_get_sensor_value.rive b/rs/en_US/python_get_sensor_value.rive index f2ae45e..a3fddc3 100644 --- a/rs/en_US/python_get_sensor_value.rive +++ b/rs/en_US/python_get_sensor_value.rive @@ -1,11 +1,23 @@ > object get_sensor_value python + """ + @param 0 : locale + @param 1 : a list of datatypes separated by | + @param 2 : the unit (for string return) + @param 3 : device name + """ from domogik.butler.brain import get_sensor_value - locale = args[0] - dt_type = args[1] - unit = args[2] - device_name = args[3:] + tab_args = ' '.join(args).split(",") + print(tab_args[0]) + print(tab_args[0].strip()) + locale = tab_args[0].strip() + dt_type = tab_args[1].strip() + unit = tab_args[2].strip() + device_name = tab_args[3].strip() value = get_sensor_value(rs.log, locale, dt_type, device_name) if value == None: return "unknown" - return "{0} {1}".format(value, unit) + if unit != "": + return u"{0} {1}".format(value, unit) + else: + return u"{0}".format(value) < object diff --git a/rs/en_US/python_get_sensor_value_per_reference.rive b/rs/en_US/python_get_sensor_value_per_reference.rive new file mode 100644 index 0000000..a3c676d --- /dev/null +++ b/rs/en_US/python_get_sensor_value_per_reference.rive @@ -0,0 +1,29 @@ +> object get_sensor_value_per_reference python + """ + @param 0 : locale + @param 1 : a list of datatypes separated by | + @param 2 : the unit (for string return) + @param 3 : sensor reference + @param 4 : device name + """ + from domogik.butler.brain import get_sensor_value + tab_args = ' '.join(args).split(",") + print(tab_args[0]) + print(tab_args[0].strip()) + locale = tab_args[0].strip() + dt_type = tab_args[1].strip() + unit = tab_args[2].strip() + sensor_reference = tab_args[3].strip() + device_name = tab_args[4].strip() + value = get_sensor_value(rs.log, locale, dt_type, device_name, sensor_reference = sensor_reference) + if value == None: + return u"inconnue" + if unit != "": + return u"{0} {1}".format(value, unit) + else: + return u"{0}".format(value) +< object + + + + diff --git a/rs/en_US/python_trigger_bool_command.rive b/rs/en_US/python_trigger_bool_command.rive deleted file mode 100644 index c262184..0000000 --- a/rs/en_US/python_trigger_bool_command.rive +++ /dev/null @@ -1,13 +0,0 @@ -> object trigger_bool_command python - from domogik.butler.brain import trigger_bool_command - tab_args = ' '.join(args).split("__SEP__") - locale = tab_args[0] - dt_type = tab_args[1] - device = tab_args[2] - value = tab_args[3] - res = trigger_bool_command(rs.log, locale, dt_type=dt_type, device=device, value=value) - if value == None: - return "Error" - else: - return "OK" -< object diff --git a/rs/fr_FR/DT_Basic_sensors.rive b/rs/fr_FR/DT_Basic_sensors.rive new file mode 100644 index 0000000..1d2f4c6 --- /dev/null +++ b/rs/fr_FR/DT_Basic_sensors.rive @@ -0,0 +1,22 @@ +// DT_Basics is a file for all sensors of : +// - DT_Number +// - DT_String +// - DT_Bool + + +/* ##suggest## +? .* valeur .* ((?:a |de la |de l |de |du |dans le |dans la |dans l |dans |d ).*) +@ quelle est la valeur +*/ + + +// raccourci +// double ,, car pas d'unité ++ shortcut basic * +- La valeur est get_sensor_value fr_FR, DT_Number|DT_String|DT_Bool, , + +// phrases ++ @donneMoi la valeur [@cible] * +@shortcut basic + + diff --git a/rs/fr_FR/DT_Bool.rive b/rs/fr_FR/DT_Bool.rive index 3452f13..8257f9d 100644 --- a/rs/fr_FR/DT_Bool.rive +++ b/rs/fr_FR/DT_Bool.rive @@ -1,3 +1,7 @@ +// Ce fichier comprend tous les enfants de DT_Bool + +//////// Actions +// ##feature## contrôler des lumières ou prises /* ##suggest## ? .* allume.* ((?:la |le |l ).*) @@ -5,23 +9,140 @@ */ /* ##suggest## -? .* (?:eteind|eteigne).* ((?:la |le |l ).*) +? .* (?:etein|eteigne).* ((?:la |le |l ).*) @ eteindre */ - + shortcut bool command * dev * val * -- trigger_bool_command fr_FR__SEP____SEP____SEP__ +- do_command fr_FR, , , + (allume|allumes|allumer) [@pronom] * -@ shortcut bool command DT_Switch dev val 1 +@ shortcut bool command DT_Switch|DT_ColorRGBHexa dev val 1 + ++ (etein|eteins|eteindre) [@pronom] * +@ shortcut bool command DT_Switch|DT_ColorRGBHexa dev val 0 + + + +// note : volet et rideau au pluriel car il peut y en avoir 2 par ouvrant +! array openclose = la porte fenetre|la porte de garage|la porte|la fenetre|la baie vitree|la baie|le volet|les volets|la persienne|le rideau|les rideaux|le store|le velux + ++ (ouvre|ouvres|monte|montes) (@openclose) [@cible] * +@ shortcut bool command DT_Switch|DT_OpenClose dev val 1 + ++ (ouvre|ouvres|monte|montes) [@pronom] * +@ shortcut bool command DT_Switch|DT_OpenClose dev val 1 + ++ (ferme|fermes|descend|descends) (@openclose) [@cible] * +@ shortcut bool command DT_Switch|DT_OpenClose dev val 0 + ++ (ferme|fermes|descend|descends) [@pronom] * +@ shortcut bool command DT_Switch|DT_OpenClose dev val 0 + + + -+ (eteind|eteinds|eteindre) [@pronom] * -@ shortcut bool command DT_Switch dev val 0 + active [@pronom] * -@ shortcut bool command DT_Enable dev val 1 +@ shortcut bool command DT_Enable dev val 1 + desactive [@pronom] * -@ shortcut bool command DT_Enable dev val 0 +@ shortcut bool command DT_Enable dev val 0 + + +//////// Lumières/prises - Etat - 1 - status +! array switch = la prise|la lumiere + ++ shortcut switch status * +* get_sensor_value fr_FR, DT_Switch|DT_ColorRGBHexa, , > == inconnue => Je ne connais pas +* == 0 => Eteind +* == 000000 => Eteind +- Allumé + ++ comment est (@switch) [@cible] * +@ shortcut switch status + + +//////// Lumières/prises - Etat - 2 - allumé ? + ++ shortcut is switch on * +* get_sensor_value fr_FR, DT_Switch|DT_ColorRGBHexa, , > == inconnue => Je ne connais pas +* == 0 => Non +* == 000000 => Non +- Oui + ++ est[-]ce que (@switch) est allume@e [@cible] * +@ shortcut is switch on + ++ est[-]ce que (@switch) [@cible] * est allume@e +@ shortcut is switch on + ++ est[-]ce que [@pronom] * est allume@e +@ shortcut is switch on + + +//////// Lumières/prises - Etat - 3 - éteind ? + ++ shortcut is switch off * +* get_sensor_value fr_FR, DT_Switch|DT_ColorRGBHexa, , > == inconnue => Je ne connais pas +* == 0 => Oui +* == 000000 => Oui +- Non + ++ est[-]ce que (@switch) est (eteinte|coupe@e) [@cible] * +@ shortcut is switch off + ++ est[-]ce que (@switch) [@cible] * est (eteinte|coupe@e) +@ shortcut is switch off + ++ est[-]ce que [@pronom] * est (eteinte|coupe@e) +@ shortcut is switch off + + + + + +//////// Ouvertures - Etat - 1 - status + ++ shortcut openclose status * +* get_sensor_value fr_FR, DT_OpenClose, , > == inconnue => Je ne connais pas +* == 0 => Ouvert +- Fermé + ++ comment est (@openclose) [@cible] * +@ shortcut openclose status + + +//////// Ouvertures - Etat - 2 - fermée (1) ? + ++ shortcut is openclose closed * +* get_sensor_value fr_FR, DT_OpenClose, , > == inconnue => Je ne connais pas +* == 0 => Non +- Oui + ++ est[-]ce que (@openclose) est ferme@e [@cible] * +@ shortcut is openclose closed + ++ est[-]ce que (@openclose) [@cible] * est ferme@e +@ shortcut is openclose closed + ++ est[-]ce que [@pronom] * est ferme@e +@ shortcut is openclose closed + + +//////// Ouvertures - Etat - 3 - ouverte ? + ++ shortcut is openclose open * +* get_sensor_value fr_FR, DT_OpenClose, , > == inconnue => Je ne connais pas +* == 0 => Oui +- Non + ++ est[-]ce que (@openclose) est ouvert@e [@cible] * +@ shortcut is openclose open + ++ est[-]ce que (@openclose) [@cible] * est ouvert@e +@ shortcut is openclose open + ++ est[-]ce que [@pronom] * est (eteinte|coupe@e) +@ shortcut is openclose open diff --git a/rs/fr_FR/DT_ColorRGBHexa.rive b/rs/fr_FR/DT_ColorRGBHexa.rive new file mode 100644 index 0000000..3b6c8c4 --- /dev/null +++ b/rs/fr_FR/DT_ColorRGBHexa.rive @@ -0,0 +1,52 @@ +// Changement de couleur +// ##feature## contrôler des lumières de couleur + ++ shortcut color command * dev * val * +- do_color_command fr_FR, , , + ++ (met|mets|allume|allumes|allumer) [@pronom] * en * +@ shortcut color command DT_ColorRGBHexa dev val + ++ change la couleur [@pronom] * en * +@ shortcut color command DT_ColorRGBHexa dev val + ++ (met|mets|change|changes) la couleur * [@cible] * +@ shortcut color command DT_ColorRGBHexa dev val + + +// Information sur les couleurs de base disponibles +// il y a tellement de manières de demander la listes des couleurs, qu'ici je choisis de tout baser sur les suggestions... + +/* ##suggest## +? .* couleurs disponible.* +@ quelles couleurs sont disponibles +*/ + +/* ##suggest## +? .*quelles (.*) couleurs.* +@ quelles couleurs sont disponibles +*/ + +/* ##suggest## +? .* liste.* couleur.* +@ quelles couleurs sont disponibles +*/ + ++ @quel couleurs sont disponibles +@ shortcut color command DT_ColorRGBHexa dev null val listcolors + + +// Informations sur les déclinaisons des couleurs de base + +/* ##suggest## +? .* nuances.* couleur (.*) +@ quelles sont les declinaisons de la couleur +*/ + +/* ##suggest## +? .* déclinaisons.* couleur (.*) +@ quelles sont les declinaisons de la couleur +*/ + ++ @quel sont les declinaisons de la couleur * +- do_color_command fr_FR, DT_ColorRGBHexa, null, detailcolor, diff --git a/rs/fr_FR/DT_Humidity.rive b/rs/fr_FR/DT_Humidity.rive index 1ad041d..d43945f 100644 --- a/rs/fr_FR/DT_Humidity.rive +++ b/rs/fr_FR/DT_Humidity.rive @@ -1,3 +1,4 @@ +// ##feature## donner l'humidité /* ##suggest## ? .* humidite.* ((?:a |de la |de l |de |du |dans le |dans la |dans l |dans |d ).*) @@ -7,7 +8,7 @@ // raccourci + shortcut humidity * -- L'humidité est get_sensor_value fr_FR DT_Humidity pourcents +- L'humidité est get_sensor_value fr_FR, DT_Humidity, pourcents, // phrases + @donneMoi l humidite [@cible] * diff --git a/rs/fr_FR/DT_String.rive b/rs/fr_FR/DT_String.rive new file mode 100644 index 0000000..bbf65fd --- /dev/null +++ b/rs/fr_FR/DT_String.rive @@ -0,0 +1,17 @@ + +/* ##suggest## +? .* xxxx .* ((?:a |de la |de l |de |du |dans le |dans la |dans l |dans |d ).*) +@ quelle est la xxxx +*/ + + +// raccourci +// double ,, car pas d'unité ++ shortcut string * +- La xxxx est get_sensor_value fr_FR, DT_String, , + +// phrases ++ @donneMoi le contenu [@cible] * +@shortcut string + + diff --git a/rs/fr_FR/DT_Temp.rive b/rs/fr_FR/DT_Temp.rive index 9ce21e0..e7955e2 100644 --- a/rs/fr_FR/DT_Temp.rive +++ b/rs/fr_FR/DT_Temp.rive @@ -1,3 +1,4 @@ +// ##feature## donner la température /* ##suggest## ? .* temperature.* ((?:a |de la |de l |de |du |dans le |dans la |dans l |dans |d ).*) @@ -7,7 +8,7 @@ // raccourci + shortcut temperature * -- La température est get_sensor_value fr_FR DT_Temp degrés +- La température est get_sensor_value fr_FR, DT_Temp, degrés, // phrases + combien [fait il|fait-il|il fait] [@cible] * diff --git a/rs/fr_FR/DT_Trigger.rive b/rs/fr_FR/DT_Trigger.rive new file mode 100644 index 0000000..3b8b392 --- /dev/null +++ b/rs/fr_FR/DT_Trigger.rive @@ -0,0 +1,12 @@ + +/* ##suggest## +? .* execute.* ((?:la |le |l ).*) +@ execute +*/ + ++ shortcut trigger command * dev * +- do_command fr_FR, , + ++ (execute|executer) [@pronom] * +@ shortcut trigger command DT_Trigger dev + diff --git a/rs/fr_FR/README.md b/rs/fr_FR/README.md new file mode 100644 index 0000000..a17f940 --- /dev/null +++ b/rs/fr_FR/README.md @@ -0,0 +1,11 @@ +Variables pour l'utilisateur +============================ + +name +---- + +Cette variable contient le nom de l'utilisateur. Elle peut être utilisée pour tout device qui est censé être lié à un utilisateur. + +Elle peut être définie en disant "je suis John" par exemple. + +D'autres variables seront définies par la suite. Elles seront valorisées depuis le détail de l'utilisateur créé dans Domogik. diff --git a/rs/fr_FR/begin.rive b/rs/fr_FR/begin.rive index 5fe0fbd..0e0e7fd 100644 --- a/rs/fr_FR/begin.rive +++ b/rs/fr_FR/begin.rive @@ -1,7 +1,8 @@ ////////////////////////////////////////////////// -// Gestion du pluriel en option +// Gestion du pluriel/féminin en option // Exemple d'usage : pomme@s => corresond a pomme ou pommes ! array s = |s +! array e = |e ////////////////////////////////////////////////// // Raccourcis vers des classiques pour eviter l'usage de (..|..|..|..) partout @@ -9,10 +10,21 @@ // pour rappel, l'apostrophe est remplace par un espace par le butler ! array pronom = le la les l -! array cible = a|de la|de l|de|du|dans le|dans la|dans l|dans|d +! array cible = a|de la|de l|de|du|dans le|dans la|dans l|dans|d|sur le|sur la|sur l ! array quel = quel quelle quels quelles // pour les sensors -! array donneMoi = donne moi|donnes moi|donne-moi|quel est|quelle est|dis moi +! array donneMoi = donne-moi|donnes-moi|donne moi|donnes moi|quel-est|quelle-est|quel est|quelle est|dis-moi|dis moi +// pour des demandes +! array peuxTu = peux tu|peux-tu|est ce que tu peux|est-ce que tu peux + +// pour se nommer +! array jeSuis = je suis|je m appelle|je me nomme|je me prenomme|mon prenom est|mon identite est|mon surnom est|mon nom est + +////////////////////////////////////////////////// +// Unités + +! array pourcent = pourcentage|pourcentages|pourcent|pourcents +! array kg = kilogramme|kilogrammes|kilo gramme|kilo grammes|kilo|kilos|kg|kgs diff --git a/rs/fr_FR/datetime.rive b/rs/fr_FR/datetime.rive index 1d038cd..3b58b28 100644 --- a/rs/fr_FR/datetime.rive +++ b/rs/fr_FR/datetime.rive @@ -8,13 +8,14 @@ import locale import time import traceback + from domogik.common.utils import ucode now = time.localtime(time.time()) try: locale.setlocale(locale.LC_ALL, str(LOCALE)) except: rs.log.error(u"Error : {0}".format(traceback.format_exc())) return ERROR_LOCALE - return time.strftime(DISPLAY_FORMAT, now) + return ucode(time.strftime(DISPLAY_FORMAT, now)) < object > object get_date python @@ -27,17 +28,14 @@ import locale import time import traceback + from domogik.common.utils import ucode now = time.localtime(time.time()) try: locale.setlocale(locale.LC_ALL, str(LOCALE)) except: rs.log.error(u"Error : {0}".format(traceback.format_exc())) return ERROR_LOCALE - the_date = time.strftime(DISPLAY_FORMAT, now) - # TODO : replace this dirty tricky thing by something better...." - the_date = the_date.replace("û", "u") - the_date = the_date.replace("é", "e") - return u"{0}".format(the_date) + return ucode(time.strftime(DISPLAY_FORMAT, now)) < object diff --git a/rs/fr_FR/greetings.rive b/rs/fr_FR/greetings.rive index fefad66..b042f49 100644 --- a/rs/fr_FR/greetings.rive +++ b/rs/fr_FR/greetings.rive @@ -55,6 +55,9 @@ - Bonne soirée - Bien le bonsoir ++ [*] (bonne nuit|bonne-nuit|je vais dormir|je vais au lit) [*] +- Dormez bien + + allo [*] - Ici au bout du fil diff --git a/rs/fr_FR/learn.rive b/rs/fr_FR/learn.rive index be47606..80a3949 100644 --- a/rs/fr_FR/learn.rive +++ b/rs/fr_FR/learn.rive @@ -32,6 +32,8 @@ // ##feature## apprendre +// le séparateur est __SEP__ et pas la virgule car la virgule peut être utilisée dans le trigger ou la réponse + // trigger => réponse + (si|lorsque|quand) (je|on) [te] (dis|dit) * [je|on] [veux|veut|souhaite@s] [que] tu [me|nous] (repond@s|reponde@s|dise@s) * - learn_trigger_response __SEP__ diff --git a/rs/fr_FR/network.rive b/rs/fr_FR/network.rive new file mode 100644 index 0000000..d4e89c6 --- /dev/null +++ b/rs/fr_FR/network.rive @@ -0,0 +1,21 @@ +> object test_internet python +from domogik_packages.brain_base.lib.network import test_internet +cfg_i18n = {"OK" : "L'acces a internet est OK.", + "NO_IP_ACCESS" : "L'accès a internet ne marche pas.", + "NO_DNS_ACCESS" : "L'accès a internet via adresse IP fonctionne mais les accès via DNS ne semblent pas fonctionner."} +return u"{0}".format(test_internet(rs.log, cfg_i18n)) +< object + +// ##feature## tester l'accès a internet + +/* ##suggest## +? .* (test|verif|connect).* (internet|reseau|web).* +@ peux tu tester le reseau +*/ + ++ shortcut test internet +- test_internet + ++ @peuxTu (tester|verifier) (le reseau|l access a internet|internet) +@ shortcut test internet + diff --git a/rs/fr_FR/python_do_color_command.rive b/rs/fr_FR/python_do_color_command.rive new file mode 100644 index 0000000..4628566 --- /dev/null +++ b/rs/fr_FR/python_do_color_command.rive @@ -0,0 +1,254 @@ +> object do_color_command python + """ + @param 0 : locale + @param 1 : list of data type separated by a | + @param 2 : device + @param 3 : color value + """ + from domogik_packages.brain_base.lib.color_command import color_command + + # source : https://gist.githubusercontent.com/lunohodov/1995178/raw/cb8cf1ebe1d1b8fa5759e287ebd6eaecbe3bc3e4/ral_standard.csv + # regexp to generate the dictionnary content : + # cat ral_standard.csv | sed "s/^.*,#\(......\),.*,.*,\(.*\),.*,.*,.*$/\"\2\" : \"\1\",/" + # first part of the dictionnary is manually made to get the basic colors. The second part is build as described the lines before. + basic_colors = { + "Noir" : "000000", + "Blanc" : "ffffff", + "Rouge" : "ff0000", + "Vert" : "00ff00", + "Bleu" : "0000ff", + "Jaune" : "ffff00", + "Rose" : "fd6c9e", + "Marron" : "582900", + "Violet" : "660099", + "Orange" : "ed7f10", + "Beige" : "C2B078", + "Gris" : "606060" + } + + colors = { + "Beige vert" : "BEBD7F", + "Jaune sable" : "C6A664", + "Jaune de sécurité" : "E5BE01", + "Jaune or" : "CDA434", + "Jaune miel" : "A98307", + "Jaune maïs" : "E4A010", + "Jaune narcisse" : "DC9D00", + "Beige brun" : "8A6642", + "Jaune citron" : "C7B446", + "Blanc perlé" : "EAE6CA", + "Ivoire" : "E1CC4F", + "Ivoire clair" : "E6D690", + "Jaune soufre" : "EDFF21", + "Jaune safran" : "F5D033", + "Jaune zinc" : "F8F32B", + "Beige gris" : "9E9764", + "Jaune olive" : "999950", + "Jaune colza" : "F3DA0B", + "Jaune signalisation" : "FAD201", + "Jaune ocre" : "AEA04B", + "Jaune brillant" : "FFFF00", + "Jaune curry" : "9D9101", + "Jaune melon" : "F4A900", + "Jaune genêt" : "D6AE01", + "Jaune dahlia" : "F3A505", + "Jaune pastel" : "EFA94A", + "Beige nacré" : "6A5D4D", + "Or nacré" : "705335", + "Jaune soleil" : "F39F18", + "Orangé jaune" : "ED760E", + "Orangé rouge" : "C93C20", + "Orangé sang" : "CB2821", + "Orangé pastel" : "FF7514", + "Orangé pur" : "F44611", + "Orangé brillant" : "FF2301", + "Orangé clair rillant" : "FFA420", + "Orangé rouge clair" : "F75E25", + "Orangé signalisation" : "F54021", + "Orangé de sécurité" : "D84B20", + "Orangé foncé" : "EC7C26", + "Orangé saumon" : "E55137", + "Orangé nacré" : "C35831", + "Rouge feu" : "AF2B1E", + "Rouge de sécurité" : "A52019", + "Rouge carmin" : "A2231D", + "Rouge rubis" : "9B111E", + "Rouge pourpre" : "75151E", + "Rouge vin" : "5E2129", + "Rouge noir" : "412227", + "Rouge oxyde" : "642424", + "Rouge brun" : "781F19", + "Rouge beige" : "C1876B", + "Rouge tomate" : "A12312", + "Vieux rose" : "D36E70", + "Rose clair" : "EA899A", + "Rouge corail" : "B32821", + "Rosé" : "E63244", + "Rouge fraise" : "D53032", + "Rouge signalisation" : "CC0605", + "Rouge saumon" : "D95030", + "Rouge brillant" : "F80000", + "Rouge clair brillant" : "FE0000", + "Rouge framboise" : "C51D34", + "Rouge puro" : "CB3234", + "Rouge oriental" : "B32428", + "Rouge rubis nacré" : "721422", + "Rose nacré" : "B44C43", + "Lilas rouge" : "6D3F5B", + "Violet rouge" : "922B3E", + "Violet bruyère" : "DE4C8A", + "Violet bordeaux" : "641C34", + "Lilas bleu" : "6C4675", + "Pourpre signalisation" : "A03472", + "Violet pourpre" : "4A192C", + "Violet de sécurité" : "924E7D", + "Violet pastel" : "A18594", + "Telemagenta" : "CF3476", + "Violet nacré" : "8673A1", + "Mûre nacré" : "6C6874", + "Bleu violet" : "354D73", + "Bleu vert" : "1F3438", + "Bleu outremer" : "20214F", + "Bleu saphir" : "1D1E33", + "Bleu noir" : "18171C", + "Bleu de sécurité" : "1E2460", + "Bleu brillant" : "3E5F8A", + "Bleu gris" : "26252D", + "Bleu azur" : "025669", + "Bleu gentiane" : "0E294B", + "Bleu acier" : "231A24", + "Bleu clair" : "3B83BD", + "Bleu cobalt" : "1E213D", + "Bleu pigeon" : "606E8C", + "Bleu ciel" : "2271B3", + "Bleu signalisation" : "063971", + "Bleu turquoise" : "3F888F", + "Bleu capri" : "1B5583", + "Bleu océan" : "1D334A", + "Bleu d’eau" : "256D7B", + "Bleu nocturne" : "252850", + "Bleu distant" : "49678D", + "Bleu pastel" : "5D9B9B", + "Gentiane nacré" : "2A6478", + "Bleu nuit nacré" : "102C54", + "Vert patine" : "316650", + "Vert émeraude" : "287233", + "Vert feuillage" : "2D572C", + "Vert olive" : "424632", + "Vert bleu" : "1F3A3D", + "Vert mousse" : "2F4538", + "Olive gris" : "3E3B32", + "Vert bouteille" : "343B29", + "Vert brun" : "39352A", + "Vert sapin" : "31372B", + "Vert herbe" : "35682D", + "Vert réséda" : "587246", + "Vert noir" : "343E40", + "Vert jonc" : "6C7156", + "Olive jaune" : "47402E", + "Olive noir" : "3B3C36", + "Vert turquoise" : "1E5945", + "Vert mai" : "4C9141", + "Vert jaune" : "57A639", + "Vert blanc" : "BDECB6", + "Vert oxyde chromique" : "2E3A23", + "Vert pâle" : "89AC76", + "Olive brun" : "25221B", + "Vert signalisation" : "308446", + "Vert fougère" : "3D642D", + "Vert opale" : "015D52", + "Vert clair" : "84C3BE", + "Vert pin" : "2C5545", + "Vert menthe" : "20603D", + "Vert de sécurité" : "317F43", + "Turquoise menthe" : "497E76", + "Turquoise pastel" : "7FB5B5", + "Vert nacré" : "1C542D", + "Vert opal nacré" : "193737", + "Vert pur" : "008F39", + "Vert brillant" : "00BB2D", + "Gris petit-gris" : "78858B", + "Gris argent" : "8A9597", + "Gris olive" : "7E7B52", + "Gris mousse" : "6C7059", + "Gris de sécurité" : "969992", + "Gris souris" : "646B63", + "Gris beige" : "6D6552", + "Gris kaki" : "6A5F31", + "Gris vert" : "4D5645", + "Gris tente" : "4C514A", + "Gris fer" : "434B4D", + "Gris basalte" : "4E5754", + "Gris brun" : "464531", + "Gris ardoise" : "434750", + "Gris anthracite" : "293133", + "Gris noir" : "23282B", + "Gris terre d’ombre" : "332F2C", + "Gris béton" : "686C5E", + "Gris graphite" : "474A51", + "Gris granit" : "2F353B", + "Gris pierre" : "8B8C7A", + "Gris bleu" : "474B4E", + "Gris silex" : "B8B799", + "Gris ciment" : "7D8471", + "Gris jaune" : "8F8B66", + "Gris clair" : "D7D7D7", + "Gris platine" : "7F7679", + "Gris poussière" : "7D7F7D", + "Gris agate" : "B5B8B1", + "Gris quartz" : "6C6960", + "Gris fenêtre" : "9DA1AA", + "Gris signalisation A" : "8D948D", + "Gris signalisation B" : "4E5452", + "Gris soie" : "CAC4B0", + "Telegris 1" : "909090", + "Telegris 2" : "82898F", + "Telegris 4" : "D0D0D0", + "Gris souris nacré" : "898176", + "Brun vert" : "826C34", + "Brun terre de Sienne" : "955F20", + "Brun de sécurité" : "6C3B2A", + "Brun argile" : "734222", + "Brun cuivré" : "8E402A", + "Brun fauve" : "59351F", + "Brun olive" : "6F4F28", + "Brun noisette" : "5B3A29", + "Brun rouge" : "592321", + "Brun sépia" : "382C1E", + "Brun acajou" : "4C2F27", + "Brun chocolat" : "45322E", + "Brun gris" : "403A3A", + "Brun noir" : "212121", + "Brun orangé" : "A65E2E", + "Brun beige" : "79553D", + "Brun pâle" : "755C48", + "Brun terre" : "4E3B31", + "Cuivre nacré" : "763C28", + "Blanc crème" : "FDF4E3", + "Blanc gris" : "E7EBDA", + "Blanc de sécurité" : "F4F4F4", + "Noir de sécurité" : "282828", + "Noir foncé" : "0A0A0A", + "Aluminium blanc" : "A5A5A5", + "Aluminium gris" : "8F8F8F", + "Blanc pur" : "FFFFFF", + "Noir graphite" : "1C1C1C", + "Blanc signalisation" : "F6F6F6", + "Noir signalisation" : "1E1E1E", + "Blanc papyrus" : "D7D7D7", + "Gris clair nacré" : "9C9C9C", + "Gris fonçé nacré" : "828282" + } + + cfg_i18n = {} + cfg_i18n['BASIC_COLORS'] = basic_colors + cfg_i18n['COLORS'] = colors + cfg_i18n['DONE'] = u"OK" + cfg_i18n['UNKNOWN_DEVICE'] = u"Je ne sais pas ce qu'est : " + cfg_i18n['UNKNOWN_COLOR'] = u"Je ne connais pas cette couleur" + cfg_i18n['TXT_BASIC_COLORS_1'] = u"Les couleurs de base sont" + cfg_i18n['TXT_BASIC_COLORS_2'] = u"Il y a aussi plein d'autres couleurs disponibles. Vous pouvez me demander les déclinaisons pour une couleur de base" + cfg_i18n['TXT_COLOR_LIST'] = u"Voici les déclinaisons de " + + return color_command(rs.log, args, cfg_i18n) +< object diff --git a/rs/fr_FR/python_do_command.rive b/rs/fr_FR/python_do_command.rive new file mode 100644 index 0000000..4a82d3a --- /dev/null +++ b/rs/fr_FR/python_do_command.rive @@ -0,0 +1,22 @@ +> object do_command python + """ + @param 0 : locale + @param 1 : a list of datatypes separated by | + @param 2 : device name + @param 3 : value + """ + from domogik.butler.brain import do_command + tab_args = ' '.join(args).split(",") + locale = tab_args[0].strip() + dt_type_list = tab_args[1].strip() + device = tab_args[2].strip() + if len(tab_args) > 3: + value = tab_args[3].strip() + else: + value = None + res = do_command(rs.log, locale, dt_type_list=dt_type_list, device=device, value=value) + if res == None: + return u"Je ne sais pas ce qu'est : {0}".format(device) + else: + return u"OK" +< object diff --git a/rs/fr_FR/python_do_command_per_reference.rive b/rs/fr_FR/python_do_command_per_reference.rive new file mode 100644 index 0000000..04030a9 --- /dev/null +++ b/rs/fr_FR/python_do_command_per_reference.rive @@ -0,0 +1,25 @@ +> object do_command_per_reference python + """ + @param 0 : locale + @param 1 : a list of datatypes separated by | + @param 2 : command reference (set_fat for the body plugin for example) + @param 3 : device name + @param 4 : value + """ + from domogik.butler.brain import do_command + tab_args = ' '.join(args).split(",") + locale = tab_args[0].strip() + dt_type_list = tab_args[1].strip() + command_reference = tab_args[2].strip() + device = tab_args[3].strip() + if len(tab_args) > 4: + value = tab_args[4].strip() + else: + value = None + res = do_command(rs.log, locale, dt_type_list=dt_type_list, device=device, value=value, command_reference=command_reference) + if res == None: + return u"Je ne sais pas ce qu'est : {0}".format(device) + else: + return u"OK" +< object + diff --git a/rs/fr_FR/python_get_sensor_value.rive b/rs/fr_FR/python_get_sensor_value.rive index 2f10474..d5fa54f 100644 --- a/rs/fr_FR/python_get_sensor_value.rive +++ b/rs/fr_FR/python_get_sensor_value.rive @@ -1,13 +1,25 @@ > object get_sensor_value python + """ + @param 0 : locale + @param 1 : a list of datatypes separated by | + @param 2 : the unit (for string return) + @param 3 : device name + """ from domogik.butler.brain import get_sensor_value - locale = args[0] - dt_type = args[1] - unit = args[2] - device_name = args[3:] + tab_args = ' '.join(args).split(",") + print(tab_args[0]) + print(tab_args[0].strip()) + locale = tab_args[0].strip() + dt_type = tab_args[1].strip() + unit = tab_args[2].strip() + device_name = tab_args[3].strip() value = get_sensor_value(rs.log, locale, dt_type, device_name) if value == None: return u"inconnue" - return u"{0} {1}".format(value, unit) + if unit != "": + return u"{0} {1}".format(value, unit) + else: + return u"{0}".format(value) < object diff --git a/rs/fr_FR/python_get_sensor_value_per_reference.rive b/rs/fr_FR/python_get_sensor_value_per_reference.rive new file mode 100644 index 0000000..260cfe2 --- /dev/null +++ b/rs/fr_FR/python_get_sensor_value_per_reference.rive @@ -0,0 +1,32 @@ +> object get_sensor_value_per_reference python + """ + @param 0 : locale + @param 1 : a list of datatypes separated by | + @param 2 : the unit (for string return) + @param 3 : sensor reference + @param 4 : device name (optionnal) + """ + from domogik.butler.brain import get_sensor_value + tab_args = ' '.join(args).split(",") + print(tab_args[0]) + print(tab_args[0].strip()) + locale = tab_args[0].strip() + dt_type = tab_args[1].strip() + unit = tab_args[2].strip() + sensor_reference = tab_args[3].strip() + if len(tab_args) == 5: + device_name = tab_args[4].strip() + else: + device_name = None + value = get_sensor_value(rs.log, locale, dt_type, device_name, sensor_reference = sensor_reference) + if value == None: + return u"inconnue" + if unit != "": + return u"{0} {1}".format(value, unit) + else: + return u"{0}".format(value) +< object + + + + diff --git a/rs/fr_FR/python_trigger_bool_command.rive b/rs/fr_FR/python_trigger_bool_command.rive deleted file mode 100644 index 6a37115..0000000 --- a/rs/fr_FR/python_trigger_bool_command.rive +++ /dev/null @@ -1,13 +0,0 @@ -> object trigger_bool_command python - from domogik.butler.brain import trigger_bool_command - tab_args = ' '.join(args).split("__SEP__") - locale = tab_args[0] - dt_type = tab_args[1] - device = tab_args[2] - value = tab_args[3] - res = trigger_bool_command(rs.log, locale, dt_type=dt_type, device=device, value=value) - if res == None: - return u"Je ne sais pas ce qu'est : {0}".format(device) - else: - return u"OK" -< object diff --git a/rs/fr_FR/user.rive b/rs/fr_FR/user.rive new file mode 100644 index 0000000..dc6e995 --- /dev/null +++ b/rs/fr_FR/user.rive @@ -0,0 +1,45 @@ +// On definit le nom ///////////////////////////////////////////////// ++ (@jeSuis) * +- >Ok. Tu es . + ++ qui suis[-]je +* == undefined => Je ne sais pas comment tu t'appelles. +- Tu es . +- Tu t'appelles . + ++ sais[-]tu qui je suis +- Qui es tu ? + +// RAZ du nom ///////////////////////////////////////////////// ++ oublie mon (prenom|identite|surnom|nom) +- Ok. + ++ je ne suis personne +- Ok. + ++ oublie moi +- Ok. + +// Reponse generique pour la demande 'qui es tu ?' //////////// +// Exemple d'usage dans un package : +// On donne une indication sur soi. Si le nom est connu, on traite. Sinon on defini un dialogue et on demande qui on est +// + je fais * [@pourcent] de (muscle@s|masse musculaire) +// * == undefined => >Qui es tu ? +// - do_command_per_reference fr_FR, DT_Scaling, set_muscle, , +// +// A la reposne a la question 'qui es tu' on redirige suivant le dialogue vers la question initiale pour le traitement. On definit en passant le nom et on raz le dialogue courant. +// + * +// % qui es tu ? +// * == get_weight => > {@quel est mon poids} +// * == set_weight => > {@je pese kg} +// +// Il est possible d'utiliser le bloc suivant dans plusieurs packages sans souci +// + * +// % qui es tu ? +// * ... + ++ * +% qui es tu ? +- >Ok, tu es . + + diff --git a/rs/nl_BE/DT_Basic_sensors.rive b/rs/nl_BE/DT_Basic_sensors.rive new file mode 100644 index 0000000..c0531e6 --- /dev/null +++ b/rs/nl_BE/DT_Basic_sensors.rive @@ -0,0 +1,15 @@ +// DT_Basics is a file for all sensors of : +// - DT_Number +// - DT_String +// - DT_Bool + + +// shortcut +// double ,, because no unit ++ shortcut basic * +- De waarde get_sensor_value fr_FR, DT_Number|DT_String|DT_Bool, , + ++ wat is de waarde * +@shortcut basic + + diff --git a/rs/nl_BE/DT_Bool.rive b/rs/nl_BE/DT_Bool.rive index 7e41d19..6f62a03 100644 --- a/rs/nl_BE/DT_Bool.rive +++ b/rs/nl_BE/DT_Bool.rive @@ -1,5 +1,5 @@ + shortcut bool command * dev * val * -- trigger_bool_command nl_BE__SEP____SEP____SEP__ +- do_command nl_BE, , , + lichten * @shortcut bool command DT_Switch dev val 1 @@ -12,3 +12,6 @@ + deactiveert * @shortcut bool command DT_Enable dev val 0 + +// TODO : get the status of switches and open/close sensors +// See fr_FR for the example diff --git a/rs/nl_BE/DT_ColorRGBHexa.rive b/rs/nl_BE/DT_ColorRGBHexa.rive new file mode 100644 index 0000000..37c1726 --- /dev/null +++ b/rs/nl_BE/DT_ColorRGBHexa.rive @@ -0,0 +1,8 @@ + ++ shortcut color command * dev * val * +- do_color_command nl_BE, , , + ++ verander de kleur van * naar * +@ shortcut color command DT_ColorRGBHexa dev val + +// TODO : complete with questions to ask about the colors. See fr_FR for the example diff --git a/rs/nl_BE/DT_Humidity.rive b/rs/nl_BE/DT_Humidity.rive index f8db83f..16ce355 100644 --- a/rs/nl_BE/DT_Humidity.rive +++ b/rs/nl_BE/DT_Humidity.rive @@ -1,5 +1,5 @@ + shortcut humidity * -- De vochtigheid in is get_sensor_value nl_BE DT_Humidity procent +- De vochtigheid in is get_sensor_value nl_BE, DT_Humidity, procent, + Wat is de vochtigheid voor * @shortcut humidity diff --git a/rs/nl_BE/DT_Temp.rive b/rs/nl_BE/DT_Temp.rive index 5c8eae8..74a0247 100644 --- a/rs/nl_BE/DT_Temp.rive +++ b/rs/nl_BE/DT_Temp.rive @@ -1,5 +1,5 @@ + shortcut temperature * -- De temperatuur in is get_sensor_value nl_BE DT_Temp graden +- De temperatuur in is get_sensor_value nl_BE, DT_Temp, graden, + Wat is de temperatuur van * @shortcut temperature diff --git a/rs/nl_BE/DT_Trigger.rive b/rs/nl_BE/DT_Trigger.rive new file mode 100644 index 0000000..76038e5 --- /dev/null +++ b/rs/nl_BE/DT_Trigger.rive @@ -0,0 +1,7 @@ + ++ shortcut trigger command * dev * +- do_command nl_NL, , + ++ (runs) * +@ shortcut trigger command DT_Trigger dev + diff --git a/rs/nl_BE/begin.rive b/rs/nl_BE/begin.rive new file mode 100644 index 0000000..42f56d2 --- /dev/null +++ b/rs/nl_BE/begin.rive @@ -0,0 +1,4 @@ +////////////////////////////////////////////////// +// shortcuts + +// TODO. See fr_FR for examples diff --git a/rs/nl_BE/datetime.rive b/rs/nl_BE/datetime.rive index 8df3d5e..e1cce9d 100644 --- a/rs/nl_BE/datetime.rive +++ b/rs/nl_BE/datetime.rive @@ -1,35 +1,41 @@ > object get_time python #i18n DISPLAY_FORMAT = "%-H:%M " - LOCALE = "en_US.UTF-8" + LOCALE = "nl_BE.UTF-8" ERROR_LOCALE = u"Lokale geconfigureerd is niet goed : {0}".format(LOCALE) import locale import time + import traceback + from domogik.common.utils import ucode now = time.localtime(time.time()) try: - locale.setlocale(locale.LC_ALL, LOCALE) + locale.setlocale(locale.LC_ALL, str(LOCALE)) except: + rs.log.error(u"Error : {0}".format(traceback.format_exc())) return ERROR_LOCALE - return time.strftime(DISPLAY_FORMAT, now) + return ucode(time.strftime(DISPLAY_FORMAT, now)) < object > object get_date python #i18n DISPLAY_FORMAT = "%A %d %B" - LOCALE = "en_US.UTF-8" + LOCALE = "nl_BE.UTF-8" ERROR_LOCALE = u"Lokale geconfigureerd is niet goed : {0}".format(LOCALE) import locale import time + import traceback + from domogik.common.utils import ucode now = time.localtime(time.time()) try: - locale.setlocale(locale.LC_ALL, LOCALE) + locale.setlocale(locale.LC_ALL, str(LOCALE)) except: + rs.log.error(u"Error : {0}".format(traceback.format_exc())) return ERROR_LOCALE - return time.strftime(DISPLAY_FORMAT, now) + return ucode(time.strftime(DISPLAY_FORMAT, now)) < object diff --git a/rs/nl_BE/python_do_color_command.rive b/rs/nl_BE/python_do_color_command.rive new file mode 100644 index 0000000..af25436 --- /dev/null +++ b/rs/nl_BE/python_do_color_command.rive @@ -0,0 +1,254 @@ +> object do_color_command python + """ + @param 0 : locale + @param 1 : list of data type separated by a | + @param 2 : device + @param 3 : color value + """ + from domogik_packages.brain_base.lib.color_command import color_command + + # source : https://gist.githubusercontent.com/lunohodov/1995178/raw/cb8cf1ebe1d1b8fa5759e287ebd6eaecbe3bc3e4/ral_standard.csv + # regexp to generate the dictionnary content : + # cat ral_standard.csv | sed "s/^.*,#\(......\),.*,.*,\(.*\),.*,.*,.*$/\"\2\" : \"\1\",/" + # first part of the dictionnary is manually made to get the basic colors. The second part is build as described the lines before. + basic_colors = { + "Zwart" : "000000", + "Wit" : "ffffff", + "Rood" : "ff0000", + "Groen" : "00ff00", + "Blauw" : "0000ff", + "Geel" : "ffff00", + "Roze" : "fd6c9e", + "Bruin" : "582900", + "Purper" : "660099", + "Oranje" : "ed7f10", + "Beige" : "C2B078", + "Grijs" : "606060" + } + + colors = { + "Groenbeige" : "BEBD7F", + "Zandgeel" : "C6A664", + "Signaalgeel" : "E5BE01", + "Goudgeel" : "CDA434", + "Honinggeel" : "A98307", + "Maisgeel" : "E4A010", + "Narcissengeel" : "DC9D00", + "Bruinbeige" : "8A6642", + "Citroengeel" : "C7B446", + "Parelwit" : "EAE6CA", + "Ivoorkleurig" : "E1CC4F", + "Licht ivoorkleurig" : "E6D690", + "Zwavelgeel" : "EDFF21", + "Saffraangeel" : "F5D033", + "Zinkgeel" : "F8F32B", + "Grijsbeige" : "9E9764", + "Olijfgeel" : "999950", + "Koolzaadgeel" : "F3DA0B", + "Verkeersgeel" : "FAD201", + "Okergeel" : "AEA04B", + "Briljantgeel" : "FFFF00", + "Kerriegeel" : "9D9101", + "Meloengeel" : "F4A900", + "Bremgeel" : "D6AE01", + "Dahliageel" : "F3A505", + "Pastelgeel" : "EFA94A", + "Parelmoergrijs" : "6A5D4D", + "Parelmoergoud" : "705335", + "Zonnegeel" : "F39F18", + "Geeloranje" : "ED760E", + "Roodoranje" : "C93C20", + "Vermiljoen" : "CB2821", + "Pasteloranje" : "FF7514", + "Zuiver oranje" : "F44611", + "Briljant oranje" : "FF2301", + "Briljant lichtoranje" : "FFA420", + "Licht roodoranje" : "F75E25", + "Verkeersoranje" : "F54021", + "Signaaloranje" : "D84B20", + "Dieporanje" : "EC7C26", + "Zalmoranje" : "E55137", + "Parelmoeroranje" : "C35831", + "Vuurrood" : "AF2B1E", + "Signaalrood" : "A52019", + "Karmijnrood" : "A2231D", + "Robijnrood" : "9B111E", + "Purperrood" : "75151E", + "Wijnrood" : "5E2129", + "Zwartrood" : "412227", + "Oxyderood" : "642424", + "Bruinrood" : "781F19", + "Beigerood" : "C1876B", + "Tomaatrood" : "A12312", + "Oudroze" : "D36E70", + "Lichtroze" : "EA899A", + "Koraalrood" : "B32821", + "Bleekrood" : "E63244", + "Aardbeirood" : "D53032", + "Verkeersrood" : "CC0605", + "Zalmrood" : "D95030", + "Briljantrood" : "F80000", + "Briljant lichtrood" : "FE0000", + "Framboosrood" : "C51D34", + "Zuiverrood" : "CB3234", + "Oriëntrood" : "B32428", + ""Parelmoer-donkerrood"" : "721422", + ""Parelmoer-lichtrood"" : "B44C43", + "Roodlila" : "6D3F5B", + "Roodpaars" : "922B3E", + "Heidepaars" : "DE4C8A", + "Bordeauxpaars" : "641C34", + "Blauwlila" : "6C4675", + "Verkeerspurper" : "A03472", + "Purperviolet" : "4A192C", + "Signaalviolet" : "924E7D", + "Pastelviolet" : "A18594", + "Telemagenta" : "CF3476", + ""Parelmoer-donkerviolet"" : "8673A1", + ""Parelmoer-lichtviolet"" : "6C6874", + "Paarsblauw" : "354D73", + "Groenblauw" : "1F3438", + "Ultramarijnblauw" : "20214F", + "Saffierblauw" : "1D1E33", + "Zwartblauw" : "18171C", + "Signaalblauw" : "1E2460", + "Briljantblauw" : "3E5F8A", + "Grijsblauw" : "26252D", + "Azuurblauw" : "025669", + "Gentiaanblauw" : "0E294B", + "Staalblauw" : "231A24", + "Lichtblauw" : "3B83BD", + "Kobaltblauw" : "1E213D", + "Duifblauw" : "606E8C", + "Hemelsblauw" : "2271B3", + "Verkeersblauw" : "063971", + "Turkooisblauw" : "3F888F", + "Capriblauw" : "1B5583", + "Oceaanblauw" : "1D334A", + "Waterblauw" : "256D7B", + "Nachtblauw" : "252850", + "Verblauw" : "49678D", + "Pastelblauw" : "5D9B9B", + "Parelmoerblauw" : "2A6478", + ""Parelmoer-nachtblauw"" : "102C54", + "Patinagroen" : "316650", + "Smaragdgroen" : "287233", + "Loofgroen" : "2D572C", + "Olijfgroen" : "424632", + "Blauwgroen" : "1F3A3D", + "Mosgroen" : "2F4538", + "Grijs olijfgroen" : "3E3B32", + "Flessegroen" : "343B29", + "Bruingroen" : "39352A", + "Dennegroen" : "31372B", + "Grasgroen" : "35682D", + "Resedagroen" : "587246", + "Zwartgroen" : "343E40", + "Rietgroen" : "6C7156", + "Geel olijfgroen" : "47402E", + "Zwart olijfgroen" : "3B3C36", + "Turkooisgroen" : "1E5945", + "Meigroen" : "4C9141", + "Geelgroen" : "57A639", + "Witgroen" : "BDECB6", + ""Chroom-oxydegroen"" : "2E3A23", + "Bleekgroen" : "89AC76", + "Bruin olijfgroen" : "25221B", + "Verkeersgroen" : "308446", + "Varengroen" : "3D642D", + "Opaalgroen" : "015D52", + "Lichtgroen" : "84C3BE", + "Pijnboomgroen" : "2C5545", + "Mintgroen" : "20603D", + "Signaalgroen" : "317F43", + "Mintturquoise" : "497E76", + "Pastelturquoise" : "7FB5B5", + ""Parelmoer-donkergroen"" : "1C542D", + ""Parelmoer-lichtgroen"" : "193737", + "Zuivergroen" : "008F39", + "Briljantgroen" : "00BB2D", + "Pelsgrijs" : "78858B", + "Zilvergrijs" : "8A9597", + "Olijfgrijs" : "7E7B52", + "Mosgrijs" : "6C7059", + "Signaalgrijs" : "969992", + "Muisgrijs" : "646B63", + "Beigegrijs" : "6D6552", + "Kakigrijs" : "6A5F31", + "Groengrijs" : "4D5645", + "Zeildoekgrijs" : "4C514A", + "IJzergrijs" : "434B4D", + "Bazaltgrijs" : "4E5754", + "Bruingrijs" : "464531", + "Leigrijs" : "434750", + "Antracietgrijs" : "293133", + "Zwartgrijs" : "23282B", + "Ombergrijs" : "332F2C", + "Betongrijs" : "686C5E", + "Grafietgrijs" : "474A51", + "Granietgrijs" : "2F353B", + "Steengrijs" : "8B8C7A", + "Blauwgrijs" : "474B4E", + "Kiezelgrijs" : "B8B799", + "Cementgrijs" : "7D8471", + "Geelgrijs" : "8F8B66", + "Lichtgrijs" : "D7D7D7", + "Platinagrijs" : "7F7679", + "Stofgrijs" : "7D7F7D", + "Agaatgrijs" : "B5B8B1", + "Kwartsgrijs" : "6C6960", + "Venstergrijs" : "9DA1AA", + "Verkeesgrijs A" : "8D948D", + "Verkeersgrijs B" : "4E5452", + "Zijdegrijs" : "CAC4B0", + "Telegrijs 1" : "909090", + "Telegrijs 2" : "82898F", + "Telegrijs 4" : "D0D0D0", + ""Parelmoer-muisgrijs"" : "898176", + "Groenbruin" : "826C34", + "Okerbruin" : "955F20", + "Signaalbruin" : "6C3B2A", + "Leembruin" : "734222", + "Koperbruin" : "8E402A", + "Reebruin" : "59351F", + "Olijfbruin" : "6F4F28", + "Notebruin" : "5B3A29", + "Roodbruin" : "592321", + "Sepiabruin" : "382C1E", + "Mahoniebruin" : "4C2F27", + "Chocoladebruin" : "45322E", + "Grijsbruin" : "403A3A", + "Zwartbruin" : "212121", + "Oranjebruin" : "A65E2E", + "Beigebruin" : "79553D", + "Bleekbruin" : "755C48", + "Terrabruin" : "4E3B31", + "Parelmoerkoper" : "763C28", + "Crèmewit" : "FDF4E3", + "Grijswit" : "E7EBDA", + "Signaalwit" : "F4F4F4", + "Signaalzwart" : "282828", + "Gitzwart" : "0A0A0A", + "Blank aluminiumkleurig" : "A5A5A5", + "Grijs aluminiumkleurig" : "8F8F8F", + "Zuiverwit" : "FFFFFF", + "Grafietzwart" : "1C1C1C", + "Verkeerswit" : "F6F6F6", + "Verkeerszwart" : "1E1E1E", + "Papyruswit" : "D7D7D7", + "Parelmoer-lichtgrijs" : "9C9C9C", + "Parelmoer-donkergrijs" : "828282" + } + + cfg_i18n = {} + cfg_i18n['BASIC_COLORS'] = basic_colors + cfg_i18n['COLORS'] = colors + cfg_i18n['DONE'] = u"OK" + cfg_i18n['UNKNOWN_DEVICE'] = u"Ik weet niet wat : " + cfg_i18n['UNKNOWN_COLOR'] = u"Ik weet niet deze kleur" + cfg_i18n['TXT_BASIC_COLORS_1'] = u"De basiskleuren zijn" + cfg_i18n['TXT_BASIC_COLORS_2'] = u"Er zijn ook tal van andere kleuren beschikbaar . Je kunt het mij vraagt verbuigingen voor een basiskleur" + cfg_i18n['TXT_COLOR_LIST'] = u"Hier zijn verbuigingen" + + return color_command(rs.log, args, cfg_i18n) +< object diff --git a/rs/nl_BE/python_do_command.rive b/rs/nl_BE/python_do_command.rive new file mode 100644 index 0000000..812dd63 --- /dev/null +++ b/rs/nl_BE/python_do_command.rive @@ -0,0 +1,19 @@ +> object do_command python + """ + @param 0 : locale + @param 1 : a list of datatypes separated by | + @param 2 : device name + @param 3 : value + """ + from domogik.butler.brain import do_command + tab_args = ' '.join(args).split(",") + locale = tab_args[0].strip() + dt_type_list = tab_args[1].strip() + device = tab_args[2].strip() + value = tab_args[3].strip() + res = do_command(rs.log, locale, dt_type_list=dt_type_list, device=device, value=value) + if value == None: + return "Error" + else: + return "OK" +< object diff --git a/rs/nl_BE/python_do_command_per_reference.rive b/rs/nl_BE/python_do_command_per_reference.rive new file mode 100644 index 0000000..0365e83 --- /dev/null +++ b/rs/nl_BE/python_do_command_per_reference.rive @@ -0,0 +1,25 @@ +> object do_command_per_reference python + """ + @param 0 : locale + @param 1 : a list of datatypes separated by | + @param 2 : command reference (set_fat for the body plugin for example) + @param 3 : device name + @param 4 : value + """ + from domogik.butler.brain import do_command + tab_args = ' '.join(args).split(",") + locale = tab_args[0].strip() + dt_type_list = tab_args[1].strip() + command_reference = tab_args[2].strip() + device = tab_args[3].strip() + if len(tab_args) > 4: + value = tab_args[4].strip() + else: + value = None + res = do_command(rs.log, locale, dt_type_list=dt_type_list, device=device, value=value, command_reference=command_reference) + if res == None: + return u"Error" + else: + return u"OK" +< object + diff --git a/rs/nl_BE/python_get_sensor_value.rive b/rs/nl_BE/python_get_sensor_value.rive index bdcc310..445c513 100644 --- a/rs/nl_BE/python_get_sensor_value.rive +++ b/rs/nl_BE/python_get_sensor_value.rive @@ -1,11 +1,23 @@ > object get_sensor_value python + """ + @param 0 : locale + @param 1 : a list of datatypes separated by | + @param 2 : the unit (for string return) + @param 3 : device name + """ from domogik.butler.brain import get_sensor_value - locale = args[0] - dt_type = args[1] - unit = args[2] - device_name = args[3:] + tab_args = ' '.join(args).split(",") + print(tab_args[0]) + print(tab_args[0].strip()) + locale = tab_args[0].strip() + dt_type = tab_args[1].strip() + unit = tab_args[2].strip() + device_name = tab_args[3].strip() value = get_sensor_value(rs.log, locale, dt_type, device_name) if value == None: return "Niet bestaand" - return "{0} {1}".format(value, unit) + if unit != "": + return u"{0} {1}".format(value, unit) + else: + return u"{0}".format(value) < object diff --git a/rs/nl_BE/python_get_sensor_value_per_reference.rive b/rs/nl_BE/python_get_sensor_value_per_reference.rive new file mode 100644 index 0000000..a3c676d --- /dev/null +++ b/rs/nl_BE/python_get_sensor_value_per_reference.rive @@ -0,0 +1,29 @@ +> object get_sensor_value_per_reference python + """ + @param 0 : locale + @param 1 : a list of datatypes separated by | + @param 2 : the unit (for string return) + @param 3 : sensor reference + @param 4 : device name + """ + from domogik.butler.brain import get_sensor_value + tab_args = ' '.join(args).split(",") + print(tab_args[0]) + print(tab_args[0].strip()) + locale = tab_args[0].strip() + dt_type = tab_args[1].strip() + unit = tab_args[2].strip() + sensor_reference = tab_args[3].strip() + device_name = tab_args[4].strip() + value = get_sensor_value(rs.log, locale, dt_type, device_name, sensor_reference = sensor_reference) + if value == None: + return u"inconnue" + if unit != "": + return u"{0} {1}".format(value, unit) + else: + return u"{0}".format(value) +< object + + + + diff --git a/rs/nl_BE/python_trigger_bool_command.rive b/rs/nl_BE/python_trigger_bool_command.rive deleted file mode 100644 index c262184..0000000 --- a/rs/nl_BE/python_trigger_bool_command.rive +++ /dev/null @@ -1,13 +0,0 @@ -> object trigger_bool_command python - from domogik.butler.brain import trigger_bool_command - tab_args = ' '.join(args).split("__SEP__") - locale = tab_args[0] - dt_type = tab_args[1] - device = tab_args[2] - value = tab_args[3] - res = trigger_bool_command(rs.log, locale, dt_type=dt_type, device=device, value=value) - if value == None: - return "Error" - else: - return "OK" -< object