How to declare watchers in package.json?

Log is saying my app “has not declared any watchers in package.json”
Trying to hook up my own button using the button preset. It works in the simulator but not on Lampix.
I’m not seeing the declaring of watchers in the packages on the Lampix github. Or I’m just missing it. How do I go about doing this?

Thanks!!

Hi @amoore154,

That message is just an informative one. You can just ignore it if you do not want to use custom watchers in your application (please refer to the documentation on Custom Watchers for further information).

Regarding the declaration of custom watchers, in the image below you can see an example of how this is done setting the watchers entry of the lampixConfig section in the package.json file of your application.


After declaring the watchers, you must create a folder named watchers at the top level of your application (at same level with the package.json file) and put your custom watchers inside it. An example for the necessary directory structure can be found here.

Best,
Sergiu.

Ohhhh ok. Thank you for the in-depth response. Good to be able to rule out that error. However, I am still having the issue of my buttons which I have hooked up to my own html button using the guide you all provided. In the lampix simulator they are working just fine and am getting a logged message in the console that the button is in fact being activated. However, in Lampix nothing happens when I click the button.

Among other possibilities, it might actually be the case that the button is not being registered at the desired coordinates. Would you be ok with sharing the logs with us to further investigate?
You can share them by following these steps:

  • login to your MyLampix account,
  • go to the “Devices” tab on the left,
  • click the downward pointing arrow for the Lampix device in question,
  • click the “Share” button,
  • enter our email account (admin-my-lampix@lampix.co) in the box in order to share it with us.

Best,
Sergiu.

You know, I do believe that is the issue… being caused by the fact I don’t think I’m registering a watcher. Working on getting the computer connected to Lampix to formally send logs (need to speak to head of lab to set that up) but in the meantime, because I am on a time crunch to figure this button issue out, here is a screen shot of the log once I have activated my application. I notice at no point in my app being activated is there a message that a watcher has been enabled nor the image of a black screen with a white rectangle.

So, I’m a little confused because Is this code not setting up a watcher?? (It’s likely I’m just a little confused and missing something basic as I am an electrical engineering student who has been assigned a computer programming task):

const buttonWatcher = {
  name: 'NeuralNetworkClassifier',
  shape: {
    type: 'rectangle',
    data: {
      posX: x,
      posY: y,
      width: 50,
      height: 50
    }
  },
  onClassification: callback,
  params: {
    neural_network_name: 'fingers'
  }
};

On further troubleshooting, I believe my javascript file is not being read. To test this, I tried to get the js file to simply print “Javascript file read” and it will on the simulator but not on Lampix. This also explains why there is no styling unless I link the css file into the html file (which works even though I do receive a console log error that the css file is not of the html filetype). I’m assuming there is something occurring when I go to compile my zip file? or in my package?