Developer Tools

I try to use developer-tools/state and set the state off a switch.
state

The switch doesn’t respond on the developer state set.

I try to use the automation from an external php server to set certain devices on or off.
So I first try the developer tools.

Any idea what I need to do to make it work.

Assuming this is a physical switch, i suggest you to use services rather than setting the states directly. (switch.turn_on and switch.turn_off)

It should be possible to set the state from an external server with the url.
I want to set state of heating and switches but the values come from an external server with a database for the settings.
I use php and it respond to{“message”: “API running.”}

It should be possible to set the state from an external server with the url.
I want to set state of heating and switches but the values come from an external server with a database for the settings.
I use php and it respond to{“message”: “API running.”}

I try to use REST API but it doesn’t set the state correctly although i get a json reply.

curl -X GET -H "Authorization: Bearer " http://172.21.6.136:8123/api/states/climate.d5x84yu_et093wro_433422fe_thermostat
Works

curl -X POST -H "Authorization: Bearer " -H “Content-Type: application/json” -d ’ {“entity_id”: “switch.ikea_of_sweden_tradfri_control_outlet_a5d620fe_on_off”, “state”: “on”, “attributes”: {“friendly_name”: “IKEA of Sweden TRADFRI control outlet a5d620fe on_off”}, “last_changed”: “2021-12-31T13:37:04.445626+00:00”, “last_updated”: “2021-12-31T13:37:04.445626+00:00”, “context”: {“id”: “964a2d860fad0d5c46441d6b644c8a93”, “parent_id”: null, “user_id”: null}}’ http://172.21.6.136:8123/api/states/switch.ikea_of_sweden_tradfri_control_outlet_a5d620fe_on_off

Reply from HA
{“entity_id”: “switch.ikea_of_sweden_tradfri_control_outlet_a5d620fe_on_off”, “state”: “on”, “attributes”: {“friendly_name”: “IKEA of Sweden TRADFRI control outlet a5d620fe on_off”}, “last_changed”: “2021-12-31T15:26:22.352068+00:00”, “last_updated”: “2021-12-31T15:26:22.352068+00:00”, “context”: {“id”: “ecdf8dc532b44cd1b1b580e1844990bd”, “parent_id”: null, “user_id”: “77db5dd1c2894dbfac37b01b4dd9ad29”}}

But that’s not what you do to actually change the state of a switch though -
it’s a POST to

/api/services/switch/turn_on

( or turn_off )
with the JSON:

{ "entity_id": "switch.my_switch_entity" }

See:

To answer the original question…

you can’t actual change the physical state of any device/entity from the developers tools->state tab.

that will only change the state of the device observed in the state machine.

but it will immediately be overwritten by the actual state of the entity within the scan interval of that entity.

So if the switch is “off” (represented and physically) and you set it’s state to “on” by using “set state” the physical switch won’t change to on but the state machine representation will switch to “on” then it will immediately go back to “off” to match the state of the physical entity. It might be fast enough that you won’t notice it.

at least that’s my understanding of it.

1 Like

I can send the switch on or off with
http://172.21.6.136:8123/api/services/switch/turn_on
{ “entity_id”: “switch.my_switch_entity” }

How can I change the heat value off a Popp Thermostat
climate.d5x84yu

/api/services/climate/set_temperature

{ "entity_id": "climate.d5x84yu", "temperature": 20.4 }

Thnx man,

How can I find the api calls from a device

It’s exactly the same calls as if you were creating automations.
It’s always -
/api/services/domain/command

And then the data you would supply in YAML in the automation, you just supply in JSON instead.

IS it possible to lock to set max and min temp and the update interval ?
I read that its update every 15 min but i’m not sure and cannot find if there is a setting for this?

Thnx in advance.

That really depends on the who provides the integration for the thermostat. I use a generic climate entity and that has a resend (keep alive) interval. Generic Thermostat - Home Assistant