Giter Club home page Giter Club logo

ha-doppler's Issues

Can't edit existing alarms using Add New Alarm service

Version of the custom_component

latest

Configuration

This won't work as the way the service call currently works it requires color, name, volume, status, and sound. It would be great to just use this to update the time for an existing alarm

service: sandman_doppler.add_alarm
data:
  time: "06:00:00"
  id: 0
target:
  entity_id: switch.alarm_clock_alarm_0_doppler_system_alarm

And even if I include all the required info to send a service call, it just ignores the id that is input and creates a new alarm on the next open id number:

service: sandman_doppler.add_alarm
data:
  time: "06:30:00"
  color:
    - 255
    - 0
    - 0
  name: Doppler System
  volume: 100
  status: set
  sound: Harp.mp3
  id: 0
target:
  entity_id: switch.alarm_clock_alarm_0_doppler_system_alarm

Describe the bug

The service to add new alarms will not edit existing alarms as it should based on the service description "Sets an Alarm on the Doppler. If the ID is unused, the alarm will be created as new. If the ID is in use, the existing alarm will be replaced." It will create new alarms on the next open id number no matter what is put in the service call.

Also, it would be great to only require the entity and id number for the service from this integration. This way, any parameter(s) of the alarm could be adjusted without having to reset all of them.

Debug log

N/A

Error adding entity None for domain binary_sensor with platform sandman_doppler

Version of the custom_component

Version 0.0.0
My device firmware is 0.1714 Cyclops
This is my const.py file:

`"""Constants for Sandman Doppler Clocks."""

Base component constants

NAME = "Sandman Doppler"
DOMAIN = "sandman_doppler"

ATTR_DSN = "dsn"
ATTR_BUTTON = "button"
CONF_SUBTYPE = "subtype"

ATTR_DOPPLER_NAME = "doppler_name"

EVENT_BUTTON_PRESSED = f"{DOMAIN}_button_pressed"

SERVICE_SET_WEATHER_LOCATION = "set_weather_location"
SERVICE_ADD_ALARM = "add_alarm"
SERVICE_UPDATE_ALARM = "update_alarm"
SERVICE_DELETE_ALARM = "delete_alarm"
SERVICE_UPDATE_ALARM = "update_alarm"
SERVICE_SET_MAIN_DISPLAY_TEXT = "set_main_display_text"
SERVICE_SET_MINI_DISPLAY_NUMBER = "set_mini_display_number"
SERVICE_SET_RAINBOW_MODE = "set_rainbow_mode"
SERVICE_ACTIVATE_LIGHT_BAR_BLINK = "activate_light_bar_blink"
SERVICE_ACTIVATE_LIGHT_BAR_COMET = "activate_light_bar_comet"
SERVICE_ACTIVATE_LIGHT_BAR_PULSE = "activate_light_bar_pulse"
SERVICE_ACTIVATE_LIGHT_BAR_SET = "activate_light_bar_set"
SERVICE_ACTIVATE_LIGHT_BAR_SET_EACH = "activate_light_bar_set_each"
SERVICE_ACTIVATE_LIGHT_BAR_SWEEP = "activate_light_bar_sweep"
`

Configuration

Core 2024.6.4
Supervisor 2024.06.2
Operating System 12.4
Frontend 20240610.1

Add your logs here.

2024-06-28 23:31:03.942 ERROR (MainThread) [homeassistant.components.binary_sensor] Error adding entity None for domain binary_sensor with platform sandman_doppler Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 600, in _async_add_entities await coro File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 828, in _async_add_entity original_icon=entity.icon, ^^^^^^^^^^^ File "/config/custom_components/sandman_doppler/binary_sensor.py", line 93, in icon return self.ed.icon_lambda(self.is_on) ^^^^^^^^^^ File "/config/custom_components/sandman_doppler/binary_sensor.py", line 87, in is_on return self.device_data[self.ed.state_key] ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^ KeyError: 'is_in_day_mode'

`

Describe the bug

After adding the integration and adding my Sandman Doppler device I can see the entities properly populated but after some time (1 hour) all the entities become disabled.
When I check the logs I can see several errors adding the entities, I will paste some examples here.

Debug log

2024-06-28 23:31:03.854 DEBUG (MainThread) [custom_components.sandman_doppler] Finished getting update for device Acordador (Doppler-189cc072) 2024-06-28 23:31:03.942 ERROR (MainThread) [homeassistant.components.binary_sensor] Error adding entity None for domain binary_sensor with platform sandman_doppler Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 600, in _async_add_entities await coro File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 828, in _async_add_entity original_icon=entity.icon, ^^^^^^^^^^^ File "/config/custom_components/sandman_doppler/binary_sensor.py", line 93, in icon return self.ed.icon_lambda(self.is_on) ^^^^^^^^^^ File "/config/custom_components/sandman_doppler/binary_sensor.py", line 87, in is_on return self.device_data[self.ed.state_key] ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^ KeyError: 'is_in_day_mode' 2024-06-28 23:31:03.945 ERROR (MainThread) [homeassistant.components.binary_sensor] Error adding entity binary_sensor.acordador_alexa for domain binary_sensor with platform sandman_doppler Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 600, in _async_add_entities await coro File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 914, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1355, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1000, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1126, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.__async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1061, in __async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1006, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/binary_sensor/__init__.py", line 296, in state if (is_on := self.is_on) is None: ^^^^^^^^^^ File "/config/custom_components/sandman_doppler/binary_sensor.py", line 87, in is_on return self.device_data[self.ed.state_key] ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^ KeyError: 'connected_to_alexa' 2024-06-28 23:31:03.949 ERROR (MainThread) [homeassistant.components.light] Error adding entity light.acordador_day_display for domain light with platform sandman_doppler Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 600, in _async_add_entities await coro File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 914, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1355, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1000, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1126, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.__async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1063, in __async_calculate_state if state_attributes := self.state_attributes: ^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 1199, in state_attributes data[ATTR_BRIGHTNESS] = self.brightness ^^^^^^^^^^^^^^^ File "/config/custom_components/sandman_doppler/light.py", line 253, in brightness brightness = self.device_data[self.ed.brightness_key] ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^ KeyError: 'day_display_brightness' 2024-06-28 23:31:03.954 ERROR (MainThread) [homeassistant.components.light] Error adding entity light.acordador_night_display for domain light with platform sandman_doppler Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 600, in _async_add_entities await coro File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 914, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1355, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1000, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1126, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.__async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1063, in __async_calculate_state if state_attributes := self.state_attributes: ^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 1199, in state_attributes data[ATTR_BRIGHTNESS] = self.brightness ^^^^^^^^^^^^^^^ File "/config/custom_components/sandman_doppler/light.py", line 253, in brightness brightness = self.device_data[self.ed.brightness_key] ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^ KeyError: 'night_display_brightness' 2024-06-28 23:31:03.959 ERROR (MainThread) [homeassistant.components.light] Error adding entity light.acordador_day_button for domain light with platform sandman_doppler Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 600, in _async_add_entities await coro File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 914, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1355, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1000, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1126, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.__async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1063, in __async_calculate_state if state_attributes := self.state_attributes: ^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 1199, in state_attributes data[ATTR_BRIGHTNESS] = self.brightness ^^^^^^^^^^^^^^^ File "/config/custom_components/sandman_doppler/light.py", line 253, in brightness brightness = self.device_data[self.ed.brightness_key] ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^ KeyError: 'day_button_brightness'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.