SirGoodenough / HA_Blueprints

🧯 My Collection of Automation and Script Blueprints for Home Assistant 🧯
Other
132 stars 22 forks source link

warning: 'dict object' has no attribute[BUG] #32

Closed enrawi closed 9 months ago

enrawi commented 9 months ago

Blueprint: Aqara Magic Cube Zigbee2MQTT MQTT Triggered - 2023-10-20 get this every time i use the cube. Template variable warning: 'dict object' has no attribute 'operation_mode' when rendering '{{ trigger.payload_json.operation_mode }}'

SirGoodenough commented 9 months ago

It would help if you followed the issue template here a little. I need your automation code so i can see what is broken. An answer of it works for everyone else is not what you want to hear but without that, it's all I got.

I would guess / suspect one of 3 things. The beginning part of the setup regarding legacy in the set-up is not set-up to match the blueprint, or there is a problem with templates that you are calling with actions, or you have zombie versions of the blueprint running and triggering where you tried and failed to get it running, but did not remove them, so they still run every time you trigger it.

enrawi commented 9 months ago

Sorry. whas hard to copy all on phone. Im not using it for mutch. just to toggle 1 light and dim it up and down. `trigger:

SirGoodenough commented 9 months ago

That appears to be the blueprint, which is my code. I already have that. I need the automation you added to call the blueprint. That is your part of the code. Should look similar to this with different topics, actions, and variables.

- id: "12a989e7-9606-41e6-82fb-fed4fad6e5d3"
  alias: Yertle Cube
  description: All the things Yertle can do
  trace:
    stored_traces: 10
  use_blueprint:
    path: SirGoodenough/Zigbee2MQTT-Xiaomi_Cube_Controller_MQTT_Triggered.yaml
    input:
      topic: zigbee2mqtt/Yertle
      fall:
        - type: turn_on
          device_id: d99723186c9d0c8de8475bf9646b8373
          entity_id: switch.plug2
          domain: switch
      doubletap_face_0:
        - service: light.toggle
          entity_id: light.grp_kitch
      rotate_cw_face_0:
        - service: script.cube_dimmer_control_bp
          data:
            angle: '{{ trigger.payload_json.action_angle | float(0.0) }}'
            light: light.grp_kitch
      rotate_ccw_face_0:
        - service: script.cube_dimmer_control_bp
          data:
            angle: '{{ trigger.payload_json.action_angle | float(0.0) }}'
            light: light.grp_kitch
enrawi commented 9 months ago

It whas the full automation config. this is my config only.

id: '1701534676889'
alias: Aqara Magic Cube Zigbee2MQTT MQTT Triggered - 2023-10-20
description: ''
use_blueprint:
  path: SirGoodenough/Zigbee2MQTT-Xiaomi_Cube_Controller_MQTT_Triggered.yaml
  input:
    topic: zigbee2mqtt/AqaraCube
    doubletap_face_0:
      - service: light.toggle
        data:
          brightness_pct: 50
        target:
          entity_id: light.spotter_kjeller
    rotate_cw_face_0:
      - service: light.turn_on
        data:
          brightness_step_pct: 5
        target:
          entity_id: light.spotter_kjeller
    rotate_ccw_face_0:
      - service: light.turn_on
        data:
          brightness_step_pct: -5
        target:
          entity_id: light.spotter_kjeller
SirGoodenough commented 9 months ago

That helped. I am seeing that as well in my log.
It's something with the scene / action mode switch.
I'm looking into it. It appears if you don't need to switch modes it is working fine, and if you do have to switch modes, you might have to do it manually with the button. More as I figure it out.

SirGoodenough commented 9 months ago

PR #34 Update about8 blueprints to fix issues related to the bug. Thanks @enrawi for pointing out the problem. They should all be fixed now.

So this touches a few blueprints, but doesn’t change any function. I suggest you use the new re-download feature of Home Assistant, however, and replace them now. Then your logs will be free of the spamming some of the older versions did.

enrawi commented 9 months ago

Thx for fixing this :)