Hereâs the results:
pi@RPiSmartHome:/home/homeassistant/.homeassistant $ python3 state_updates.py home-assistant.log sensor.fibaro_system_fgwpe_f_wall_plug_gen5_power_9 automation.record_player_stop ped last_triggered
entity_id | log time | last_changed | state | attributes
----------------------------------------------------|---------------------|----------------------------------|-------|-----------
=================================================== | 2019-12-17 21:03:26 | ===== Home Assistant Start ===== | ===== | ==========
sensor.fibaro_system_fgwpe_f_wall_plug_gen5_power_9 | 2019-12-17 21:03:26 | 2019-12-17T21:03:26.998060+01:00 | 0.0 |
| 2019-12-17 21:04:10 | 2019-12-17T21:04:10.289266+01:00 | 0.0 |
| 2019-12-17 21:57:14 | 2019-12-17T21:57:14.959147+01:00 | 0.0 |
| 2019-12-17 22:57:14 | 2019-12-17T22:57:14.976712+01:00 | 0.0 |
| 2019-12-17 23:57:14 | 2019-12-17T23:57:14.993576+01:00 | 0.0 |
| 2019-12-18 00:57:15 | 2019-12-18T00:57:15.039967+01:00 | 0.0 |
| 2019-12-18 01:57:15 | 2019-12-18T01:57:15.036650+01:00 | 0.0 |
| 2019-12-18 02:57:15 | 2019-12-18T02:57:15.055088+01:00 | 0.0 |
| 2019-12-18 03:57:15 | 2019-12-18T03:57:15.071890+01:00 | 0.0 |
| 2019-12-18 04:57:15 | 2019-12-18T04:57:15.092470+01:00 | 0.0 |
| 2019-12-18 05:57:15 | 2019-12-18T05:57:15.100241+01:00 | 0.0 |
| 2019-12-18 06:57:15 | 2019-12-18T06:57:15.137404+01:00 | 0.0 |
| 2019-12-18 07:57:15 | 2019-12-18T07:57:15.182500+01:00 | 0.0 |
| 2019-12-18 08:57:15 | 2019-12-18T08:57:15.169635+01:00 | 0.0 |
| 2019-12-18 09:57:15 | 2019-12-18T09:57:15.216457+01:00 | 0.0 |
| 2019-12-18 10:57:15 | 2019-12-18T10:57:15.208720+01:00 | 0.0 |
| 2019-12-18 11:57:15 | 2019-12-18T11:57:15.229153+01:00 | 0.0 |
| 2019-12-18 12:57:15 | 2019-12-18T12:57:15.228134+01:00 | 0.0 |
| 2019-12-18 13:57:15 | 2019-12-18T13:57:15.248665+01:00 | 0.0 |
| 2019-12-18 14:57:15 | 2019-12-18T14:57:15.288768+01:00 | 0.0 |
| 2019-12-18 15:57:15 | 2019-12-18T15:57:15.304776+01:00 | 0.0 |
| 2019-12-18 16:57:15 | 2019-12-18T16:57:15.319338+01:00 | 0.0 |
| 2019-12-18 17:57:15 | 2019-12-18T17:57:15.348459+01:00 | 0.0 |
| 2019-12-18 18:57:15 | 2019-12-18T18:57:15.363387+01:00 | 0.0 |
Also, hereâs a more complete snippet from the log when the trigger happens:
2019-12-18 09:57:15 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.fibaro_system_fgwpe_f_wall_plug_gen5_power_9, old_state=<state sensor.fibaro_system_fgwpe_f_wall_plug_gen5_power_9=0.0; node_id=7, value_index=4, value_instance=1, value_id=72057594160365634, power_consumption=0.0, unit_of_measurement=W, friendly_name=Plattenspieler, icon=mdi:flash-red-eye @ 2019-12-18T08:57:15.169635+01:00>, new_state=<state sensor.fibaro_system_fgwpe_f_wall_plug_gen5_power_9=0.0; node_id=7, value_index=4, value_instance=1, value_id=72057594160365634, power_consumption=0.0, unit_of_measurement=W, friendly_name=Plattenspieler, icon=mdi:flash-red-eye @ 2019-12-18T09:57:15.216457+01:00>>
2019-12-18 09:57:15 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event automation_triggered[L]: name=Plattenspieler gestoppt, entity_id=automation.plattenspieler_gestoppt>
2019-12-18 09:57:15 INFO (MainThread) [homeassistant.components.automation] Executing Plattenspieler gestoppt
2019-12-18 09:57:15 INFO (MainThread) [homeassistant.helpers.script] Script Plattenspieler gestoppt: Running script
2019-12-18 09:57:15 INFO (MainThread) [homeassistant.helpers.script] Script Plattenspieler gestoppt: Executing step call service
2019-12-18 09:57:15 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=script, service=add_logbook_entry, service_data=button_name=Plattenspieler, message=gestoppt, entity=sensor.fibaro_system_fgwpe_f_wall_plug_gen5_power_9, domain=binary_sensor>
2019-12-18 09:57:15 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.fibaro_system_fgwpe_f_wall_plug_gen5_power_management_5, old_state=<state sensor.fibaro_system_fgwpe_f_wall_plug_gen5_power_management_5=254; node_id=7, value_index=11, value_instance=1, value_id=72057594161414321, power_consumption=0.0, unit_of_measurement=, friendly_name=Fibaro Plug - Plattenspieler Power Management @ 2019-12-18T08:57:15.231036+01:00>, new_state=<state sensor.fibaro_system_fgwpe_f_wall_plug_gen5_power_management_5=254; node_id=7, value_index=11, value_instance=1, value_id=72057594161414321, power_consumption=0.0, unit_of_measurement=, friendly_name=Fibaro Plug - Plattenspieler Power Management @ 2019-12-18T09:57:15.308334+01:00>>
2019-12-18 09:57:15 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event script_started[L]: name=Add Logbook Entry, entity_id=script.add_logbook_entry>
2019-12-18 09:57:15 INFO (MainThread) [homeassistant.helpers.script] Script Add Logbook Entry: Running script
2019-12-18 09:57:15 INFO (MainThread) [homeassistant.helpers.script] Script Add Logbook Entry: Executing step call service
2019-12-18 09:57:15 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=logbook, service=log, service_data=name=Plattenspieler, message=gestoppt, entity_id=sensor.fibaro_system_fgwpe_f_wall_plug_gen5_power_9, domain=binary_sensor>
2019-12-18 09:57:15 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event logbook_entry[L]: name=Plattenspieler, message=gestoppt, domain=binary_sensor, entity_id=sensor.fibaro_system_fgwpe_f_wall_plug_gen5_power_9>
2019-12-18 09:57:15 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=script.add_logbook_entry, old_state=<state script.add_logbook_entry=off; last_triggered=2019-12-18T08:57:15.265201+01:00, friendly_name=Add Logbook Entry @ 2019-12-17T21:03:10.532672+01:00>, new_state=<state script.add_logbook_entry=off; last_triggered=2019-12-18T09:57:15.313057+01:00, friendly_name=Add Logbook Entry @ 2019-12-17T21:03:10.532672+01:00>>
2019-12-18 09:57:15 INFO (MainThread) [homeassistant.helpers.script] Script Plattenspieler gestoppt: Executing step call service
2019-12-18 09:57:15 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=media_player, service=turn_off, service_data=entity_id=['media_player.denon_avr_x1100w']>
2019-12-18 09:57:15 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=automation.plattenspieler_gestoppt, old_state=<state automation.plattenspieler_gestoppt=on; last_triggered=2019-12-18T08:57:15.535433+01:00, friendly_name=Plattenspieler gestoppt @ 2019-12-18T09:13:55.143201+01:00>, new_state=<state automation.plattenspieler_gestoppt=on; last_triggered=2019-12-18T09:57:15.585421+01:00, friendly_name=Plattenspieler gestoppt @ 2019-12-18T09:13:55.143201+01:00>>