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

[BUG]: For Adam, schedule with this name not available. #276

Closed
malosaa opened this issue Apr 22, 2022 · 41 comments
Closed

[BUG]: For Adam, schedule with this name not available. #276

malosaa opened this issue Apr 22, 2022 · 41 comments
Labels
bug Something isn't working

Comments

@malosaa
Copy link

malosaa commented Apr 22, 2022

Describe the bug.

Well i have a blueprint, that i later release this year.
After i updated to last version of adam i get this error:

☀️ Malosa Heater Control ☀️: Choose at step 1: choice 1: Error executing script. Error for call_service at pos 1: Error communicating with API: Plugwise: no schedule with this name available.

So i double checked the attribute that need to contain 3 names, asleep, home , away.
They are in there,

asleep works, but when it needs home i get this error...

This blueprint worked for almost a year, and now i get an error.
I did even try in capital H, not working

I quickly tested a bit of my code and does not work, i just added for now to test only a trigger otherwise i could not test,
copy paste it in automations and change to your devices, u see it doesnt work.

Your adam needs to be set on (asleep) before getting this issue.
Its using the anna trough adam, and i have no anna installed into hass

alias: test weg
description: ''
trigger:
  - platform: sun
    event: sunset
    offset: 0
condition: []
action:
  - choose:
      - conditions:
          - condition: not
            conditions:
              - condition: state
                entity_id: climate.adam
                attribute: preset_modes
                state: home
        sequence:
          - service: climate.turn_on
            data: {}
            target:
              entity_id: climate.adam
          - service: climate.set_preset_mode
            data:
              preset_mode: home
            target:
              entity_id: climate.adam
    default: []
mode: single

What version of Home Assistant Core has the issue?

2022.4.6

What was the last working version of Home Assistant Core?

2022.4.6

What type of installation are you running?

Home Assistant OS

How did you install plugwise-beta?

HACS

What kind of Plugwise device is having issues?

Smile: Adam (including Lisa, Tom, Floor)

What firmware version is your Plugwise product at?

3.6.7

Logging

No response

Diagnostics information

No response

Additional information

No response

@malosaa malosaa added the bug Something isn't working label Apr 22, 2022
@malosaa malosaa changed the title [BUG]: For Adam, schedule with this name available. [BUG]: For Adam, schedule with this name not available. Apr 22, 2022
@malosaa malosaa closed this as completed Apr 22, 2022
@malosaa malosaa reopened this Apr 22, 2022
@malosaa
Copy link
Author

malosaa commented Apr 22, 2022

Actually, i thought i fixed it, but still giving a error.
this is the action after changing to lower case,home its the above code.
My anna/adam is on asleep mode.

The thing what i don't get is it can trigger into asleep normally but not home.

If i manually change it to home, than at 00:00 it successfully changes to asleep.. but can't come back to home again..
If i check manually the presets, Home is in capital somehow.. if i make it capital same issue,

image

image

@malosaa
Copy link
Author

malosaa commented Apr 24, 2022

I think you fixed it in the last beta.

i report back tomorrow.

@bouwew
Copy link
Contributor

bouwew commented Apr 24, 2022

Hi Hector, I was away, read the issue just now.

Quick feedback: don't mix schedules and presets. The names asleep, home and away are preset names.

We did add a check for the preset-mode name in the climate.set_preset_mode function in a recent update, but the names that you enter, look correct.
I just now noticed something strange in our code, I will fix that in version 0.22.3a4. Maybe that will help.

@malosaa
Copy link
Author

malosaa commented Apr 24, 2022

Hi Hector, I was away, read the issue just now.

Quick feedback: don't mix schedules and presets. The names asleep, home and away are preset names.

We did add a check for the preset-mode name in the climate.set_preset_mode function in a recent update, but the names that you enter, look correct. I just now noticed something strange in our code, I will fix that in version 0.22.3a4. Maybe that will help.

Hi Bouwe,

No worries you guys take your time, no rush.
Yes it is strange, i know its a preset, but home-assistant says schedule.. thats why i opened the ticket :)
It works with the non beta tho, on my test system.

But anyway thanks for replying so fast.

Regards

@malosaa
Copy link
Author

malosaa commented Apr 25, 2022

Hi Bouwe,

I did download the lest version, still that issue.

On my test system running the version not from hacs and there it works.
I have exact the same blueprint running with the same settings, there is no error.

I don't understand why this happens.

// I will check if it has something to do with HASS 2022.4.6/7
My test system is on 2022.4.3

i update this message as soon when i have tested it

regards

@malosaa
Copy link
Author

malosaa commented Apr 25, 2022

I can confirm its not the hass version 2022.04.3, i just updated to last version on my test system.

Its a problem in the beta versions, even the last one.
When i try the version not from hacs it works.

for some reason home-assistant see the error as a schedule..
While my script is based on attribute: preset_modes and not schedule.

Regards

@bouwew
Copy link
Contributor

bouwew commented Apr 25, 2022

To be able to solve this we need more information:

  • Can we look at your blueprint code somewhere?
  • Is there any detailed information shown in the HA LOGBOEK when an error occurs?

@malosaa
Copy link
Author

malosaa commented Apr 25, 2022

No there is no error, as now on my test system running with the Adam addon from home assistant, it works normal.
If i install on that same system a version from beta it doesnt work.

The blueprint is the same as my main system, i did not even touch it for months.

this is the only error on my main system when manual activating my automation.
Choose at step 1: choice 1: Error executing script. Error for call_service at pos 1: Error communicating with API: Plugwise: no schedule with this name available.
when i activate the automation on my test system its working with no error but using a other adam addon.

here is the piece where it checks for the device.
As i have not yet released this blueprint, i need to finish and add some more stuff, but i did not had any time for it

state_name_morning:
      description: Here you type the preset-state name of your thermostat when entering the morning and start spending money.
      name: Preset for the morning
      default: "home"
    state_name_night:
      description: Here you type the preset-state name of your thermostat when entering the night time to save some money(lowercase)
      name:  Preset for the night 
      default: "asleep"

and here a bit of the action when it enters the morning state,

action:
- choose: 
  - conditions: 
    - condition: not
      conditions:
      - condition: state
        entity_id: !input 'heating'
        state: !input 'state_name_morning'
        attribute: preset_mode
    sequence:
    - service: climate.turn_on
      target:
        entity_id: !input 'heating' 
    - service: climate.set_preset_mode
      target:
        entity_id: !input 'heating'
      data:
        preset_mode: !input 'state_name_morning'

even when manually creating an automation with just these value's it gives the same error.

@malosaa
Copy link
Author

malosaa commented Apr 25, 2022

Try this automation, that one doesnt work for me with the beta

alias: test Adam
description: ''
mode: single
trigger:
  - platform: sun
    event: sunrise
    offset: 0
condition: []
action:
  - choose:
      - conditions:
          - condition: not
            conditions:
              - condition: state
                entity_id: climate.openthermthermostat
                attribute: preset_mode
                state: home
        sequence:
          - service: climate.turn_on
            data: {}
            target:
              entity_id: climate.openthermthermostat
          - service: climate.set_preset_mode
            data:
              preset_mode: home
            target:
              entity_id: climate.openthermthermostat
    default: []

@bouwew
Copy link
Contributor

bouwew commented Apr 25, 2022

Update: question: it works in HA Core 2022.4 with Core Plugwise? And it doesn't work with plugwise-beta v0.22.3 added into Core 2022.4?

@bouwew
Copy link
Contributor

bouwew commented Apr 25, 2022

One more thing: why do you do climate.turn_on? Plugwise does not support this command. Also not climate.turn_off.

@malosaa
Copy link
Author

malosaa commented Apr 25, 2022

Update: question: it works in HA Core 2022.4 with Core Plugwise? And it doesn't work with plugwise-beta v0.22.3 added into Core 2022.4?

Yes

One more thing: why do you do climate.turn_on? Plugwise does not support this command. Also not climate.turn_off.

I know, but it doesnt give an error, i need still to update the code before release

@malosaa
Copy link
Author

malosaa commented Apr 28, 2022

@bouwew

here is the blueprint i created, i just released it.
https://community.home-assistant.io/t/smart-saver-control-v1-0-1/416441

I'm running it for 1 year now.

@bouwew
Copy link
Contributor

bouwew commented May 4, 2022

Sorry, I cannot find anything wrong with plugwise-beta (v0.22.4) when I manually set the preset-mode to home or asleep on Ontwikkelhulpmiddelen -> Services -> Climate: Set preset mode.

Only when I input "home" or "asleep" then I see an error.

@vincentwolsink
Copy link

I am experiencing somewhat similar issues.

When using the climate.set_preset_mode service everything works fine.

service: climate.set_preset_mode
data:
  preset_mode: asleep
target:
  entity_id: climate.woonkamer

But when using the climate entity in a scene it returns the same error message.

- name: Welterusten
  entities:
    climate.woonkamer:
      state: "heat"
      preset_mode: "asleep"
2022-05-12 10:51:13 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [139886539396480] Error communicating with API: Plugwise: no schedule with this name available.
Traceback (most recent call last):
  File "/config/custom_components/plugwise/util.py", line 28, in handler
    return await func(self, *args, **kwargs)
  File "/config/custom_components/plugwise/climate.py", line 175, in async_set_hvac_mode
    await self.coordinator.api.set_schedule_state(
  File "/usr/local/lib/python3.9/site-packages/plugwise/smile.py", line 504, in set_schedule_state
    raise PlugwiseError("Plugwise: no schedule with this name available.")
plugwise.exceptions.PlugwiseError: Plugwise: no schedule with this name available.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 189, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1627, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1664, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 677, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 964, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 714, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/scene/__init__.py", line 114, in _async_activate
    await self.async_activate(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/homeassistant/scene.py", line 327, in async_activate
    await async_reproduce_state(
  File "/usr/src/homeassistant/homeassistant/helpers/state.py", line 116, in async_reproduce_state
    await asyncio.gather(
  File "/usr/src/homeassistant/homeassistant/helpers/state.py", line 110, in worker
    await platform.async_reproduce_states(
  File "/usr/src/homeassistant/homeassistant/components/climate/reproduce_state.py", line 85, in async_reproduce_states
    await asyncio.gather(
  File "/usr/src/homeassistant/homeassistant/components/climate/reproduce_state.py", line 52, in _async_reproduce_states
    await call_service(SERVICE_SET_HVAC_MODE, [], {ATTR_HVAC_MODE: state.state})
  File "/usr/src/homeassistant/homeassistant/components/climate/reproduce_state.py", line 47, in call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1627, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1664, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 677, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 964, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 714, in _handle_entity_call
    await result
  File "/config/custom_components/plugwise/util.py", line 30, in handler
    raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Error communicating with API: Plugwise: no schedule with this name available.

@bouwew
Copy link
Contributor

bouwew commented May 12, 2022

@vincentwolsink this doesn't work?

- name: Welterusten
  entities:
    climate.woonkamer:
      state: heat
      preset_mode: asleep

@vincentwolsink
Copy link

Hi @bouwew,

Tried that too (although it is yaml and shouldn't really matter), but no luck.

@bouwew
Copy link
Contributor

bouwew commented May 12, 2022

Thanks, this error log helps me to pinpoint the problem.
The issue is not with the preset because the error is related to the set_hvac_mode command.
This set_hvac_mode command calls the plugwise-backend command set_schedule_state. And this one needs the last-used schedule name as input. And since you don't have any schedule defined, the above error shows.

Can you avoid calling set_hvac_mode?

@vincentwolsink
Copy link

I don't think so. Because HA actually enforces me to set a state.

- name: Welterusten
  entities:
    climate.woonkamer:
      preset_mode: asleep

Results in the following error:

2022-05-12 12:23:04 ERROR (MainThread) [homeassistant.config] Invalid config for [scene]: State for climate.woonkamer should be a string for dictionary value @ data['states'][0]['entities']. Got None. (See /config/scenes.yaml, line 13). Please check the docs at https://www.home-assistant.io/integrations/scene

@bouwew
Copy link
Contributor

bouwew commented May 12, 2022

I'm digging a bit deeper, looks like HA climate has some new functionality that we hadn't noticed until now.

@bouwew
Copy link
Contributor

bouwew commented May 12, 2022

@malosaa @vincentwolsink please try plugwise-beta v0.23.0a6
This update contains a work-around that should hopefully fix the problem.

@vincentwolsink
Copy link

v0.23.0a6 fixed it for me. Thanks!

@bouwew
Copy link
Contributor

bouwew commented May 12, 2022

@malosaa Does this update work for you too?

If not, I would suggest removing the indicated line in all the climate_set_temperature service calls:

    - service: climate.set_temperature
      data:
        entity_id: !input 'heating'
        hvac_mode: heat_cool  <-- remove this line

@bouwew
Copy link
Contributor

bouwew commented May 13, 2022

@vincentwolsink @malosaa please test plugwise-beta v0.23.0a7, this version has the final fix for this issue.

@vincentwolsink
Copy link

Hi @bouwew, v0.23.0a7 also works fine for me!

@malosaa
Copy link
Author

malosaa commented Jun 1, 2022

@bouwew

sorry for the late reply, i was very sick.. still not 100% better tho.
But the issue has been solved as u said :)

thanks for it

@bouwew
Copy link
Contributor

bouwew commented Jun 1, 2022

@malosaa Hope you get back to 100%!

Thanks for reporting back, I'm closing the issue.

@bouwew bouwew closed this as completed Jun 1, 2022
@malosaa
Copy link
Author

malosaa commented Jun 1, 2022

Thanks and i'm happy to help :)

regards

@malosaa
Copy link
Author

malosaa commented Oct 17, 2023

@bouwew

Hope you doing all ok ?, its been a while using anna and adam again, its getting colder now so i'm sorry i did not noticed this issue before, as i did not use the thermostat for more than 8 months because we had nice weather.

i having this same issue again as before.
i did try everything before reaching out to you.

im on v0.40.3 plugwise beta/smile/stretch using older anna and adam.

my error is in this bit of code:

action:
- choose:
  - conditions:
    - condition: not
      conditions:
      - condition: state
        entity_id: !input 'heating'
        attribute: preset_mode
        state: !input 'state_name_morning'
    sequence:
    - service: climate.turn_on
      data: {}
      target:
        entity_id: !input 'heating'
    - service: climate.set_preset_mode
      data:
        preset_mode: away
      target:
        entity_id: !input 'heating'

however it reads it all ok see this screenshot:
image

and the trace timeline said it could not connect wit the plugwise api:
image

so when executing this exactly same code in developer tool in yaml it executes and sets it to away or home.
image

i could understand if it did not read my variables, but it does..

regards

@bouwew
Copy link
Contributor

bouwew commented Oct 18, 2023

@malosaa I did some digging, the problem is in the climate.turn_on call, plugwise-beta does not support that call properly.
Try removing that call from the sequence.

@bouwew
Copy link
Contributor

bouwew commented Oct 18, 2023

Or, if you feel adventurous, update to v0.43.0a4. That version should provide the proper support (climate.turn_on/_off works in my system running this version).
Note: in v0.43.0a4 the hvac_mode off is added and support for switching the Adam regulation-modes via the climate.set_hvac_mode service.

hvac_mode off = Adam regulation_mode is off
climate.turn_on sets the hvac_mode to heating or cooling whichever was active before. Also by changing the Adam regulation_mode from off to heating or cooling.
climate.turn_off sets the Adam regulation_mode (back) to off.

If you want to also use a schedule, after climate.turn_on, you need to set the hvac_mode to auto.

@malosaa
Copy link
Author

malosaa commented Oct 18, 2023

Well thanks for your quick reply,

i will go with the adventurous option.
will report back as soon as i have tested it.

the main thing i really need is the preset option, named schedule so i can set it up to (home or away)

regards

@malosaa
Copy link
Author

malosaa commented Oct 18, 2023

Well i tested it on my test system and it works, he sets the preset to away and home.
So i will test a bit more, and tonight i will report back if there are any issue's or not.

here is my blueprint i'm building, u can see for what i needed to use it :)
Its on private but u have the direct link.

https://gist.github.com/malosaa/16cc0c8c316ec689d6b5b5352bbcb6de

@malosaa
Copy link
Author

malosaa commented Oct 19, 2023

i did wait till now, and for now i don't see any issue at all.
I'm using it on my main system, so i stay on this version for a bit.

many many thanks and i really appreciate your quick update and work to get this working again 👍

@bouwew
Copy link
Contributor

bouwew commented Oct 21, 2023

@malosaa please update to v0.43.0a5 and test some more, thanks!
This version contains the definite update for the problem you reported above.

@malosaa
Copy link
Author

malosaa commented Oct 24, 2023

ok ill test now :)

sorry for the late reply.
i report back once tested.

@malosaa
Copy link
Author

malosaa commented Oct 26, 2023

i could not reply till now as we had an internet outage from 01:11 till 14:30..
i think its working correctly, but if u want i can wait and test more till tomorrow morning.

regards

@bouwew
Copy link
Contributor

bouwew commented Oct 26, 2023

Please test the released version: v0.43.0 :)

@malosaa
Copy link
Author

malosaa commented Oct 29, 2023

works perfect :)

@malosaa
Copy link
Author

malosaa commented Nov 29, 2023

Hi @bouwew

I found an issue with Anna/Adam.
Well now using the heater again the regulation mode doesn't turn off @ adam.
Even when the regulation mode is turned off (show in home assistant) and Anna see the temperature is below the setpoint it still powers on my gas heater
Before when the regulation mode @ adam is turned off it doesn't heat up.

I did try this:

  • set Anna from heat to off
  • set Adam regulation mode to off

What does work for now as a work around:

  • Set the setpoint to 10c

What could be the problem, not sure if its on my end:
ADAM
image

ANNA
image

HASS:
image

DIAGNOSTIC
image

Regards

@bouwew
Copy link
Contributor

bouwew commented Nov 29, 2023

@malosaa Please create a new Issue for this, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants