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

Changing brightness does not put EC in blocked state (3.2 broken) #174

Closed
broyuken opened this issue Aug 29, 2020 · 17 comments · Fixed by #175
Closed

Changing brightness does not put EC in blocked state (3.2 broken) #174

broyuken opened this issue Aug 29, 2020 · 17 comments · Fixed by #175

Comments

@broyuken
Copy link

<<< Do not delete the following template headers. All information must be filled in because we need it to analyse the problem. Your issue will be auto closed without this information.
Before opening a new issue, please read the documentation and search for keywords relating to your problem. Since this is an open source project expect to be involved in the issue resolution because we depend on your support. >>>

Description

A clear and concise description of what the bug is.

Is 3.2 still broken? I am just trying to implement it myself now, and if I manually change the brightness either via HA or via the wall it does not put it into a blocked state. The timer still shuts off after no motion.

Configuration

Include configuration of affected entity.

Steps to reproduce

Steps to reproduce the behavior:
Trigger EC, adjust brightness, light still turns off after timer.

Expected behavior

A clear and concise description of what you expected to happen.
Light stays on after timer expires after being manually adjusted.

Actual Behaviour

Light turns off after I adjust brightness manually.

Logs

Provide logs at DEBUG level.

Version

If you are not using the latest version, please upgrade first.
Latest

@danobot
Copy link
Owner

danobot commented Aug 30, 2020

Can you supply a sample entity that reproduces this problem?

@danobot danobot changed the title 3.2 Broken Changing brightness does not put EC in blocked state (3.2 broken) Aug 30, 2020
@broyuken
Copy link
Author

broyuken commented Aug 30, 2020

I just took one of your most basic configurations, changed the entity names and tried using that. Hopefully the comments don't create an issue.

# Entity Controller
entity_controller:
  ec_office_light:                             # serves as a name
    sensor: binary_sensor.office_motion        # required, [sensors]
    entity: light.office_light                 # required, [entity,entities]
    delay: 600                                 # optional, overwrites default delay of 180s

danobot added a commit that referenced this issue Aug 31, 2020
…sition EC to blocked state (R3.2)

A state machine transition was missing (or commented out due to unintended side effects). Uncommenting this line resolves the mentioned issues.
@danobot danobot mentioned this issue Aug 31, 2020
5 tasks
@danobot
Copy link
Owner

danobot commented Aug 31, 2020

I think the problem is L308 which has a commented transition which is called on L649.

I uncommented this and added the fix onto the develop branch for trial and review. Please load the __init__.py file from develop branch and retest.

@broyuken
Copy link
Author

broyuken commented Aug 31, 2020

Thanks for the attempt, but it does not seem to be working. It just immediately went into a blocked state without me changing brightness or anything.

edit: It looks to behave just like the "stay on" functionality.


sensor type
event
delay
10s
last triggered by
binary_sensor.office_motion
last triggered at
2020-08-31 10:53:47.112685
expires at
2020-08-31T10:53:57.112989
service data

entity_id: light.office_light

blocked at
2020-08-31T10:53:47.455038
blocked by
light.office_light

@danobot
Copy link
Owner

danobot commented Sep 1, 2020

Can you provide the debug log?
Its running fine in my instance and on the demo instance.

@broyuken
Copy link
Author

broyuken commented Sep 1, 2020

turning on debug now. What state does your light show when it is first turned on, but before it is manually adjusted? does it show blocked or active/timer?

@broyuken
Copy link
Author

broyuken commented Sep 1, 2020

Logs:

https://pastebin.com/wPLQ6piD

@danobot
Copy link
Owner

danobot commented Sep 1, 2020

I managed to reproduce the issue and of course ran into the problem discussed in #98 once again. This time I came up with a crude solution.
EC is blocking itself because it interprets its own calls to turn_on as external control. Since there is no way to determine who triggered a state change with the HASS API (until attribution is implemented), I created a short 2-second grace period after turningg on entities where EC will ignore any state changes.

Please use proper formatting for logs or a paste bin next time. People really don't appreciate log dumps like that.

I am checking in a fix to develop branch, please load it into your HA instance and retest :)

danobot added a commit that referenced this issue Sep 1, 2020
…s own service calls (and subsequent state changes)
@broyuken
Copy link
Author

broyuken commented Sep 1, 2020

Sorry, I wasn't sure what the proper formating for logs was. I could edit and use pastebin if you'd like.

@danobot
Copy link
Owner

danobot commented Sep 1, 2020

All good bud 👍 Let me know how the testing goes.

@broyuken
Copy link
Author

broyuken commented Sep 1, 2020

Nope, it went active timer for a couple seconds then immediately went into blocked.

Edit: I take that back, the first time I turned it on it was a little laggy, light took a few seconds to turn on with motion. I just tried it again and it seems to work. It went into active timer, then when I adjusted the brightness it went into blocked.

I'll do some more testing and see if I can break it.

@broyuken
Copy link
Author

broyuken commented Sep 2, 2020

I have to change the timeout to 5 seconds as I have some GE light switches that take ~3 seconds to turn on/off and update their state in HA. This caused them to immediately go into the blocked state like we saw before.

@broyuken
Copy link
Author

broyuken commented Sep 3, 2020

So fairly large issue I found. The original issue of 3.2 seems fixed now after changing it to 5 seconds, however a new issue that I didn't notice before is happening. The lights never turn off, the timer goes on, it expires, the EC light goes back to idle but the light stays on. Then, the next time I walk into the room the EC light goes into blocked which will further keep it from ever turning off since the light was on already before motion was triggered. This happened before my change as well, which I confirmed by rolling back to your dev version. The lights were turning off properly when using the GA version.

@danobot
Copy link
Owner

danobot commented Sep 3, 2020

I suggest testing EC in isolation using input_booleans specially created for this test. This is to avoid other EC instances getting triggered by the same motion sensor and accidentally interpreting this as a problem with the EC instance under test.

If your GE lights are slow to respond (more than 2 seconds) then I can see why EC would go into blocked state. It is only ignoring state changes for 2 seconds after the light is turned on. After two seconds it interprets any state change as manual control. I can make this 2 seconds configurable to better handle situation like these where there is a lot of latency in control entities.

Please repeat your tests using separate input_booleans as the sensor and control entities. If the behaviour is correct in this scenario then the defect is resolved and I will work on making the 2 second timeout more configurable for slow entities.

@broyuken
Copy link
Author

broyuken commented Sep 3, 2020

I have restarted HA without making any changes and things seem to be working as intended now, not sure what the cause of the earlier issues was.

@danobot
Copy link
Owner

danobot commented Sep 3, 2020

Ok that sounds good enough to me. Raise new issues on GitHub for any other problems you find. I will push the release out soon.

Cheers

@broyuken
Copy link
Author

broyuken commented Sep 3, 2020

Cheers and thank you for your help!

danobot added a commit that referenced this issue Oct 23, 2020
…sition EC to blocked state (R3.2)

A state machine transition was missing (or commented out due to unintended side effects). Uncommenting this line resolves the mentioned issues.
danobot added a commit that referenced this issue Oct 23, 2020
…s own service calls (and subsequent state changes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants