Added space in input text / mqtt statestream upon restart, a possible bug

I have two HA’s, one on a mac and one on a Rpi3 which has the following automation. The mac HA has an input text that had “a” as the state. When I restarted the HA on the mac, the Rpi3 HA read the state stream what the mac produced and it changed to " a" then when it restarted, back to “a” . This causes an automation problem.

  - platform: mqtt
    name: saythismac
    state_topic: "mac/input_text/saythismac/state"
    force_update: True

automation rpi3_talk:
  alias: rpi3_Talk
    - platform: state
        - sensor.saythismac
        - sensor.saythispi
    condition: template
    value_template: "{% if is_state('trigger.to_state.state', 'unknown') %}false{% else %}true{% endif %}"
    - service: logbook.log
        name: Saythis
        message: >
                 *********** {{ trigger.from_state.state }}***to***{{ trigger.to_state.state }} *****
    - service: tts.amazon_polly_say
      entity_id: media_player.speaker
        message: >
                 {{ trigger.to_state.state }}
        cache: true

This log was produced from last two automation triggers.

Saythis *********** atoa *****
1:14 PM
Saythis *********** a toa *****

This problem with statestream on restart from input text is that it’s ** a** when it should be this **a **

EDIT: I actually think it not a added space that is the problem, i am not sure why this automation is triggered now. I changed the log message in the automation to

    message: >
             ***********{{ trigger.from_state.state }}***to***{{ trigger.to_state.state }}*****

and I get this in the logbook

Saythis ***********test***to***a*****

( after restart of mac )

Saythis ***********a***to***a*****

(this should not be a triggered as its the same state)