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

email used as "changed_by" #135

Open
dogmatic69 opened this issue Oct 10, 2022 · 4 comments
Open

email used as "changed_by" #135

dogmatic69 opened this issue Oct 10, 2022 · 4 comments
Assignees
Labels
question Further information is requested

Comments

@dogmatic69
Copy link

dogmatic69 commented Oct 10, 2022

Describe the bug
Recently, not exactly sure when it started, but often the "changed_by" user is my email address which the integration seems to be taking from the integration config rather than the actual values in the logs. Nowhere is email configured as a user in home assistant so this should never be the case.

image
image

Version
0.3.8

Expected behavior
Use the information from sector alarm for showing state, don't blend with assumed data from login information or otherwise

Sector always has the "changed by" information as part of the audit trail for the alarm.

@gjohansson-ST gjohansson-ST self-assigned this Nov 4, 2022
@gjohansson-ST gjohansson-ST added bug Something isn't working question Further information is requested and removed bug Something isn't working labels Nov 4, 2022
@gjohansson-ST
Copy link
Owner

On setup I collect the username of the user HA logs into sector with to use as default user for changing the alarm.
Then when api calls fails I assume it's the default user who made it e.g. sets the default user as the changed_by.

It's not excellent but a way to deal with a crapy api in this case.
An alterantive is to leave changed_by as it was until it can refresh but I got complaints on that too.
So essentially stuck between two bad options.

@dogmatic69
Copy link
Author

There is no reason to set this value ever, all logs have the user information that changed things. This is like an audit of changes to the alarm system. Randomly setting values makes the data completely untrustworthy.

@gjohansson-ST
Copy link
Owner

I don't necessarily agree since the only time it's set manually is when done from HA and therefore we know which user it is.
Anyway it adds complexity so I would agree with you it's better to clean this out and if sector api fails to respond with a proper user then so be it.

The problem with double state changes will remain so people will have to adjust their automations accordingly.

@dogmatic69
Copy link
Author

Not true, I simply set up a "user" in sector which is "home" with it's own passcode. So at least in my case it should never use that value as sector is returning a username. This worked perfectly fine before and was always the correct value.

In what case does sector not return a User that changed the alarm? This is part of the audit logs of what has happened to the alarm.

This is my automation:

service: notify.ios_devices
data:
  title: Alarm Notification
  data:
    url: /lovelace/security
  message: >
    {% set by = state_attr('alarm_control_panel.sector_alarmpanel_02831351',
    'changed_by') %}

    {% if by == "home" %}
      {% set by = "Home Assistant" %}
    {% endif %}

    {% set alarm = states('alarm_control_panel.sector_alarmpanel_02831351') %}

    {% if alarm == "disarmed" %}
      {% set alarm = "disarmed" %}
    {% elif alarm == "armed_home" %}
      {% set alarm = "armed (Home)" %}
    {% elif alarm == "armed_away" %}
      {% set alarm = "armed (Away)" %}
    {% endif %}

    The alarm has been changed to {{ alarm }} by {{ by }}.

And then I get messages like:

The alarm has been changed to <state> by <my-sector-alarm-account-email>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants