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

Light switch is unavailable if made from switch template #42984

Open
OleksandrBerchenko opened this issue Nov 8, 2020 · 30 comments
Open

Light switch is unavailable if made from switch template #42984

OleksandrBerchenko opened this issue Nov 8, 2020 · 30 comments

Comments

@OleksandrBerchenko
Copy link
Contributor

The problem

After HA restart, a light switch made from a switch template remains unavailable until the switch changed its state. This bug is introduced in 0.117, earlier it worked as expected.

Environment

  • Home Assistant Core release with the issue: 0.117.5
  • Last working Home Assistant Core release (if known): 0.116
  • Operating environment (OS/Container/Supervised/Core): Virtualenv on Raspberry Pi
  • Integration causing this issue: Light Switch
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/light.switch/

Problem-relevant configuration.yaml

switch:
  - platform: template
    switches:
      readinglamp_wrapper:
        value_template: "{{ states.switch.readinglamp.state == 'on' }}"
        availability_template: "{{ states.switch.readinglamp != None and states.switch.readinglamp.state != 'unavailable' and states.binary_sensor.power.state == 'on' }}"
        turn_on:
          service: switch.turn_on
          entity_id: switch.readinglamp
        turn_off:
          service: switch.turn_off
          entity_id: switch.readinglamp

light:
  - platform: switch
    name: readinglamp
    entity_id: switch.readinglamp_wrapper

switch.readinglamp comes from Xiaomi Gateway (Aqara) UI integration.

Traceback/Error logs

2020-11-08 20:58:15 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=switch.readinglamp_wrapper, old_state=None, new_state=<state switch.readinglamp_wrapper=off; friendly_name=readinglamp wrapper @ 2020-11-08T20:58:15.768398+02:00>>
...
2020-11-08 20:58:15 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=light.readinglamp, old_state=None, new_state=<state light.readinglamp=unavailable; friendly_name=readinglamp, supported_features=0 @ 2020-11-08T20:58:15.790523+02:00>>
...
2020-11-08 20:58:20 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=switch.readinglamp, old_state=None, new_state=<state switch.readinglamp=off; in_use=0, load_power=0.0, power_consumed=537.0, voltage=3.6, battery_level=100.0, friendly_name=readinglamp, icon=mdi:power-plug @ 2020-11-08T20:58:20.816473+02:00>>

Additional information

N/A

@frenck
Copy link
Member

frenck commented Nov 8, 2020

Maybe a weird question (and probably a bit off-topic as well). But... euhm... why are you using a switch template and use the light switch to convert it into a light? Why not use a light template directly?

@probot-home-assistant
Copy link

light documentation
light source
(message by IssueLinks)

@OleksandrBerchenko
Copy link
Contributor Author

@frenck To have a clean code :) Please note, I have a lot of similar switch templates (which handle a power outage) and not of them are used for lights. Until this bug is fixed, I have already converted all of them into light templates.

Thanks!

@dgomes
Copy link
Contributor

dgomes commented Nov 23, 2020

I think this is the same issue as #43457

@github-actions
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Feb 21, 2021
@OleksandrBerchenko
Copy link
Contributor Author

Yes, this is still actual.

@github-actions github-actions bot removed the stale label Feb 21, 2021
@RolandvanOers
Copy link

Same problem here, some lights are unavailable but the original switch is.

@github-actions
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jun 20, 2021
@OleksandrBerchenko
Copy link
Contributor Author

Yes, this is still actual.

@github-actions github-actions bot removed the stale label Jun 20, 2021
@jprintz
Copy link

jprintz commented Jun 20, 2021

The same issue occurs for me when just turning a switch into a light using the Light Switch platform. In other words, this occurs even when not using switch templates, it seems to affect any kind of switch that is turned into a Light Switch.
A restart of HA resets the light switches so that they are shown as available again.

@RolandvanOers
Copy link

Problem is still the same indeed, anything turned into a light switch is unavailable after 1 or 2 uses

@github-actions
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Sep 18, 2021
@OleksandrBerchenko
Copy link
Contributor Author

Yes, this is still actual.

@github-actions github-actions bot removed the stale label Sep 18, 2021
@github-actions
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Dec 17, 2021
@OleksandrBerchenko
Copy link
Contributor Author

Yes, this is still actual.

@github-actions github-actions bot removed the stale label Dec 17, 2021
@ronytomen
Copy link
Contributor

Can those having problems post the template light configuration in YAML?

Also, the light entities that are used within the template light or light switch, which integration/component ultimately supports those light entities?

@github-actions
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jul 15, 2022
@OleksandrBerchenko
Copy link
Contributor Author

Yes, this is still actual.

@github-actions github-actions bot removed the stale label Jul 15, 2022
@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@OleksandrBerchenko
Copy link
Contributor Author

Yes, this is still actual.

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@OleksandrBerchenko
Copy link
Contributor Author

Yes, this is still actual.

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@OleksandrBerchenko
Copy link
Contributor Author

Yes, this is still actual.

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@OleksandrBerchenko
Copy link
Contributor Author

Yes, this is still actual.

@github-actions github-actions bot removed the stale label Oct 13, 2023
@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@OleksandrBerchenko
Copy link
Contributor Author

Yes, this is still actual.

@github-actions github-actions bot removed the stale label Jan 11, 2024
@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@OleksandrBerchenko
Copy link
Contributor Author

Yes, this is still actual.

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

No branches or pull requests

6 participants