I cloned the identical non-working lines and converted them to ordinary buttons, which do work fine.
I've left both types of buttons so you can see in the example that clicking an ordinary button toggles the led and display the different image, but clicking the image does nothing because it never reaches the specified branch.
Any test pics should show the problem even if they are both the same.
let pin = 1
let pinstatus = 1
po pin pinstatus
[home]
cls
if pinstatus == 0 then button "routerOFF.jpg" [toggle]
if pinstatus == 1 then button "routerON.jpg" [toggle]
if pinstatus == 0 then imagebutton "routerOFF.jpg" [toggle]
if pinstatus == 1 then imagebutton "routerON.jpg" [toggle]
wait
[toggle]
if pinstatus == 0 then pinstatus = 1 else pinstatus = 0
po pin pinstatus
'end ' uncommenting this proves that the imagebuttons never branch here, but the ordinary buttons do
goto [home] repaints the browser screen then waits for events
wait ' this is in case wait was required in the branch, but it wouldn't ever be reached here