Combine two byte to a word

Hi all,
as a greenhorn I’m struggling to combine two bytes to one word in an template.
As part of an automation once a month I would like to update the local time and date of my Epever solar chargers. The updated time and date will get send via 3 unit32 register values (sec. & min., hour & day, month & year).
Therefor I already prepared variables with related values.
I’m currently struggling how to bithshift the high byte and combine the two bytes to a word for each register.

- id: "automation_slr_1_timedate_sync"
  alias: "SLR_1_timedate_sync"
  description: "Sync SLR 1 time and date holding register"
  trigger:
  - platform: time
    at: '03:23:00'
  condition:
  - condition: template
    value_template: "{{ now().day == 1 }}"
  action:
    variables:
      timestamp_second: "{{ now().second }}"
      timestamp_minute: "{{ now().minute }}"
      timestamp_hour: "{{ now().hour }}"
      timestamp_day: "{{ now().day }}"
      timestamp_month: "{{ now().month }}"
      timestamp_year: "{{ now() | as_datetime | as_timestamp | timestamp_custom('%y') }}

Logicaly it sould be something like:
uint16_t min_sec: {uint16_t((timestamp_minute << 8) + timestamp_second)}
uint16_t day_hour: {uint16_t((timestamp_day << 8) + timestamp_hour)}
uint16_t year_month: {uint16_t((timestamp_year << 8) + timestamp_month)}

I would appreciative if an expert could give me an hand on that.

i don’t know that you can control bit length and signed/unsigned. i’m not sure why you’d need to. but to get the proper value, shift left is just multiplying by powers of 2. so this is the right value:

- id: "automation_slr_1_timedate_sync"
  alias: "SLR_1_timedate_sync"
  description: "Sync SLR 1 time and date holding register"
  trigger:
  - platform: time
    at: '03:23:00'
  condition:
  - condition: template
    value_template: "{{ now().day == 1 }}"
  action:
    variables:
      timestamp_second: "{{ now().second }}"
      timestamp_minute: "{{ now().minute }}"
      timestamp_hour: "{{ now().hour }}"
      timestamp_day: "{{ now().day }}"
      timestamp_month: "{{ now().month }}"
      timestamp_year: "{{ now() | as_datetime | as_timestamp | timestamp_custom('%y') }}
      min_sec: "{{ timestamp_minute * 256 + timestamp_second }}"
      hour_day: "{{ timestamp_day * 256 + timestamp_hour}}"
      year_month: "{{ timestamp_year * 256 + timestamp_month}}"

not clear how you wanted to use the values from there, but hopefully this gives you what you need… you can cast |int if you need, but i don’t think that’s necessary since the now() members are ints

is that what you’re looking for? or am i missing the point of your question?

Thank you for that hint.
Sometimes you can’t see the forest because of the trees.