Error when adding custom watcher


#1

Hi all

I tried to use a custom watcher. I basically copied the QRCodeDetector and changed it to detect colors. However, I get the following error:

Folder structure when uploading to /apps is the following:

  • applicationname.zip
    • index.html
    • main.js
    • [some other files]
    • watchers
      • color-detector
        • color-detector.py

What am I doing wrong?


#2

Hi @Yves,

The folder structure seems fine.

Please make sure that the name of your Custom Watcher (ColorDetector) is the same as the name declared in the web application. That error should represent this incompatibility.


#3

I check everything and the names are identical:
Webapp:
const colorWatcher = {
name: ‘ColorDetector’,
[…]

color-detector.py:
logger = logging.getLogger(“lampix.ColorDetector”)
[…]
class ColorDetector(Watcher):
[…]

Error message:
Something went wrong while trying to execute the request received from JS
Traceback (most recent call last):
File “lampix/cefbridge.py”, line 36, in lampix.cefbridge.CefBridge.javascript_request_listener
File “lampix/applications/webapp.py”, line 250, in lampix.applications.webapp.WebAppController.add_watchers
KeyError: u’ColorDetector’

Any ideas?


#4

Hi @Yves,

If the watcher names match, try setting a ‘watchers’ key, in ‘lampixConfig’ that can be found in the package.json file of your application. Here is an example:
image
Let us know if this helps.