Help with an automation with and / or conditions & reboot safe

How do i make an automation that control my input_boolean depending on these states?
And it needs to work if HA reboots to!
#------------------

sensor1 (on / off)
sensor2 (on / off)

group1
sensor1
sensor2

#-----------------
I want the input_boolean to be ON:

if sensor1 OR sensor2 is “on”
(or if group1 is “on”) ?

I want the input_boolean to be OFF:

if sensor1 AND sensor2 is “off”
(or if group1 is “of”) ?

Are you going to be using the input Boolean in the interface? I mainly ask because it looks like you want a sensor, not an input boolean.

sensor:
  - platform: template
    sensors:
      my_on_off_thing:
        value_template: >
          {{ ( is_state('sensor.sensor1','on') and is_state('sensor.sensor2','on') ) or is_state('group.group1','on') }}

Right now im only using it for simulation.
When i see that it works as i need it to work it is suppose to control a waterheater.