After updating from indigo 7.5 to 2022 it doesn't work anymore .
It generates this erro: a bytes-like object is required, not 'str'
error on line 14: split_response = data_getStatus.split(',')
This is the script:
- Code: Select all
#get data in HTMl Response from Daikin HVAC
from urllib.request import urlopen
urlReturned = urlopen('http://192.168.0.54/aircon/get_sensor_info')
data_getStatus = urlReturned.read()
#transform HTMl Response in JSON format
# Split the result into bits
split_response = data_getStatus.split(',')
# Split the bits into variable/value pairs
new_list = []
for element in split_response:
new_list.append(element.split('='))
# Convert the variable/value pairs into something json-y
new_dict = {}
for element in new_list:
new_dict[element[0]] = element[1]
#get new json string variables to python variables
htemp=str(new_dict['htemp'])
otemp=str(new_dict['otemp'])
#update indigo variables
indigo.variable.updateValue(520038281, ((htemp)))
indigo.variable.updateValue(75438798, ((otemp)))