Jan200101 / ShellyPy

Python library to interact with Shelly devices
MIT License
22 stars 14 forks source link

Method Not Allowed during initialization #14

Closed jm185267 closed 1 year ago

jm185267 commented 1 year ago

After the recent firmware update of Shelly Pro 4PM to version 1.0.3 it is no longer possible to initialize the device with the following exception: Bad JSON

After a short debugging session I discovered that in class class Shelly():, method: def __detect__(self, ip, port): POST is used to gather the device information: response = post(url, timeout=5). After changing that to get() (and importing get from requests), Shelly starts responding normally.

This doesn't seem to align with the HTTP API description on the Shelly webpage (they claim that the method doesn't matter) but I might be missing something.

Device Info

{
    "name": "Pool Control",
    "id": "shellypro4pm-c8f09e83efa8",
    "mac": "C8F09E83EFA8",
    "slot": 0,
    "model": "SPSW-104PE16EU",
    "gen": 2,
    "fw_id": "20230912-082358/1.0.3-g6176478",
    "ver": "1.0.3",
    "app": "Pro4PM",
    "auth_en": false,
    "auth_domain": null
}
jaedog commented 1 year ago

seems like post is no longer allowed for the /shelly endpoint. It must be a get.

Edit: After reading Op.. this comment is a dupe. +1 for reading comprehension.

Jan200101 commented 1 year ago

Can reproduce, will fix as soon as I can and release a patch release a new minor version

Jan200101 commented 1 year ago

fix commited tested against Shelly Gen 1 and 2 tagged as 0.3.0 pushed released to pypi

If this still occurs reopen the issue.