Simple Thermostat - Heating gets turn back on by scheduled temperature change

I have the Moes Zigbee Thermostat installed.

It’s in my UI using the simple-thermostat card and the schedule card. All configured about 9 months ago.

type: vertical-stack
cards:
  - type: custom:simple-thermostat
    layout:
      step: column
    header:
      name: Hall Thermostat
      toggle:
        entity: input_boolean.show_heating_schedule
        name: Show Schedule
    icon:
      heating: mdi:radiator
      heat_cool: mdi:radiator-disabled
      'off': mdi:radiator-off
    entity: climate.hall_thermostat
    step_size: 1
    fallback: No Set Point!
    decimals: 0
    label:
      temperature: Hall
    control:
      hvac:
        'off':
          name: 'Off'
        heat:
          name: Comfort
      preset:
        _name: Program Source
        none: false
        hold:
          name: Home Assistant
        program:
          name: Internal
    sensors:
      - entity: sensor.temperature_1
        name: Dining room
      - entity: sensor.indoor_temperature_0
        name: Lounge
  - type: conditional
    conditions:
      - entity: input_boolean.show_heating_schedule
        state: 'on'
    card:
      type: custom:scheduler-card
      include:
        - climate.hall_thermostat
      exclude: []

I also have 2 automations to turn the heating off when I go out and on when I come home, with the actions being:

action:
  - service: climate.set_hvac_mode
    data:
      hvac_mode: "off"
    target:
      entity_id: climate.hall_thermostat
mode: single

and

action:
  - service: climate.set_hvac_mode
    data:
      hvac_mode: heat
    target:
      entity_id: climate.hall_thermostat
mode: single

I thought everything was fine but now having looked at the logs I realise that when I’m out and the heating is Off, when the scheduler changes the temperature, the heating gets turned back on! ie the hvac_mode goes back to heat.
Is there a simple way to stop that happening?

No. Changing the temperature of any thermostat that is off turns it on.

Only set the temperature when your thermostat is already on or you are turning it on.

OK, noted. Thanks Tom.
So I’m using the custom:simple-thermostat card and the custom:scheduler-card card. These enable me to add/modify schedule entities which I’ve found are stored in .storage/scheduler.storage in JSON (?) format. Using the scheduler-card UI, I think I can add a condition “heating must be on” for the schedule to trigger. This should be ok but when I come home and my automation turns the heating back on, it will be at the last temperature it was told and not the temperature for the time I come home!
Having read the Github for the scheduler-component add on, I think I can do better than that by editing the scheduler.storage file to add stop times to my schedule entities and setting track_conditions to true. The way I read it is that then the schedule entity with a start/stop of, say, 10:00/12:00 will not fire if I’m away, but if I come home between those times it will then fire. Is that correct?
I’m guessing the scheduler-card has not been written to enable this extra complexity.
I will give it a try and see what happens.

That’s when you automate updating the set temperature.

But that means I must have the times/temperatures stored in 2 places, the scheduler and the “I get home” automation. That’s not a good thing IMHO.

Can you not use the action service in custom scheduler to set the temperature (which will turn the thermostat on)?

https://github.com/nielsfaber/scheduler-component#action

I Just had a look. You have to pick one of the schedule entities to run, so that doesn’t work either.
I’m going to try editing the scheduler.storage file as mentioned earlier.
As an aside, When adding/editing a scheduled event in the scheduler-card, I only see the Time and Options tab on my laptop (Windows/Chrome), but not on my desktop (same) nor my phone (Android/companion app).

I don’t use it so I could be wrong but it looks to me like the action occurs when scheduled. i.e. set your temp on schedule, which turns the thermostat on.