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

Problem calling "Call Service" twice in linked nodes #82

Open
michaelblight opened this issue Jun 9, 2018 · 3 comments
Open

Problem calling "Call Service" twice in linked nodes #82

michaelblight opened this issue Jun 9, 2018 · 3 comments

Comments

@michaelblight
Copy link

I'm not sure if this is a bug or not as I'm still pretty new here. If I have two 'Call Service' nodes linked together, only the first runs. In my case I'm trying to change an input_number from -1 to 1 via 0 (ie. set_value to 0 then set_value to 1). This is because I need a tri-state boolean and I go via 0 to ensure events fire even if going from 1 to 1.

I'm currently making it work by using a script that does the two steps, and then calling the script from Node Red. So the script to go 'to 1' is:

  - service: input_number.set_value
    data:
      value: 0
      entity_id: input_number.heater_state
  - service: input_number.set_value
    data:
      value: 1
      entity_id: input_number.heater_state

@blackgold9
Copy link

I'm seeing something slightly different. When I have 2 service nodes linked, neither actually calls home assistant. Very strange.

@michaelblight
Copy link
Author

I think it's even more strange than that. I set up an input_number and had three separate sequences.

The first did a get (current_state) followed by a debug. As expected, I got 0.0.

The second did 3 service calls - two to increment and one to get, prior to a debug. Running this the output should have been 2.0, but it was 0.0 - implying only the get worked.

The third sequence did 2 service calls - one to increment and one to get, prior to a debug. When I then ran that, given that I was starting with 0.0, I would expect 1.0, but I got 2.0.

Then I ran the first again and got 4.0, despite the fact it shouldn't have changed the value.

BUT EUREKA! I think this shows what's going on. I'm guessing they're all executing, but asynchronously for some/all.

@michaelblight
Copy link
Author

Supporting my comments above, inserting a delay of 1s between each HA call made everything work. I tried 1ms, but no luck, so I guess that's too fast. In my case, a couple of 1s delays is fine.

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