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

External event as a sensor on event #333

Open
rzulian opened this issue Jul 22, 2024 · 1 comment
Open

External event as a sensor on event #333

rzulian opened this issue Jul 22, 2024 · 1 comment

Comments

@rzulian
Copy link

rzulian commented Jul 22, 2024

Description

I need that I can fire an event from automations that can act as a sensor.
The EC has its own sensors (duration and time reset) and it's time constrained.
I've tried to use activate

  - service: entity_controller.activate
    data:
      entity_id: entity_controller.my_ec

, but it's rising an error if the EC is constrained.

So I've modified the function in theentity_services.py to this

def async_entity_service_activate(self):
    """ Activates the entity controller"""

    if(self.model is None):
        return

    def async_entity_service_activate(self):
    """ Activates the entity controller"""

    if(self.model is None):
        return
    if self.model.is_idle() or self.model.is_active_timer() or self.model.is_blocked():
        self.model.log.debug("Activating the Entity Controller")
        self.model.set_context()
        self.model.update(last_triggered_by="external_event")
        self.model.sensor_on()
    
    # self.model.activate()

And it looks it's working just fine.
Do you think that this can be the right way? I might add an async_entity_service_sensor_on just for that.

@Tabisch
Copy link
Contributor

Tabisch commented Sep 24, 2024

it's rising an error if the EC is constrained

This looks like expected behavior
You can either go to idle or overridden
The is a flow chart for all the states here
https://danobot.github.io/ec-docs/images/state_diagram.png

I need that I can fire an event from automations that can act as a sensor.

Maybe a helper switch works for you.
I think you can turn those on and off from an automation.
EC should work just fine with those

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

No branches or pull requests

2 participants