I am trying to set up a simple sensor to only announce items during the day time, but this does not seem to update sometimes, any idea what I am doing wrong? For example it was true all night and announced something at 6:45 am.
This is likely due to now.hour() not actually being a state that is recorded into the State Machine. As a result, your template sensor does not see any states that would trigger this template to update.
Maybe try the following:
Use the time_date platform to create a ‘time’ sensor that will be recorded to the State Machine.
Then you can update your existing code by adding an ‘entity_id’ that your template will watch. When this entity_id is updated in the StateMachine, your template will re-run and update accordingly: