artem-sedykh / mini-climate-card

Minimalistic climate card for Home Assistant Lovelace UI
MIT License
262 stars 19 forks source link

Calling input_number.set_value from target_temperature change_action #132

Closed PeteRager closed 11 months ago

PeteRager commented 11 months ago

Great component! Need some assistance, to see what I'm doing wrong. V 2.6.2

I'm trying to set an input number when the target temperature is changed.

          - type: custom:mini-climate
            entity: "{{l.climate}}"
            secondary_info:
              type: hvac-action
              icon: 'mdi:cached'
            target_temperature:
              change_action: >
                (value, entity) => this.call_service('input_number', 'set_value', { entity_id: input_number.air_conditioner_schedule_cooling_temperature, value: value })
              icons:
                up: mdi:chevron-up
                down: mdi:chevron-down
              unit: '°F'
              min: 65
              max: 80
              step: 1.0

This results in the following error in the browser console:

VM4294:3 Uncaught ReferenceError: input_number is not defined
    at Object.eval [as change_action] (eval at fd (mini-climate-card-bundle.js?hacstag=268163975262:1:39869), <anonymous>:3:87)
    at hd.update (mini-climate-card-bundle.js?hacstag=268163975262:1:42876)
    at mini-climate-card-bundle.js?hacstag=268163975262:1:53090
regevbr commented 11 months ago

You need to wrap your entity id with " as currently it tries to treat is as a variable that doesn't exist

PeteRager commented 11 months ago

Indeed, thank you very much for the great support!