nlrb / com.visonic.powermax

Visonic PowerMax application for Homey
https://apps.athom.com/app/com.visonic.powermax
13 stars 8 forks source link

Error when saving advanced settings in 2.0.0 #32

Closed rhannink closed 1 year ago

rhannink commented 5 years ago

When I try to save the advanced settings of the panel, I get an error (unable to save the settings, unknown error).

I can only send you a diagnostic report when the app is from the App Store. Not when installed via athom-cli

rhannink commented 5 years ago

img_4042 img_4043 img_4044

Did some more testing. When I leave the master code blank I get in red (top of app) the message (Geen pincode ingevuld, instellingen niet opgeslagen. er is een onbekende fout opgetreden [unkown error]). (3e afbeelding)

When I enter the correct pincode I get (apparaat instellingen bijgewerkt. Er is een onbekende fout opgetreden [unkown error]). But it does seem to change and store all the advanced settings despite the uknown error. (1e afbeelding)

I the changed you code a bit and hardcoded the master code in the app.json file:

    "value": "1234"

I then deleted the entered master pincode (4x*) and then saved the settings again and I the got a green message: Instellingen opgeslagen (2e afbeelding)

So it looks like it has something to do with entering the code in the app, maybe wrong type or something......

nlrb commented 5 years ago

Well, I hope you don't have a pin code stored in the device settings now... That is the whole trick here. I'm not using the regular path that saves all device settings, because you don't want the pin code to be stored! Hence I do generate an error towards Homey such that the settings are not stored when saving the settings:

    // Make sure Homey doesn't change the settings - we do that!
        callback(result.msg, null)

However, this should not be propagated to the user (and it never was).

rhannink commented 5 years ago

I am not completely sure what this all means....Athom did something wrong in their API's ?????

rhannink commented 5 years ago

I added some logging to the code which outputs the master code from the panel and the master code from the advanced settings screen. They are identical. So the problem is that Athom generates an error while there actually is no error....

But the why do I not get an error when I hardcode the master code .........

nlrb commented 5 years ago

You don't hardcode the pin code. The value in the app.json is just the default value.

rhannink commented 5 years ago

Did a little dive in the SDKv2 and in turns out that it should be:

    // Make sure Homey doesn't change the settings - we do that!
        callback(null, result.msg)

With that change, it works for me.....

rhannink commented 5 years ago

Only one small problem. If I change after saving the settings another parameter, I get the message that the pincode is not filled in, but there are still 4 * in the master code field. This suggests that the master code is filled in.

nlrb commented 5 years ago

No, don’t change that!! Now your pin code is saved in the device settings. This removes the whole security measure... You will now need to delete your panel device.

rhannink commented 5 years ago

I am lost...it shows again, I am no programmer...I am not good enough at NodeJS to fix these kind of problems. I hope you can fix it (with Athom).