Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service var.set broken and do nothing after update to 0.15.1 #107

Closed
gamba69 opened this issue Mar 22, 2024 · 7 comments
Closed

Service var.set broken and do nothing after update to 0.15.1 #107

gamba69 opened this issue Mar 22, 2024 · 7 comments

Comments

@gamba69
Copy link

gamba69 commented Mar 22, 2024

Hello,
after update to 0.15.1 service var.set silently do nothing. Variable value and attributes not updated, and I don't see any error in log.

@estegewr
Copy link

I encounter the same problems after updating to 0.15.1

@snarky-snark
Copy link
Owner

Do one of you mind trying out the latest develop release to see if that fixes the problem?

@estegewr
Copy link

estegewr commented Mar 23, 2024

Perhaps I used the module in a non-standard way. This is my config

var:
  callmon_caller_1:
    icon: mdi:phone
    value_template: "{{ now() }}"
    attributes:
      name: "{{ state_attr('sensor.fritz_box_7590_ui_call_monitor_telefonbuch', 'from_name') }} "
      number: "{{ state_attr('sensor.fritz_box_7590_ui_call_monitor_telefonbuch', 'from') }} "
      start: ""
      duration: ""

In the past, I was able to initiate the attributes start and duration with an empty value when I set the variable. It seems to be strange that I use the update call, but all value rules are defined in the configuration:

service: var.update
data:
  entity_id: var.callmon_caller_1

A few events later I would like to set the two attributes start and duration using the set call:

service: var.set
data:
  entity_id: var.callmon_caller_1
  attributes:
    duration: '00:00:11'

This doesn't work anymore for attributes that are "initiated" in the configuration. Interestingly I can set attributes which are not initiated in config. But thiese variables always get overwritten whenever I restart HA.

@GaPhi
Copy link

GaPhi commented Mar 24, 2024

Same problem here : I had to remove the "initialization" in my var.yaml configuration file.

@nm20220210
Copy link

nm20220210 commented Mar 24, 2024

downgrade to an old version in HA now

alias: vartest
description: ""
trigger: []
condition: []
action:
  - service: var.set
    data:
      entity_id: var.pmx152
      value: test
  - if:
      - condition: state
        entity_id: var.pmx152
        state: test
    then:
      - service: notify.persistent_notification
        metadata: {}
        data:
          message: OK
    else:
      - service: notify.persistent_notification
        metadata: {}
        data:
          message: NIO
mode: single

@gamba69
Copy link
Author

gamba69 commented Mar 25, 2024

Do one of you mind trying out the latest develop release to see if that fixes the problem?

Checked. Now I have error:
[ ... skipped ...]
File "/usr/src/homeassistant/homeassistant/core.py", line 2356, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 905, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 975, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/config/custom_components/var/init.py", line 448, in async_set
await self.async_write_ha_state()
TypeError: object NoneType can't be used in 'await' expression

and after I change
"await self.async_write_ha_state()" -> "self.async_write_ha_state()"

all working fine.

@snarky-snark
Copy link
Owner

Thanks! I made the fix in v0.15.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants