switchNotifications error



  • BTW - there is a small error in switchNotifications.

    Let's say I get the switch notifications and it responds like:

    [{"enabled":[],"disabled":[{"name":"notifyPowerStatus","version":"1.0"},{"name":"notifySWUpdateInfo","version":"1.0"},{"name":"notifySettingsUpdate","version":"1.1"},{"name":"notifyStorageStatus","version":"1.1"},{"name":"notifyStorageStatus","version":"1.2"}]}]
    

    Now - if I decide to enable everything and request..

    [{"enabled":[{"name":"notifyPowerStatus","version":"1.0"},{"name":"notifySWUpdateInfo","version":"1.0"},{"name":"notifySettingsUpdate","version":"1.1"},{"name":"notifyStorageStatus","version":"1.1"},{"name":"notifyStorageStatus","version":"1.2"}],"disabled":[]}]
    

    The result comes back that nothing is enabled and I receive no events:

    [{"enabled":[],"disabled":[{"name":"notifyPowerStatus","version":"1.0"},{"name":"notifySWUpdateInfo","version":"1.0"},{"name":"notifySettingsUpdate","version":"1.1"},{"name":"notifyStorageStatus","version":"1.1"},{"name":"notifyStorageStatus","version":"1.2"}]}]
    

    The reason for this is because I included an empty disabled element. Had I simply requested this (notice no disabled element):

    [{"enabled":[{"name":"notifyPowerStatus","version":"1.0"},{"name":"notifySWUpdateInfo","version":"1.0"},{"name":"notifySettingsUpdate","version":"1.1"},{"name":"notifyStorageStatus","version":"1.1"},{"name":"notifyStorageStatus","version":"1.2"}]}]
    

    Then the response is correct and those events are enabled

    [{"enabled":[{"name":"notifyPowerStatus","version":"1.0"},{"name":"notifySWUpdateInfo","version":"1.0"},{"name":"notifySettingsUpdate","version":"1.1"},{"name":"notifyStorageStatus","version":"1.1"},{"name":"notifyStorageStatus","version":"1.2"}],"disabled":[]}]
    

    Seems like the API processing doesn't like an empty element array on the disabled element...



  • Have put this on the list of improvements, will start with updating the documentation to clarify. Hopefully the API will be improved also.


Log in to reply