Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be able to change dicts/lists via CLI plugin #118

Closed
wants to merge 2,319 commits into from

Conversation

ohinckel
Copy link
Member

@ohinckel ohinckel commented Sep 4, 2016

(copied from mknx/smarthome#165)

Currently only simple types (like str, int, ...) can be changed by the CLI plugin's up command. This patch add support for updating items with the type dict and list by using the following commands:

> ls test.dict
Items:
======
test.dict = {}
> up test.dict = { "key1" : "value1", "key2" : 2 }
> ls test.dict
Items:
======
test.dict = {'key2': 2, 'key1': 'value1'}
> 
> ls test.list
Items:
======
test.list = []
> up test.list = [ 1, 2, 3, "foo", "bar" ]
> ls test.list
Items:
======
test.list = [1, 2, 3, 'foo', 'bar']
> 

The implementation is using json.loads() method, which converts the string value and then try to update with the resulting value. So passing a wrong syntax or wrong structure type will end in the
Item test.dict: value ... does not match type dict. Via CLI ...
error.

Since it is implemented directly in the item's cast functions, all places updating the item values can now also use a string value for item of type dict/list. This could be a drawback and was not really inteted by this patch, but could on the other side be a handy feature.

msinn and others added 30 commits July 3, 2016 22:26
- start/stop of services only visible in developer mode
- added display which deamon is running for KNX (knxd/eibd)
- start/stop of services only visible in developer mode
- added display which deamon is running for KNX (knxd/eibd)
visu_smartvisu: Fixed possible case of referencing an uninitialized ver
visu_smartvisu: Fixed possible case of referencing an uninitialized var
cstrassburg and others added 24 commits August 31, 2016 16:32
bugfix for reading coil registers
…md5password

Backend Plugin: Allow hashed passwords in configuration
# usually 3.0.0 with unicode support is installed but Python 3.2 does not support this
Bug fix operationlog and gpio plugins + small item update for multiclick logic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet