#Error: UndefinedError: 'dict object' has no attribute 'to_state'

1 messages · Page 1 of 1 (latest)

half sigil
#

Hi guys, I'm getting the above error message when trying to automate a switch with some basic lighting.
I'm new to HA and no idea how to fix this..
Can somebody point me in the right direction please?

pallid marsh
#

Please share the full automation in yaml format.

half sigil
pallid marsh
#

Did that trigger from a state change or you manually running the automation?

half sigil
#

I ran the automation as the button press would'nt do anything

pallid marsh
#

so you can't run it manually because then there is no trigger

#

so any template trying to access the trigger variable will not find it

half sigil
#

that makes sense, so that means that my blueprint isn't working correctly?

pallid marsh
#

Well what happens when you actually use the remote, look at the trace of that

#

this trace is just not telling me anything useful

half sigil
#

How do I check that? The expose is showing an empty string when the button is being pressed

#

I don't see any changes in the trace when I press the buttons on the remote

eager musk
#

Try to open the device page of the remote in HA and check if you see any changes in the logbook.
The empty string is normal, all of my remotes send the action and then immediately an empty string, see the screenshot of 3 consecutive clicks.

half sigil
#

oh hi Stoner!
the button presses do indeed register

eager musk
#

I can't help you with blueprints but here's my automation for a remote:

alias: Remote - Living Room
triggers:
  - entity_id:
      - sensor.osram_remote_2_action
    attribute: action
    trigger: state
conditions:
  - condition: template
    value_template: |
      {{ trigger.to_state.attributes.action != '' }}
    enabled: true
actions:
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ trigger.to_state.state == \"left_top_click\" }}"
        sequence:
          .
          .
          .

      - conditions:
          - condition: template
            value_template: "{{ trigger.to_state.state == \"left_top_hold\" }}"
        sequence:
          .
          .
          .

      - conditions:
          - condition: template
            value_template: "{{ trigger.to_state.state == \"right_top_click\" }}"
        sequence:
          .
          .
          .

This triggers on any button and the condition filters out the empty strings.
Hope it helps 😉
☮️ & ❤️

low ingot
# half sigil oh hi Stoner! the button presses do indeed register

Hi @half sigil,

If you are having a problem with a specific Blueprint, the first point of contact is in the Exchange (or Github) post that you found the Blueprint in originally.
There are people there using the equipment and the blueprint and will be able to give you more accurate information regarding your problem.
Here you might find someone.

#

I have not sttn that one before myself.

half sigil
#

Hi @low ingot , actually, the first place I asked help in was indeed in the Blueprints Exchange, you were the first and only one to have reacted to that post.
Right now I don't know where to look for help anymore, so I thought I'd try over here.. 😉

@eager musk thanks for your suggestion, I'll try that when I get home tonight!