Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User Tags on Readers #338

Open
FigJam23 opened this issue Dec 29, 2022 · 7 comments
Open

User Tags on Readers #338

FigJam23 opened this issue Dec 29, 2022 · 7 comments
Labels
enhancement New feature or request

Comments

@FigJam23
Copy link

FigJam23 commented Dec 29, 2022

Feature description

If I use tag to unlock my door Pai logs below output.
Anyone know how I can grab and use the data from users in below PAI log.

paradox/events/raw={"additional_data": {"door": 129}, "change": {}, "id": 1, "key": "user,Master Mike,", "label": "Master Mike", "label_type": "b'\\x01'", "level": "INFO", "major": 62, "message": "None access granted to user Master Mike", "minor": 1, "minor2": 129, "module": "b'\\x00$0\\xd7'", "name": "Master Mike", "partition": 0, "tags": ["access", "granted"], "timestamp": "2022-12-29T12:52:00", "type": "user"}

@FigJam23 FigJam23 added the enhancement New feature or request label Dec 29, 2022
@yozik04
Copy link
Collaborator

yozik04 commented Dec 29, 2022

It is a regular json. Just parse it.

@FigJam23
Copy link
Author

FigJam23 commented Dec 29, 2022

Something like this, lol I'm sorry I'm no expert 
in json ....
  • platform: mqtt
    name: 'Users Test '
    state_topic: 'paradox/events/raw'
    value_template: '{{ value_json.key }}'

@FigJam23
Copy link
Author

FigJam23 commented Dec 29, 2022

The above works in a sensor but produces everything in the value Key
I've tryed this one below but get nothing any pointers would be appreciated.

`

  • state_topic: 'paradox/events/raw'
    name: 'Users Test '
    value_template: "{{ value_json.key.label }}"
    `

@FigJam23
Copy link
Author

FigJam23 commented Dec 30, 2022

Converted the json to a Easy to read yaml format.
Still unsure how to target spicific data like users


additional_data:
  door: 129
change: {}
id: 1
key: user,Master Mike,
label: Master Mike
label_type: b'\x01'
level: INFO
major: 62
message: None access granted to user Master Mike
minor: 1
minor2: 129
module: b'\x00$0\xd7'
name: Master Mike
partition: 0
tags:
  - access
  - granted
timestamp: '2022-12-29T12:52:00'
type: user

@yozik04
Copy link
Collaborator

yozik04 commented Dec 30, 2022

Search gave me this example: #160 (comment)

I am not experienced enough in home assistant templates to help you myself.

Just look for “json” in project issues, there were some solutions.

@yozik04
Copy link
Collaborator

yozik04 commented Dec 30, 2022

Do not forget to post the solution for others :)

@FigJam23
Copy link
Author

Do not forget to post the solution for others :)

Thanks, Mate that definitely helped https://github.com/ParadoxAlarmInterface/pai/issues/160#issuecomment-711439532

So far I got this working fairly well still working on refining but ill post now to maybe help others. I don't really know what I'm doing but managed to get this far I'll probably add ( door locked on a timer alert ) and some others soon. definitely good to know we can do this as I can now capture anything from those log file outputs yay .

################# Notify Who opened the door # 129 with prox tag ######################
`

  • alias: Door Opened By
    trigger:
    platform: mqtt
    topic: 'paradox/events/raw'
    condition:
    condition: template
    value_template: >
    {{ trigger.payload_json['additional_data']['door'] == 129 }}
    action:
    service: notify.all_mikes
    data:
    message: >
    {% if trigger.payload_json['additional_data']['door'] == 129 -%}
    Door {{ trigger.payload_json['message'] }}
    {%- else -%}
    {%- endif %}`

pai

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants