shelly-script-examples icon indicating copy to clipboard operation
shelly-script-examples copied to clipboard

WIFI provisioning script - error encountered

Open MoDo-git opened this issue 2 years ago • 4 comments

Received an error running this script on a ShellyPlus2PM:

this is the log: Uncaught ReferenceError: "self" is not defined at for (let papk in self.targetCache) { ^ in function "isInCache" called from if (self.isInCache(cSSID) === false) { ^ in function called from system

Seems like there is an issue here: https://github.com/ALLTERCO/shelly-script-examples/blame/297358ede3b448d683a90a6c301e2c82dfd02506/wifi-provision.js#L127-L134

The self variable is used, but it is not defined within the function's scope.

MoDo-git avatar Nov 22 '23 12:11 MoDo-git

hey, did you ever get to the bottom of this, I'm trying to get this working but have run into the same issue.

chrisharrison123 avatar Apr 17 '24 16:04 chrisharrison123

Never ever got it working. Would be awesome feature if working!!

MoDo-git avatar Apr 17 '24 16:04 MoDo-git

@MoDo-git @chrisharrison123 Could you please test this updated version of the script: https://github.com/ALLTERCO/shelly-script-examples/blob/fix-wifi-provision-example/wifi-provision.js

taulfsime avatar May 04 '24 17:05 taulfsime

Hi,

Iv been testing the updated script and from what iv found, the script now doesn’t seem to get caught by the “self cache” issue anymore, it connects to the target device but then I lose connection to it, presumably as its now connected to the target but the target never appears to get provisioned and then I cant access it until I reset the unit again. Is there anything that I’m supposed to configure in here before use?

Also as part of this id asked Chris that this script had a function inserting a preset MQTT configuration, the reason is that when a unit is connected to the wifi, it then connects to one of our MQTT brokers where it is reprogrammed via rpc messages.

Look forward to hearing back.

Thanks

Chris

Chris Harrison Technical Director 03330 341 312 | 07921800745 @.*** resicentral.co.uk From: taulfsime @.> Sent: Saturday, May 4, 2024 6:12 PM To: ALLTERCO/shelly-script-examples @.> Cc: Chris Harrison @.>; Mention @.> Subject: Re: [ALLTERCO/shelly-script-examples] WIFI provisioning script - error encountered (Issue #77)

@MoDo-githttps://github.com/MoDo-git @chrisharrison123https://github.com/chrisharrison123 Could you please test this updated version of the script: https://github.com/ALLTERCO/shelly-script-examples/blob/fix-wifi-provision-example/wifi-provision.js

— Reply to this email directly, view it on GitHubhttps://github.com/ALLTERCO/shelly-script-examples/issues/77#issuecomment-2094306245, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BH24X3N6E7Z54G4XTXYDTZLZAUJHDAVCNFSM6AAAAAA7WETR7CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJUGMYDMMRUGU. You are receiving this because you were mentioned.Message ID: @.@.>>

chrisharrison123 avatar May 07 '24 10:05 chrisharrison123