Code Monkey home page Code Monkey logo

multidevice's People

Contributors

morg42 avatar onkelandy avatar

Watchers

 avatar  avatar  avatar

Forkers

onkelandy

multidevice's Issues

Für reply Pattern lookup und valid_list bereitstellen

Low prio, aber vielleicht eine Idee..

Wenn ein Lookup für einen command angegeben ist, könnte es hilfreich sein, die dort enthaltenen Keys für den reply-token zu nutzen.
Beispiel, aktueller Denon Command Input für Zone 2 und 3. Dieser muss ganz nach unten in der Liste, damit nicht andere Replies, die mit dem gleichen String anfangen, falsch abgefangen werden (zB Z2PSBAS (\d{2}, Z2SLP(\d{3}|OFF), Z2(\d{2,3})).

'reply_token': 'REGEX', 'reply_pattern': 'Z2(.*)', 'lookup': 'INPUT'

Wenn das hier ginge..

'reply_token': 'REGEX', 'reply_pattern': 'Z2(MD_LOOKUP)', 'lookup': 'INPUT'

..und das so aufgelöst würde


'reply_pattern': 'Z2(<lookup1>|<lookup2>|<lookup3>)'

Ähnlich vielleicht auch valid_list oder valid_list_ci Angaben.

Aktuelle Lösung ist entweder eine sehr gefinkelte Regex oder das Hinunterschieben des commands an das Ende der Liste. Also kein Drama.

Keep original struct order?

Not too important..
Currently when creating the struct and some additional items are created (e.g. using item_template or read_groups) those items get pushed to the beginning of the item tree. The original order is "broken".

If bored.. rename/clean globals

ITEM_ATTR_CYCLE = 'md_read_cycle'
ITEM_ATTR_READ_INIT = 'md_read_initial' # trigger read on initial connect
ITEM_ATTR_GROUP = 'md_read_group' # trigger read with read group
ITEM_ATTR_READ_GRP = 'md_read_group_trigger'

is not very intuitive though most likely noone will ever care ;)
Still suggest:
ITEM_ATTR_READ_CYCLE = 'md_read_cycle'
ITEM_ATTR_READ_INIT = 'md_read_initial' # trigger read on initial connect
ITEM_ATTR_READ_GROUP = 'md_read_group' # trigger read with read group
ITEM_ATTR_READ_TRIGGER = 'md_read_group_trigger'

..and a bonus ;)
PLUGIN_ATTR_CLEAN_STRUCT = 'clean_structs'
->
PLUGIN_ATTR_CLEAN_STRUCTS = 'clean_structs'

CMD_ATTR_PARAM_VALUES should be obsolete, right? All references in imports, docue and e.g. line 588 in MD_Command.py might be killed? Inline docu of MD_Command_JSON needs update.

Feature Request: commands syntax check on struct creation

Not urgent at all... but...
Sometimes weird things happen that might stay uncovered.. ;)
Some basic check of the commands file might help here, e.g. are the lists and dicts at the correct position, etc.

Example:
When you forget (despite the plural name... ;)) that read_groups needs a list and only add one entry as dict, in the struct the item gets a child item called "item_attrs"

Merging of lookups not working?

For sending as well receiving merging lookup tables doesn't seem to work.
Example device denon has an ALL and MODEL specific lookup for "input". Obviously only the model specific one is taken into account..

Feb 13 00:46:54 CET WARNING  plugins.multidevice.denon CP Server Thread-14 command zone1.control.input with value MPLAY produced error on converting value, aborting. Error was: Lookup of value mplay in table INPUT with entries {'phono': 'PHONO', 'cd': 'CD', 'aux2': 'AUX2'} failed, entry not found.  --  (MD_Device.py:send_command:260)

(log output modified to see content of lookup dict)

multiple read_cmd_triggers (as list)?

Sort of a special case (of course ;))...
When adding multiple command "sections" in the same hierarchy, e.g. tuner and general from denon, the read command/item gets overwritten and therefore doesn't trigger all read_cmds as expected.

Solution part 1:
put md_read_group_trigger values in a list when creating the struct. So when merging the structs by shng, the list gets merged (this works out of the box)

Solution part 2:
adjust the relevant parts in init.py make list out of single values and iterate through list

Structs den Commands/Models anpassen

Variante 1:
Items mit Verweis auf nicht geladenen Command werden automatisch nicht ins Struct aufgenommen. Unteritems auch nicht.

Variante 2:
Items mit Verweis auf nicht geladenen Command werden nicht ins Struct aufgenommen, sofern es keine Unteritems gibt. Ansonsten werden sie ihren md_Einträgen beraubt und das nächste Hierarchielevel wird wieder gleich behandelt

Variante 3:
Definition, welche Structs für welches Model geladen werden sollen

Variante 4:
md_models Attribut, mit dem per Liste pro Item definiert werden kann, bei welchen Modellen das Item geladen werden soll. Sollte ein Unteritem einen vorhandenen Command haben, müsste wie in Variante 2 vorgegangen werden.

Andere Varianten?

read_trigger gets created in "all" struct only?

'alarms': {'read': True, 'write': False, 'item_type': 'dict', 'read_cmd': '{CUSTOM_ATTR1} alarms 0 100 all', 'dev_datatype': 'SqueezeAlarms', 'reply_token': 'REGEX', 'reply_pattern': r'{CUSTOM_PATTERN1} alarms 0 100 all fade:\d+ count:\d+ (.*)', 'item_attrs': {'initial': True, 'read_groups': [{'name': 'player.control.alarms', 'trigger': 'query'}]}}

When creating the struct, this is correct:

ALL:
    player:
        control:
            alarms:
                type: dict
                ..

                query:
                    type: bool
                    enforce_updates: true
                    md_device: DEVICENAME
                    md_read_group_trigger: player.control.alarms.query

While the struct called "player" does not have the correct item tree

Minor issue: read_group trigger attributes get deleted when respective item is created additionally

Nothing too important as it can be fixed by adding the relevant attributes manually. However..

'item_attrs': {'item_template': 'time', 'enforce': True, 'read_groups': [{'name': 'player.control.time_poll', 'trigger': 'poll'}]}
item_templates = {
    'time': {
        'poll':
            {
                'type': 'bool',
                'eval': 'True if sh....playmode() == "play" else None',
                'enforce_updates': True,
                'cycle': '5 = True',
                #'md_device': 'DEVICENAME', -> needs to be added manually
                #'md_read_group_trigger': 'player.control.time_poll' -> needs to be added manually
            }
    }

}

leads to missing read_group_trigger attributes for the "poll" item that is declared as the read_group trigger.

Feature request: REGEX as list

Low prio again ;)
While most situations can be handled with complex regexes it sometimes might be necessary or at least much more convenient to declare multiple regexes for one command.
Example..

(?:mode|playlist) (play|pause\s?\d?|stop)

having this option would be more convenient, maybe less error-prone:

['mode (MD_VALID_LIST_CI)', 'playlist pause (0|1)']

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.