-
Autor
Hi All... I am hoping someone else has tried reading the json messages from the Shelly 1 into Python. I am creating a small GUI to try and get the status of the relay before sending a command thru URL/HTTP request. I can return status from Python, but cannot determine which portion I need to try and read so I can see the json part of it "ison"=true or false. If anyone can assist me with this, that would be great.
Code
Shelly http return status:
Trying to read in "ison":true or false
{
"ison": true,
"has_timer": false,
"timer_started": 0,
"timer_duration": 0,
"timer_remaining": 0,
"source": "http"
}
----------------------------------------------------------
* Python Code:
shelly01 = 'http://shelly1-483fda82683f/status'
shURL = 'NOT_INIT'
def shelly_status():
shURL = shelly01
sh01 = requests.get(shURL)
x = json.loads(sh01.text)
status = x["relays"]
messagebox.showinfo(status)
Alles anzeigen