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

Creating a scenario fails with a command and specific name parameter #536

Open
vdomos opened this issue Aug 13, 2017 · 1 comment
Open

Comments

@vdomos
Copy link
Contributor

vdomos commented Aug 13, 2017

Here is a scenario that must execute a command every hour

scenario_test6

Every test to create a scenario with this device command parameters "message" and "type" fail with this error:

2017-08-13 22:58:26,351 domogik-scenario INFO Create or save scenario : name = '0', id = '0',json = '
{  
   "type":"controls_if",
   "id":"CXeRaH*|O;%(XRY0~0(d",
   "IF0":{  
      "type":"cron.CronTest",
      "id":"^e/Y2^OEHB4-GR-PyWMY",
      "cron.cron":"@hourly"
   },
   "DO0":{                              ==> Missing '"type":"command.CommandAction.xx",'
      "type":{                          ==> "type" is the name of parameter !
         "type":"text",
         "id":"(8T/!_O|}/yyKIyyLewm",
         "TEXT":"param2"
      },
      "id":"-33H2E]a,`=lSMgCxr$D",
      "message":{  
         "type":"text",
         "id":"2,jU:d5nA[7k=qf[/.2t",
         "TEXT":"param1"
      }
   }
}'
2017-08-13 22:58:26,507 domogik-scenario.Test 6 DEBUG Create test instance cron.CronTest with uuid ecffb34a-f607-44ed-84dd-ab045f1a8014
2017-08-13 22:58:26,508 domogik-scenario.Test 6 DEBUG Trigger <bound method ScenarioInstance.generic_trigger of <domogik.scenario.scenario.ScenarioInstance instance at 0x7ff89c32f5f0>> called by parameter <domogik.scenario.parameters.cron.CronParameter instance at 0x7ff89c2e4710>
2017-08-13 22:58:26,509 domogik-scenario.Test 6 DEBUG Eval the condition!
2017-08-13 22:58:26,540 domogik-scenario ERROR Creation of a scenario failed. Error is : Traceback (most recent call last):
  File "/opt/dmg/domogik.github/src/domogik/scenario/manager.py", line 235, in create_scenario
    scen = ScenarioInstance(self.log, cid, name, payload, dis, state, self._db)
  File "/opt/dmg/domogik.github/src/domogik/scenario/scenario.py", line 132, in __init__
    self._instanciate()
  File "/opt/dmg/domogik.github/src/domogik/scenario/scenario.py", line 187, in _instanciate
    self._parsed_condition = self.__parse_part(self._json)
  File "/opt/dmg/domogik.github/src/domogik/scenario/scenario.py", line 276, in __parse_part
    dop = self.__parse_part(part["DO{0}".format(num)], (level+incLev), debug, True)
  File "/opt/dmg/domogik.github/src/domogik/scenario/scenario.py", line 243, in __parse_part
    if part['type'][0:3] == 'DT_':
TypeError: unhashable type

The "type" name of the parameter generates an error when formatting the scenario json.
The scenario is incomplete, the field "type":"command.CommandAction.xx", is missing in json.

If I replace the parameter name by another, There is no longer the issue.

Same issue on 0.5.3.and 0.6

@Cereal2nd
Copy link
Contributor

this is a limitation in blockly, we can not solve this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants