slashback100 / presence_simulation

Home Assistant Presence Simulation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Re Help re event presence_simulation_change #118

Wright55 opened this issue · comments

Responded with continuing issue trying to get the automation to work.

automation does not trigger.

Anything I can do?

Read, didnt realise you can test a trigger.
Tested, still not working.
This is my automation
alias: Presence Simulation Event Test
description: ""
trigger:

  • platform: event
    event_type: presence_simulation_change
    action:
  • service: notify.whatsapp
    metadata: {}
    data:
    message: >-
    Simulation of the entity {{ trigger.event.data.entity_id }}, {{
    trigger.event.data.service }} called with following parameters: {{
    trigger.event.data.service_data }}
    mode: single

Trace
Executed: 19 March 2024 at 05:53:21
Error: Error rendering data template: UndefinedError: 'dict object' has no attribute 'event'

Trace timeline

Triggered manually at 19 March 2024 at 05:53:21
Notifications 'Send a notification with whatsapp' on
Stopped because an error was encountered at 19 March 2024 at 05:53:21 (runtime: 0.01 seconds)

Error rendering data template: UndefinedError: 'dict object' has no attribute 'event'

Debug Log 1
Logger: homeassistant.components.automation.presence_simulation_event_test
Source: components/automation/init.py:687
integration: Automation (documentation, issues)
First occurred: 16 March 2024 at 16:39:35 (3 occurrences)
Last logged: 05:53:21

Error while executing automation automation.presence_simulation_event_test: Error rendering data template: UndefinedError: 'dict object' has no attribute 'event'

Debug log 2
Logger: homeassistant.components.automation.presence_simulation_event_test
Source: helpers/script.py:1805
integration: Automation (documentation, issues)
First occurred: 16 March 2024 at 16:39:35 (3 occurrences)
Last logged: 05:53:21

Presence Simulation Event Test: Error executing script. Error for call_service at pos 1: Error rendering data template: UndefinedError: 'dict object' has no attribute 'event'

Also found this that i dont think is directly related
Logger: homeassistant.helpers.frame
Source: helpers/frame.py:156
First occurred: 17 March 2024 at 11:17:10 (2 occurrences)
Last logged: 17 March 2024 at 11:17:10

Detected that custom integration 'presence_simulation' sets "data" directly to update a config entry. This is deprecated and will stop working in Home Assistant 2024.9, it should be updated to use async_update_entry instead at custom_components/presence_simulation/init.py, line 456: entry.data = entry.options, please create a bug report at https://github.com/slashback100/presence_simulation/issues

Detected that custom integration 'presence_simulation' sets "options" directly to update a config entry. This is deprecated and will stop working in Home Assistant 2024.9, it should be updated to use async_update_entry instead at custom_components/presence_simulation/init.py, line 457: entry.options = {}, please create a bug report at https://github.com/slashback100/presence_simulation/issues

Since you test your automation manually, the trigger will indeed not contain any event.
Concerning the warning, I'll take in charge the adaptation, thanks

You advise in your readme that the event is fired, is it possible to check this actually happens.

my only alternative seems to remove the integration and start from the beginning.

Exited my house which automatically triggered my PS.
Additionally the event test automation also activated at the same time, notification received 'Simulation of the entity switch.presence_simulation, homeassistant.turn_off called with following parameters: {entity_id: switch.presence_simulation}'

So it works?
You can verify that the event are well fired with the deveveloment tools: https://www.home-assistant.io/docs/tools/dev-tools/#subscribe-to-an-event

Not as i was expecting, my understanding is that it should trigger when one of my lights turns on/off! It only triggered when the automation starting PS action (when i exit my house), no lights were on.
I will see what happens next couple days to see if anything changes when i am out again.

Thanks

It is fired when the simulation starts because the first thing it does is to restore the state of the entities with the states it was x days ago.
But it should also be fired at each simulation.

Just to update you.
PS triggered as normal yesterday when I left home during the day. Lights started to activate as expected during the hours of darkness, until returning home and PS ‘stopped" The "change" event did not trigger at all.

Hmm okay I will take a closer look at it asap

Ok I did found an issue. For lights, the event was not correctly fired. I fixed it in last commit

Will check it out tonight. Thanks