Basic help

I am receiving some data via gpio, and i wish to set it up to HASS Web, so i have tried:

hass.states.input_slider.ac_temperature.state =8
This results in:
e[31m2017-12-05 02:50:55 ERROR (Thread-9) [homeassistant.components.python_script.hello_world.py] Error executing script: Not allowed to access StateMachine.input_slider

hass.states.set(‘input_number.ac_temperature’ ,8)
This one results one in werid web display where the value is not changed and the number appears beside the slider.

Any idea?

Thanks!

Use the set_value service rather than setting the state directly.

Where can i find an example?

Thanks.

Also tried usong json, any documentation?
hass.states.set(‘input_number.ac_temperature’ ,{ “value”:8})
hass.states.set(‘input_number.ac_temperature’ ,{ “set_value”:8})

I am lost.

Found it !
hola = hass.states.get(‘input_number.ac_temperature’)
hass.states.set(‘input_number.ac_temperature’,‘4.0’, hola.attributes, True)
Or:
Invoke-RestMethod “http://192.168.1.127:8123/api/services/input_number/set_value” -Method post -Body ‘{“entity_id”:“input_number.ac_temperature”, “value”:5}’

1 Like

Or use

Hass.services.call(domain, service, service_data=None, blocking=False)