Xiaomi temperature 2 sensor and Xiaomi socket plug not triggering

Hi all,
I have an xiaomi temperature & humidity 2 sensor (square) and xiaomi socket plug.
And I want that it turns on my IR panel (via xiaomi socket plug) when temperature is below 22C and turns off when it’s above 22C.
Sometimes it triggers automatically and sometimes it doesn’t.
I’ve installed custom FW to the

sensor, set the advertising of a sensor to 10 seconds.
And I can also see it in a log that it triggers sometimes, but does nothing…

Here is the settings of an automation (which also works ok when run manually):

alias: IR panel + socket - turn off if above 22C
description: ""
trigger:
  - type: temperature
    platform: device
    device_id: scrambledid
    entity_id: sensor.temperature_humidity_sensor_d85b_temperature
    domain: sensor
    for:
      hours: 0
      minutes: 0
      seconds: 0
    above: 22
condition:
  - condition: time
    after: "07:00:00"
    before: "23:00:00"
    weekday:
      - sun
      - sat
      - fri
      - thu
      - wed
      - tue
      - mon
    enabled: true
action:
  - type: turn_off
    device_id: deviceidscrambled
    entity_id: switch.ir_ir_panel
    domain: switch
mode: single

alias: IR panel + socket - turn on if below 22C
description: ""
trigger:
  - type: temperature
    platform: device
    device_id: scrambledid
    entity_id: sensor.temperature_humidity_sensor_d85b_temperature
    domain: sensor
    below: 22
    for:
      hours: 0
      minutes: 0
      seconds: 0
condition:
  - condition: time
    after: "07:00:00"
    before: "23:00:00"
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
      - sat
      - sun
    enabled: true
action:
  - type: turn_on
    device_id: scrambledid
    entity_id: switch.ir_panel
    domain: switch
mode: single

Thanks a lot!

Hi there, I have combined both these automations into a single on with changing the trigger and action types. Please do try this and let me know

alias: IR panel + socket Combined
description: ""
mode: single
trigger:
  - platform: numeric_state
    entity_id: sensor.temperature_humidity_sensor_d85b_temperature
    above: 22
    id: above
  - platform: numeric_state
    entity_id: sensor.temperature_humidity_sensor_d85b_temperature
    id: below
    below: 22
condition:
  - condition: time
    after: "07:00:00"
    before: "23:00:00"
    weekday:
      - sun
      - sat
      - fri
      - thu
      - wed
      - tue
      - mon
    enabled: true
action:
  - choose:
      - conditions:
          - condition: trigger
            id: above
        sequence:
          - service: switch.turn_off
            data: {}
            target:
              entity_id: switch.ir_ir_panel
      - conditions:
          - condition: trigger
            id: below
        sequence:
          - service: switch.turn_off
            data: {}
            target:
              entity_id: switch.ir_ir_panel

That didn’t worked out for me, so I made it like this and it seems it works:

alias: IR panel on-off below/above 22C
description: ""
trigger:
  - platform: time_pattern
    seconds: "5"
condition: []
action:
  - if:
      - type: is_temperature
        condition: device
        device_id: 
        entity_id: sensor.temperature_humidity_sensor_d85b_temperature
        domain: sensor
        above: 22
    then:
      - type: turn_off
        device_id: 
        entity_id: switch.ir_grijalica_vrata
        domain: switch
    else:
      - type: turn_on
        device_id: 
        entity_id: switch.ir_grijalica_vrata
        domain: switch
mode: single