#python scripts permissions

1 messages · Page 1 of 1 (latest)

gritty karma
#

I’m trying to set up a python script to run as a command line sensor to do a conversion of the voltage level from an ads1115 ADC connected to an ESP8266. My python programming experience/expertise is elementary. But, I did get it working in pyscript jupyter notebook before and I get all green check marks on reloading python scripts, however, I get the error below from the log file. I thought python scripts had permissions to hass objects and entities. So why would I get this error? What did I miss?

2022-07-05 01:09:40 ERROR (SyncWorker_5) [homeassistant.components.python_script.temp.py] Error executing script: Not allowed to access HomeAssistant.sensor
GDIFF = (30/1.8)
VR0  = 0.223
G0  = 2
I  = (1.24 / 10000)

def conv_voltageto_temperature_c(voltage):
  Rpt1000 = (voltage/GDIFF+VR0)/I/G0
  temp = (Rpt1000-1000)/3.85
  temp = int(temp)
  return temp

te_voltage = float(hass.sensor.te_volts)
te_value = conv_voltageto_temperature_c(te_voltage)
temperature = str(te_value)
temperature
#

I’m trying to set up a python script to run as a command line sensor to do a conversion of the voltage level from an ads1115 ADC connected to an ESP8266. My python programming experience/expertise is elementary. But, I did get it working in pyscript jupyter notebook before and I get all green check marks on reloading python scripts, however, I get the error below from the log file. I thought python scripts had permissions to hass objects and entities. So why would I get this error? What did I miss?(python code below)

#
GDIFF = (30/1.8)
VR0  = 0.223
G0  = 2
I  = (1.24 / 10000)

def conv_voltageto_temperature_c(voltage):
  Rpt1000 = (voltage/GDIFF+VR0)/I/G0
  temp = (Rpt1000-1000)/3.85
  temp = int(temp)
  return temp

te_voltage = float(hass.sensor.te_volts)
te_value = conv_voltageto_temperature_c(te_voltage)
temperature = str(te_value)
temperature