Comments (10)
Sorry Just got back from a trip to test this again.
It still doesnt work even with parallel, so i'm not sure which part is causing this,
- id: '1650994964857'
alias: Dahua-VTO
description: ''
trigger:
- platform: event
event_type: dahua_vto
event_data:
Code: BackKeyLight
condition:
- condition: template
value_template: '{{ trigger.event.data.Data.State | int in [1, 2] }}'
action:
- service: media_player.play_media
target:
entity_id: media_player.family_room
data:
media_content_id: media-source://media_source/local/Doorbell.mp3
media_content_type: audio/mpeg
metadata:
title: Doorbell.mp3
thumbnail:
media_class: music
children_media_class:
navigateIds:
- {}
- media_content_type: app
media_content_id: media-source://media_source
mode: parallel
edit : nevermind after tracking down the logs, turns out the doorbell.mp3 somehow missing after reboots, its working now. i will monitor it again after few days hopefully this is the final code. thanks again
from dahuavto.
Hello,
You need to filter dahua_vto
events with Code
field equals to BackKeyLight
(another event's which comes from VTO doesn't have field Data.State
):
id: '1640312308566'
alias: Dahua VTO
description: ''
trigger:
- platform: event
event_type: dahua_vto
event_data:
Code: BackKeyLight
condition:
- condition: template
value_template: '{{ trigger.event.data.Data.State | int in [1, 2] }}'
action:
- service: media_player.media_play
target:
entity_id: media_player.gmpc
mode: queued
max: 10
from dahuavto.
That seems to do the trick! Many thanks again @myhomeiot
Just wondering, was this change caused by home assistant or the plugin?
So next time i will think twice before updating something again.
from dahuavto.
Just wondering, was this change caused by home assistant or the plugin?
So next time i will think twice before updating something again.
This was caused by changes in Home Assistant which was introduced in release 2021.10 but until release 2022.2 it's process templates as usual and log the warning, more info about this change you can read here
Anyway it's good idea to read release notes before update and sometimes check Home Assistant log.
from dahuavto.
Hi, sorry to reopen this again. Since windows based gmpc is rather unstable, i decided to get sonos play 1. But i cant seem to get this working.
Sonos is detected and i can play audio through media player in HA. I have tried 2 codes :
id: '1640312308566'
alias: Dahua VTO
mode: queued
max: 10
description: ''
trigger:
- platform: event
event_type: dahua_vto
event_data:
Code: BackKeyLight
condition:
- condition: template
value_template: '{{ trigger.event.data.Data.State | int in [1, 2] }}'
action:
- service: media_player.play_media
target:
entity_id: media_player.family_room
data:
media_content_id: media-source://media_source/local/Doorbell.mp3
And the other one :
alias: Dahua VTO
mode: queued
trigger:
- platform: event
event_type: dahua_vto
event_data:
Code: BackKeyLight
action:
- choose:
- conditions:
- condition: template
value_template: "{{ trigger.event.data.Data.State | int in [1, 2] }}"
sequence:
- service: media_player.play_media
target:
entity_id: media_player.family_room
data:
media_content_id: media-source://media_source/local/Doorbell.mp3
media_content_type: audio/mpeg
metadata:
title: Doorbell.mp3
thumbnail: null
media_class: music
children_media_class: null
navigateIds:
- {}
- media_content_type: app
media_content_id: media-source://media_source
default:
- service: media_player.play_media
target:
entity_id: media_player.family_room
data:
media_content_id: media-source://media_source/local/Doorbell.mp3
media_content_type: audio/mpeg
But neither is working, any thoughts?
from dahuavto.
Hello, you should run the media service call alone (outside from automation) and check if it's working at all, you can run automation from Home Assistant automation menu. it's will skip the trigger and will run action section:
- service: media_player.play_media
target:
entity_id: media_player.family_room
data:
media_content_id: media-source://media_source/local/Doorbell.mp3
from dahuavto.
Thats the problem, with above 2 codes the automation doesn't show up on the GUI (even though it doesnt show up any errors), so i cannot test it directly.
I can however, run the media through media > local media > doorbell.mp3 using sonos and it plays just fine.
Any idea how to make above automation show up in the automation page?
from dahuavto.
I managed to run it on the GUI, turn out there's another automation that's preventing it from appearing :
id: '1650994964857'
alias: Dahua-VTO
description: ''
trigger:
- platform: event
event_type: dahua_vto
event_data:
Code: BackKeyLight
condition:
- condition: template
value_template: '''{{ trigger.event.data.Data.State | int in [1, 2] }}'''
action:
- service: media_player.play_media
target:
entity_id: media_player.family_room
data:
media_content_id: media-source://media_source/local/Doorbell.mp3
media_content_type: audio/mpeg
metadata:
title: Doorbell.mp3
thumbnail: null
media_class: music
children_media_class: null
navigateIds:
- {}
- media_content_type: app
media_content_id: media-source://media_source
mode: queued
When i run automation with this, it works, but pressing the doorbell directly hasnt worked yet.. Maybe need action>choose?
When i test the condition above i got this error :
Error occurred while testing condition
template value should be a string for dictionary value @ data['value_template']. Got None
from dahuavto.
Latest versions of Home Assistant has automation debugger, try to use it in order to understand what happened.
You can remove mode: queued
or change it to mode: parallel
maybe first triggered automation stack at service call and other just waiting in the queue, more about automation modes you can read here.
You get error when you test the condition because trigger.event.data
defined only when automation triggered by event from Dahua VTO.
from dahuavto.
Hi, this afternoon strangely it fails again, but i answered with my phone almost at the same time, maybe 5 secs difference,
any idea why?
from dahuavto.
Related Issues (20)
- Nothing happened after installation and confirmation HOT 2
- Compatibility with VTO2101E-P HOT 6
- Possible to make "unlock" command to android desktop? HOT 20
- Dahua VTO2211G-P no event on button press HOT 3
- doorbell HOT 2
- Missing feature list HOT 1
- Upgrading to newer version, will it break HA compatibility? HOT 1
- Automation with video door entry call. HOT 1
- Question: MUTE ring HOT 3
- VTH HOT 17
- Adding more VTOs HOT 4
- 2 wire ip VTH2622 HOT 4
- Display camera image on a dashboard HOT 2
- itΒ΄s posible to get the card number? HOT 2
- Camera Feed Automation HOT 5
- Door status sensor for channel 2 HOT 10
- time out when call the "dahua_vto.open_door" service HOT 8
- Can not unlock HOT 2
- Bell-pressed, then play a custom sound on another machine. HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dahuavto.