I’m trying to set up an automation with an if/then that checks for the value of an entity that is natively an integer value but I’m not sure how to specify an integer value in the GUI. I’ve seen a few versions of this in the docs, but I can’t seem to get the correct syntax. See below - what’s the correct way to specify an integer value for my test?
Tried that first, and the trace shows the following:
## if/condition/0/entity_id/0
Executed: April 3, 2023 at 6:16:37 AM
Result:
result: false
state: 255
wanted_state: '255'
The test isn’t coming through as true, so I’m assuming it’s comparing a string (my entry) to an int (the value of the state)?
tom_l
April 3, 2023, 7:58pm
4
You may have to use yaml. It looks like the gui editor only supports strings.
That makes so much sense, thank you. Not sure if that should be logged somewhere as a feature request or not.
tom_l
April 3, 2023, 8:09pm
6
I was just doing some research. It should have been fixed for triggers and conditions:
home-assistant:dev
← home-assistant:state-trigger-condition-struct
opened 04:45PM - 06 Dec 21 UTC
<!--
You are amazing! Thanks for contributing to our project!
Please, DO N… OT DELETE ANY TEXT from this template! (unless instructed).
-->
## Proposed change
Don't screw automations using `null` up, check if we support the automation config, otherwise fallback to yaml.
## Type of change
<!--
What type of change does your PR introduce to the Home Assistant frontend?
NOTE: Please, check only 1! box!
If your PR requires multiple boxes to be checked, you'll most likely need to
split it into multiple PRs. This makes things easier and faster to code review.
-->
- [ ] Dependency upgrade
- [X] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (thank you!)
- [ ] Breaking change (fix/feature causing existing functionality to break)
- [ ] Code quality improvements to existing code or addition of tests
## Example configuration
<!--
Supplying a configuration snippet, makes it easier for a maintainer to test
your PR.
-->
```yaml
```
## Additional information
<!--
Details are important, and help maintainers processing your PR.
Please be sure to fill out additional details, if applicable.
-->
- This PR fixes or closes issue:
- fixes https://github.com/home-assistant/frontend/issues/7231
- fixes https://github.com/home-assistant/frontend/issues/7708
- fixes https://github.com/home-assistant/frontend/issues/8029
- fixes https://github.com/home-assistant/frontend/issues/8606
- fixes https://github.com/home-assistant/core/issues/56539
- fixes https://github.com/home-assistant/core/issues/57646
- fixes https://github.com/home-assistant/core/issues/59193
- This PR is related to issue or discussion:
- Link to documentation pull request:
## Checklist
<!--
Put an `x` in the boxes that apply. You can also fill these out after
creating the PR. If you're unsure about any of them, don't hesitate to ask.
We're here to help! This is simply a reminder of what we are going to look
for before merging your code.
-->
- [ ] The code change is tested and works locally.
- [ ] There is no commented out code in this PR.
- [ ] Tests have been added to verify that the new code works.
If user exposed functionality or configuration variables are added/changed:
- [ ] Documentation added/updated for [www.home-assistant.io][docs-repository]
<!--
Thank you for contributing <3
-->
[docs-repository]: https://github.com/home-assistant/home-assistant.io
The if
part is a condition so I would have thought that PR would have fixed it. But apparently this is still an issue:
opened 08:38AM - 09 Jan 23 UTC
### The problem
The dark attribute of the Tradfri motion sensor is true or fa… lse.
When entered in the visual editor, it gets quotes which results in a never passing condition. it should say true or false without quotes, which can only be achieved by using YAML.
```yaml
condition: state
entity_id: binary_sensor.tradfri_motion_sensor
attribute: dark
alias: Confirm Motion Sensor Dark = true
state: true
```
### What version of Home Assistant Core has the issue?
core-2023.1.2
### What was the last working version of Home Assistant Core?
_No response_
### What type of installation are you running?
Home Assistant OS
### Integration causing the issue
_No response_
### Link to integration documentation on our website
_No response_
### Diagnostics information
The description says it all
### Example YAML snippet
Bad:
```yaml
condition: state
entity_id: binary_sensor.tradfri_motion_sensor
attribute: dark
alias: Confirm Motion Sensor Dark = true
state: "true"
```
Correct:
```yaml
condition: state
entity_id: binary_sensor.tradfri_motion_sensor
attribute: dark
alias: Confirm Motion Sensor Dark = true
state: true
```
```
### Anything in the logs that might be useful for us?
_No response_
### Additional information
Core isn't shown in 'Settings -> About' anymore, just so you know.
The form is referencing that location to get the core version.
You should definitely open a new frontend issue here:
You’re not using card-mod are you?
I just saw this very odd issue, probably not related though.
opened 09:52AM - 13 Sep 22 UTC
### Checklist
- [X] I have updated to the latest available Home Assistant versi… on.
- [X] I have cleared the cache of my browser.
- [X] I have tried a different browser to see if it is related to my browser.
### Describe the issue you are experiencing
As shown below, when using the new (super handy) dropdown menu of known states, the states seem to be autocapitalized:
<img width="981" alt="Screenshot 2022-09-13 at 11 47 26" src="https://user-images.githubusercontent.com/14220294/189870611-047ed8be-4ae0-4228-91a5-e37f57b705b5.png">
While the actual states are not:
<img width="637" alt="Screenshot 2022-09-13 at 11 46 43" src="https://user-images.githubusercontent.com/14220294/189870684-141445b9-aa28-409c-8e72-87c362e0b093.png">
Resulting in false if statements, that are expected to be true:
<img width="292" alt="Screenshot 2022-09-13 at 11 48 42" src="https://user-images.githubusercontent.com/14220294/189870732-b4b653ae-4696-41d1-b427-72db6abcb5d9.png">
### Describe the behavior you expected
Drop down menu of expected states, should be true to the capitalisation of the actual states.
### Steps to reproduce the issue
1. Create automation using if statement
2. Use auto dropdown to select a state
3. Check if condition becomes true whether the if statement thinks the same
### What version of Home Assistant Core has the issue?
core-2022.9.2
### What was the last working version of Home Assistant Core?
_No response_
### In which browser are you experiencing the issue with?
_No response_
### Which operating system are you using to run this browser?
_No response_
### State of relevant entities
```txt
At least person home/not_home state, expectedly much more.
```
### Problem-relevant frontend configuration
_No response_
### Javascript errors shown in your browser console/inspector
_No response_
### Additional information
_No response_
FYI this seems to be a known issue, as if I edit the config in YAML (which solves the problem) and go back to the UI, I see the following warning:
I’m assuming this shouldn’t be logged as an issue, then.
tom_l
April 18, 2023, 12:49am
8
Templates are not supported in the UI editor.