I’ve spent some days on this and am really pulling my hair out trying to work out the syntax before finally throwing in the towel and signing up here for help. I’m pretty new to HA but am a programmer of many years in proprietary control systems (but not typical PC programming).
I have an external control system successfully changing the value of an input_text in HA, which I am using as a way for the external control system to control HA entities/devices.
In the HA LogBook, I get messages on change:
analog1 changed to “1” triggered by service input_text.set_value
I have created an automation, which triggers when analog1 changes. The trigger works, but I am having trouble matching the input_text to trigger actions.
What is stumping me is how to match the text value. I’ve tried for hours and hours but just can’t seem to find the correct syntax.
When a change is received (analog1 changed to “1” triggered by service input_text.set_value), it triggers stop. Any other value triggers stop as well, so I can never seem to get it to trigger play.
I have tried converting it to int(0), making all sorts of workarounds without success, and it just feels like I must be missing something very simple.
Really appreciate any help anyone can offer! Thank you in advance.
But about the problem you described, you can go to Developer Tools and select the tab Template and try the different ways of doing this to see which one will return true:
I tried your syntax, but same outcome - it triggers stop no matter what value analog1 is.
I didn’t know about the developer tools tab template, that is really really helpful.
I haven’t put too much more thought into how to test this, but I can report back that I first set the value to 1, check the Logbook:
analog1 changed to “1” triggered by service input_text.set_value
Then with each line, I carefully tested. After each test, I “reset to demo template” just in case, and all 5 show false. It’s so weird to me.
It’s great that it is working now, but this is not the most beautiful solution…
How are you adding this value to your input text? Are you using some service call or is this manually typing somewhere?
OK, reading your original post again I found the answer…
Can’t you change that external service to send just the number?
I am using Nick Pope’s code from here to integrate with Crestron:
The problem is I am just using it without much understanding of how it works, which is why I ran into the problem I did. However, it is working well now and understanding how to use the Developer Tools → Template was a huge help to being able to test things myself.
I could probably change the external service to send just the number, but this actually seems like a robust solution. It isn’t beautiful, but I can’t see why it wouldn’t be properly reliable, so I’ll just use it and see how it goes.
I believe the reason we are getting data like this is due to the raw data sent from Crestron’s XSIG. I probably don’t want to mess with that.
I tried it, but of course with the existing mistake, I could not make any progress.
Having said that, it makes more sense for my requirements to keep this particular implementation as text because each analog number represents a specific action and I will not be using arithmetic operations to evaluate the incoming number.
It’s pretty neat with so such a relatively simple implementation of just changing one single analog value from Crestron, I can already integrate 65535 actions from Crestron to HA.
Big thanks to @npope for his github share for the Crestron custom component as well.