This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.
Closed

Trigger from app.js to settings

Hi,

I try to get a trigger propagated from the app.js file to the settings file. Currently, when I set a variable in the settings file I can subscribe to that setting in the app.js file with 

Homey.manager('settings').on('set', function(variableName) { ...... });

The other way around I think I have a mistake. Saving the trigger works with

Homey.manager('settings').set('variables', variables);

Retrieving it in the settings page does not work:
Homey.on('set', function (variable) {
            console.log(variable);
 });

Anyone know what I'm doing wrong? Or how I can achieve this?

Comments

  • EmileEmile Administrator, Athom
    edited February 2016
    Emit a realtime event:
    Homey.manager('api').realtime('setting_changed', var_name);

    And in settings:
    Homey.on('setting_changed', function( name ){ ... });


  • This indeed does the trick. Thanks!
  • UrandayUranday Member
    edited February 2016
    ----- wrong thread.
This discussion has been closed.