Vacation Lighting - Replay Historical Lighting

Hi Sups-

  1. The description assumes you’re using the recorder component. Any value above 7 is just fine!

  2. The code for the automation is actually a “Blueprint”. It is its own thing so you will add a blue print using the code above then as another step create the automation from the blueprint. That’s when you’ll be prompted to fill in all the variables with the entities described above. After that then the automation will show up under “automations”

If you want to be able to “see” the on/off switch you would add the input boolean to your Lovelace dashboard

Hey Timgiwo

Thanks for a super quick response.

So, with point 2 I did exactly as you described and that’s where I have a problem I think, I created the automation using the blueprint, I see the additional config added to my automation.yaml but no new automations on the ‘automations’ page. Is that expected?

Cheers

Sups

Not expected it should show up in automations. Might need to check home assistant logs

Ahhhh haaaa!

I do have an error in my logs:

'Logger: homeassistant.components.automation
Source: components/automation/init.py:638
Integration: Automation (documentation, issues)
First occurred: 16:33:17 (1 occurrences)
Last logged: 16:33:17

Blueprint Blueprint - Vacation Lighting generated invalid automation with inputs OrderedDict([(‘vacation_mode_toggle’, ‘input_boolean.vacation_mode’), (‘replay_sensor_1’, ‘sensor.replay_loft_light’), (‘light_target_1’, ‘switch.loft_light’), (‘replay_sensor_2’, ‘sensor.replay_1st_floor_light’), (‘light_target_2’, ‘light.1st_floor_light_255’), (‘replay_sensor_3’, ‘sensor.replay_hallway_light’), (‘light_target_3’, ‘light.hallway_light_51’), (‘replay_sensor_4’, ‘sensor.replay_lounge_light’), (‘light_target_4’, ‘light.lounge_lights_264’), (‘replay_sensor_5’, ‘sensor.replay_kitchen_light’), (‘light_target_5’, ‘light.kitchen_lights_308’), (‘replay_sensor_6’, ‘sensor.replay_dining_room_light’), (‘light_target_6’, ‘light.dining_room_lights_380’), (‘replay_sensor_7’, ‘sensor.replay_lounge_lamp’), (‘light_target_7’, ‘switch.lamp’)]): required key not provided @ data[‘entity_id’]. Got None’

Anyone have any idea why this is?

Did you modify the blueprint to use only 7 entities. If not it is written to take 10.

It doesn’t like having blank inputs which means for the remaining 3 you’ll want to use the “do nothing” entities as described above.

HA is weird this way.

yeah, I did. perhaps I didn’t do it properly.
I’ve now added the dummy sensor instead and can see the Automation in my automations tab.

I’m now going to leave the vacation mode toggle on and wait for the lights to start freeking out my wife. I’ll know its all working when she start complaining. :grin:

Thanks Timgiwo for your help.

1 Like

Hi @timgiwo, love your idea, it was just what I was looking for. I’ve managed to put in the Blueprint and the sensors, and created an automation. Now my two questions:

  • where can I tweak the recorder time or check it is bigger then 7 days?
  • is this directly running when I switch on vacation mode? Or does it start after 0:00 or something? Is there a possibility to check its really running?

Thank you very much!

1 Like

Hi @Christiaan_Woldendor

The recorder is the built in recorder integration and the number of days is defined by the “purge_keep_days” variable which is a default of 10

For testing, I manually changed the state of the replay objects to verify the automation was responding correctly.

Just figured out I have exactly the same and was thinking along the same solution. Thanks for already solving it for me :wink:

1 Like

hello all.
strange one here!
I’ve set this up recently - 1st time I went away for the weekend this worked a treat.
I used used the mode this weekend and unfortunately none of my lights were triggered (looking at the light history over the weekend confirms this) :frowning:
how can I debug this? I’ve tried looking at the logs but I couldn’t seen anything of interest.

cheers
sups

Has anyone’s sensors stopped working after 2022.5 update?

Ah you’re right! Thank you for raising. “count” of the history stats sensor now appears to reset at the end of the configured duration, so doesn’t keep high values the way it is currently written

I started an issue here: History_stats count not working · Issue #71736 · home-assistant/core · GitHub

Feel free to add to it. I think what they’ve done has value as a seperate history_stats sensor, but trying to get them to revert to old style. You all probably have more experience with it so may be able to add weight to the conversation there.

2 Likes

Looks like you got it fixed @muddro! This behavior has been resolved in 2022.5.5

Thank you for opening the issue

4 Likes

Really Really Cool and exactly what I am looking for.
I still need to configure the sensors when I have the time. But It’s exactly what I need.

@timgiwo please update first post, because “Import blueprint” button is not working.
It returns this error:

No valid blueprint found in the topic. Blueprint syntax blocks need to be marked as YAML or no syntax.

It’s due multiple code blocks in this post (based on this comment: Zigbee2Mqtt - IKEA five button remote - #53 by starbuck93)

Since HA has stepped up its game with media players, would those entities also work with replay? Have the radio or TV play in a natural way when you are present?

I am just getting in to Home Assistant and this looks awesome, thanks for the blueprint going to set this up so it works during the holidays.
Quick question, since all states is already recorded in the logs, why do we need separate sensors for this. Can’t the state be pulled from the regular logs for the specific lights?

/Danny

Hi @danininodk

Unfortunately the states are buried in the HA DB and aren’t easily accessible by blueprints.
The intents of this implementation was to make use of blueprints and common well-supported HA building blocks.

There was another user that was also interested in querying the DB for state changes and has an alternate post here!

The thing that I’m not 100% clear on is the history states. I’ve set up the sensors properly, but when I go into the history page and choose one of the sensors as the entity, it doesn’t necessarily have the correct status. And when I change the state of the light, the status doesn’t change in that history. When I pull one of the sensors up in the history, am I actually looking at the history of it one week ago? What is going on?