Can't get value of device state in blueprint

How come I can’t get the value of action level in this blue print?

Shouldn’t this line get the value 228?

“{{ state_attr(‘entity_1’, ‘action_level’) }}”

I can set the value to 228 and it works?

my Device state
{
“battery”: 95,
“linkquality”: 184,
“voltage”: 2900,
“action”: “”,
“action_group”: 108,
“action_color_temperature”: 160,
“action_transition_time”: 0,
“action_level”: 228,
“action_hue”: 85,
“action_saturation”: 254
}

blueprint:
  name: One-way synchronize brightness states
  description: Synchronize the on/off state of 2 entities, going from source to target entity (but never reflecting updates from target back to source)
  domain: automation
  input:
    entity_1:
      name: Source entity
      selector:
        entity: {}
    entity_2:
      name: Target entity
      selector:
        entity: {}
  source_url: https://gist.github.com/fireboy1919/997c80db37de30da76f67c5daeaba27b
mode: restart
max_exceeded: silent
variables:
  entity_1: !input entity_1
  entity_2: !input entity_2
trigger:
- platform: state
  entity_id: !input entity_1
- platform: state
  entity_id: !input entity_1
  attribute: action_level
  
condition: []
action:
- choose:
    - conditions:
        condition: template
        value_template: "{{ is_state(trigger.to_state.entity_id, 'on') }}"
      sequence:
        - service: light.turn_on
          data:
            brightness: 255
            entity_id: '{% if trigger.from_state.entity_id == entity_1 %} {{ entity_2 }} {% else %} {{ entity_1 }} {% endif %}'
- choose:
    - conditions:
        condition: template
        value_template: "{{ is_state(trigger.to_state.entity_id, 'brightness_move_to_level') }}"
      sequence:
        - service: light.turn_on
          data:
            brightness: "{{ state_attr('entity_1', 'action_level') }}"
            entity_id: '{% if trigger.from_state.entity_id == entity_1 %} {{ entity_2 }} {% else %} {{ entity_1 }} {% endif %}'
- choose:
    - conditions:
        condition: template
        value_template: "{{ is_state(trigger.to_state.entity_id, 'off') }}"
      sequence:
        - service: light.turn_off
          data:
            entity_id: '{% if trigger.from_state.entity_id == entity_1 %} {{ entity_2 }} {% else %} {{ entity_1 }} {% endif %}'`

What type of entity is this? Those are not common attribute names.

Is the state a json string or are those attributes? Your templates treats them like attributes…

You may want to post a screen shot from the States tool.

This it’s a state right?

Log

Not useful
Developer tools - states

Developer tools - states doesn’t seem to show anything, is it because its zigbee2mqtt? It reads the button states on off and turns my light on and off, just can’t read the values for some reason to set color and brightness

it’s the miboxer FUT089Z zigbee rgb remote

is ‘entity_1’ supposed to be not quoted? maybe i’m missing something obvious… apologies if so, but doesn’t having it ‘entity_1’ instead of entity_1 end up giving that as a string rather than the variable’s value?

so this?

“{{ state_attr(entity_1, ‘action_level’) }}”

No, that appears to be an MQTT payload.

If the information you need is not part of an entity’s state object, you cannot retrieve it with states(), state_attr(), or the other state-related template functions. If the data is only present as part of an MQTT payload you will need to use an MQTT trigger not a State trigger.

Thanks, that makes sense. I just assumed since on and off worked and that shows up in that payload that the others would to. I look into the mqtt payload and see if I can do it with that

I got it, thanks so much for pointing me int he right direction and I had to search the payload, I guess it’s not a correct json format. What a PIA

mqtt:
  sensor:
    - name: "MiBoxer Birghtness"
      state_topic: "zigbee2mqtt/MiBoxer"
      value_template: >
        {% if ( value_json | regex_search('action_level') )  %}
          {{ value_json.action_level }}
        {% else %}
          {{ this.state }}
        {% endif %}
        
    - name: "MiBoxser Hue"
      state_topic: "zigbee2mqtt/MiBoxer"
      value_template: >
        {% if ( value_json | regex_search('action_color_temperature') )  %}
          {{ value_json.action_color_temperature}}
        {% else %}
          {{ this.state }}
        {% endif %}