kalliope-project/kalliope_signal_gpio_input

DNA Type not valid?

Closed this issue · 10 comments

Do I do something wrong? I tried to install this using latest kalliope dev:

kalliope install --git-url https://github.com/kalliope-project/kalliope_signal_gpio_input.git

As a result I get:

Cloning repository...
Checking repository...
The DNA type signal is not valid
The DNA type must be one of the following: ['neuron', 'stt', 'tts', 'trigger']

Even when I clone the finals without kalliopes install process. Kalliope fails to run.

Traceback (most recent call last):
  File "/opt/loxberry/data/plugins/kalliope_loxscontrol/pyvenv/bin/kalliope", line 11, in <module>
    sys.exit(main())
  File "/opt/loxberry/data/plugins/kalliope_loxscontrol/pyvenv/local/lib/python2.7/site-packages/kalliope/__init__.py", line 136, in main
    brain_loader = BrainLoader(file_path=brain_file)
  File "/opt/loxberry/data/plugins/kalliope_loxscontrol/pyvenv/local/lib/python2.7/site-packages/kalliope/core/Models/Singleton.py", line 6, in __call__
    cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
  File "/opt/loxberry/data/plugins/kalliope_loxscontrol/pyvenv/local/lib/python2.7/site-packages/kalliope/core/ConfigurationManager/BrainLoader.py", line 45, in __init__
    self.brain = self.load_brain()
  File "/opt/loxberry/data/plugins/kalliope_loxscontrol/pyvenv/local/lib/python2.7/site-packages/kalliope/core/ConfigurationManager/BrainLoader.py", line 92, in load_brain
    signals = self._get_signals(synapses_dict["signals"])
  File "/opt/loxberry/data/plugins/kalliope_loxscontrol/pyvenv/local/lib/python2.7/site-packages/kalliope/core/ConfigurationManager/BrainLoader.py", line 156, in _get_signals
    if ConfigurationChecker().check_signal_dict(signal_dict):
  File "/opt/loxberry/data/plugins/kalliope_loxscontrol/pyvenv/local/lib/python2.7/site-packages/kalliope/core/ConfigurationManager/ConfigurationChecker.py", line 206, in check_signal_dict
    check_signal_exist(signal_name)
  File "/opt/loxberry/data/plugins/kalliope_loxscontrol/pyvenv/local/lib/python2.7/site-packages/kalliope/core/ConfigurationManager/ConfigurationChecker.py", line 201, in check_signal_exist
    package_name))
kalliope.core.Utils.Utils.ModuleNotFoundError: [ImportError] The module Gpio_input does not exist in the package kalliope.signals.gpio_input.gpio_input

I tried to fill __init__.py - which is empty (?), but even this does not work??

okay - next step:

ConfigurationChecker.check_signal_dict looks in settings.resources.neuron_folder - I think this should be: settings.resources.signal_folder?

as hotfix I copied the signal to the neuron folders - this helps - but Kalliope crashs again:

2018-05-13 21:32:04 :: kalliope-0.5.2b :: [Utils]-> get_dynamic_class_instantiation : package path : kalliope.signals.gpio_input.gpio_input
2018-05-13 21:32:04 :: kalliope-0.5.2b :: [HookManager] hook: on_start , type: <type 'str'>
2018-05-13 21:32:04 :: kalliope-0.5.2b :: [Utils]-> get_dynamic_class_instantiation : loading path : /opt/loxberry/data/plugins/kalliope_loxscontrol/signal/gpio_input/gpio_input.py, as package Gpio_input
2018-05-13 21:32:04 :: kalliope-0.5.2b :: [SynapseLauncher] start_synapse_by_list_name called with synapse list: ['on-start-synapse'] 
2018-05-13 21:32:04 :: kalliope-0.5.2b :: [NotificationManager] Add new instance to the manager
2018-05-13 21:32:04 :: kalliope-0.5.2b :: [LIFOBuffer] LIFO buffer created
2018-05-13 21:32:04 :: kalliope-0.5.2b :: Init Signal :Gpio_input
2018-05-13 21:32:04 :: kalliope-0.5.2b :: [LIFOBuffer] Add a new synapse list to process to the LIFO
2018-05-13 21:32:04 :: kalliope-0.5.2b :: [gpio_input] Starting gpio_input signal manager
2018-05-13 21:32:04 :: kalliope-0.5.2b :: [LIFOBuffer] number of synapse list to process: 1
2018-05-13 21:32:04 :: kalliope-0.5.2b :: [gpio_input] Add the pin 23 to the list
2018-05-13 21:32:04 :: kalliope-0.5.2b :: [LIFOBuffer] number of neuron to process: 1
2018-05-13 21:32:04 :: kalliope-0.5.2b :: [gpio_input] Synapse gpio-test added to pin 23
Traceback (most recent call last):
2018-05-13 21:32:04 :: kalliope-0.5.2b :: [LIFOBuffer] process_neuron_list: is_api_call: True
  File "/opt/loxberry/data/plugins/kalliope_loxscontrol/pyvenv/bin/kalliope", line 11, in <module>
    2018-05-13 21:32:04 :: kalliope-0.5.2b :: [NeuronLauncher] replacing brackets from {'message': [u'Was kann ich f\xfcr Dich tun?'], 'is_api_call': True}, using {}
sys.exit(main())
  File "/opt/loxberry/data/plugins/kalliope_loxscontrol/pyvenv/local/lib/python2.7/site-packages/kalliope/__init__.py", line 163, in main
    2018-05-13 21:32:04 :: kalliope-0.5.2b :: [NeuronLauncher] replacing brackets from [u'Was kann ich f\xfcr Dich tun?'], using {}
start_kalliope(settings, brain)
2018-05-13 21:32:04 :: kalliope-0.5.2b :: [NeuronLauncher] replacing brackets from Was kann ich für Dich tun?, using {}
  File "/opt/loxberry/data/plugins/kalliope_loxscontrol/pyvenv/local/lib/python2.7/site-packages/kalliope/__init__.py", line 258, in start_kalliope
    signal_instance.daemon = True
2018-05-13 21:32:04 :: kalliope-0.5.2b :: [NeuronLauncher] replacing brackets from True, using {}
  File "/usr/lib/python2.7/threading.py", line 1018, in daemon
    raise RuntimeError("Thread.__init__() not called")

if I comment out the sample synapse - kalliope is working fine. Sample Synapse copied from doc as reference:

---
 - name: "gpio-test"
  signals:
    - gpio_input:
        pins:
          - 23          
  neurons:
    - say:
        message: "Button pressed !" 
    - gpio:
          set_pin_high:
            - 24

Do you have "signal" in your setting resource dir?

We forgot to add in the doc that a signal is a valid entry in the setting.

Oh damn, it's an issue with kalliope.
I open an issue on the main project for this.

As a workaround, you can clone the signal in the core signal folder of kalliope and then reinstall kalliope.

After a little check of the code, it seems that the installation of a community signals wont work.
But, if you clone it manually inside a signal path that is declared in your settings as "signal" resource, it will work.
Can you give a try?

no would had not, but you fixed it with your commit

I will check your commit - but I think this will work. I just was not sure if settings.resources.signal_folder exist.

as far as I understand:

__init__.py should not be empty? Right? It should contain:

from gpio_input import Gpio_inport

No it's ok, The signal is fixed.
We just need to wait the last PR to be merged in the core program.

thanks - as far as I tested the core pr is working and your change in the plugin as well.