Passing values

I got following sensor

    sensor:
  - platform: rest
    resource: http://192.168.1.103/6.json
    name: Temperature
    value_template: "{{ value_json.roomTemp_oC }}"
    unit_of_measurement: "°C"
    json_attributes:
    - setPoint
    - isOn
    scan_interval:
      minutes: 15

And how do I pass the setPoint to target temp in climate, following didn’t work :(?

climate:
  - platform: generic_thermostat
name: Actron
heater: switch.heater
ac_mode: true
target_sensor: sensor.Temperature
target_temp: {{sensor.Temperature.setPoint }}

I have used following but no success

target_temp: `{{ sensor.temperature.attributes.setPoint |float }}`
target_temp: "{{ state_attr('sensor.temperature', 'setPoint') | float }}"

please help :slight_smile:

You can’t do it via the static configuration. But you can set it via the climate.set_temperature service. E.g.,

service: climate.set_temperature
entity_id: climate.actron
data_template:
  temperature: "{{ state_attr('sensor.temperature', 'setPoint') }}"

where would I add this service, within the climate block? or within the sensor block?

You need to call it from an automation. I’m not exactly sure what you’re ultimately trying to achieve, but maybe like this:

automation:
  - alias: Set target temp
    trigger:
      platform: state
      entity_id: sensor.temperature
    action:
      service: climate.set_temperature
      entity_id: climate.actron
      data_template:
        temperature: "{{ state_attr('sensor.temperature', 'setPoint') }}"

So whenever sensor.temperature changes (either its state or any of its attributes) then the automation will fire and the service will be called to set the target temp of climate.actron.

Well my air con produce following json output on a rest call;
{“isOn”:false,“mode”:0,“fanSpeed”:1,“setPoint”:19.0,“roomTemp_oC”:17.5,“isInESP_Mode”:true,“fanIsCont”:0,“compressorActivity”:2,“errorCode”:"",“individualZoneTemperatures_oC”:[null,null,null,null,null,null,null,null],“enabledZones”:[0,0,0,0,0,0,0,0],“liveTimer”:null}

So what I’m try to do is create a 15 min sensor to grab that data and updating the climate.

I’m not sure this is the best way to go about it but yeah.