Code Monkey home page Code Monkey logo

ha-button-plus's People

Contributors

balk77 avatar bolkedebruin avatar koenhendriks avatar p-storm avatar wimjanse avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ha-button-plus's Issues

Entities do not get removed upon removal of the integration

It seem that entities do not get removed upon removal of the integration

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 368, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 563, in _async_add_entity
    entity.add_to_platform_start(
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1246, in add_to_platform_start
    raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Entity 'text.label_btn_45a424_0' cannot be added a second time to an entity platform

Temporarily disable

Current all PR are failing, because the brand is not in the custom domain. I would suggest to disable this check until we are ready to add this. @koenhendriks this will also help with auto completion of branches, and the mails of a PR failing in my inbox :)

Error: <Validation brands> failed: The repository has not been added as a custom domain to the brands repo (More info: https://hacs.xyz/docs/publish/include#check-brands )

Two B+'s, cannot assign B+ to different areas

Describe the bug
I added first B+ with ID 45_a450 to HA, area: "Studeerkamer". Then added second B+ with ID 45_a5d0, during addition I see the Display and 3 BARS, already with area "Studeerkamer". When I make a change in area ("Huiskamer") during the addition of the second B+, also the first B+ changes to "Huiskamer"

To Reproduce
Steps to reproduce the behavior:

  • Add device B+ nr.1 to Integration, give IP address of B+ no. 1 and thereafter enter area for Display, Bar 1/2/3.
  • Add device B+ nr.2 to Integration, give IP address of B+ no. 2, areas for Display and Bar 1/2/3 now show area from no.1
  • During this addition, change are for no.2
  • Also area for no.1 is changed to same as given above for no.2

Expected behavior
Different areas for the two B+'s

Implement better way to detect internal broker url

Currently there is a hardcoded check to see if the endpoint is core-mosquitto. This should be replaced by a better way of detecting if the broker configuration is externally available outside of home assistant.

HASS label Entity value does not match button value

The value of the entity in Home Assistant does not match the value it is set to.

Reproduction steps:

  1. In home assistant open a label entity created by the integration.
  2. Change the value of the entity.
  3. The button now displays the new value.
    afbeelding
  4. Re open the modal of the label entity.
  5. The displayed value does not match the value you just changed it to and is displayed on the button.
    afbeelding
    The history also does not show the changed value

Text entities added representing non existing labels on the display module.

Describe the bug
The display module has no default top label and regular label. They have dynamical labels that can be put on any x or y of the display. Currently by default 2 labels are added for each button bar, but this shouldn't happen for the display buttons.

To Reproduce
Steps to reproduce the behavior:

  1. Install the integration through Hass
  2. Add the button+ integration in Home assistant
  3. See text entities label0, label1, top label 0 and top label 1 under the 'Display Module' device.

Expected behavior

  1. Install the integration through Hass
  2. Add the button+ integration in Home assistant
  3. Don't see any text entities under the 'Display Module' device.

Screenshots
image

When removing the integration device and entity registry remain

When the integration gets removed from home assistant it keeps 'dirty' configuration from the devices and entities behind. This should be cleaned up.

This should be looked into using the async_unload_entry in the main __init__.py of the integration.

Integration does not connect properly to MQTT topics

Steps to reproduce

I have loaded the integration and it connects to the broker successfully. I have chosen to read the config from the IP of the device. Topics configured on the device are as follows:
buttonplus/wk1/button/2/label etc

What happened

Config is loaded to Home Assistant; labels as configured on device are visible in the integration.
Adjustments to labels are published to buttonplus/btn_45a424/button/2/label
Button presses in Home Assistant are not published

What was expected

Adjustments to labels are published to buttonplus/wk1/button/2/label
Button presses in Home Assistant are published to buttonplus/wk1/button/2/state

Re-add light entities and sync over MQTT

The light entities are currently removed from registering. The lights should be added back and be able to sync with the actual state of the Button+ device over MQTT.

Single Light entity
There should only be a single light entity per button has the device does not support controller the front and back individually (see issue N. 64 @ https://button.plus/support/issues)

Can´t add button again after 1.12.2 firmware update

After the update i manually enter Button+ device IP address to integrate button+ device but "Failed to connect, see log for more info" occours. Log:

Logger: custom_components.button_plus.config_flow
Quelle: custom_components/button_plus/config_flow.py:120
Integration: Button+ (Dokumentation, Probleme)
Erstmals aufgetreten: 11:06:19 (5 Vorkommnisse)
Zuletzt protokolliert: 11:12:03

button_plus Exception in login : 'brightnesslargedisplay' - traceback: Traceback (most recent call last): File "/config/custom_components/button_plus/config_flow.py", line 95, in async_step_manual device_config: DeviceConfiguration = DeviceConfiguration.from_json( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/button_plus/button_plus_api/model.py", line 262, in from_json core=Core.from_dict(data["core"]), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/button_plus/button_plus_api/model.py", line 114, in from_dict brightness_large_display=data["brightnesslargedisplay"], ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^ KeyError: 'brightnesslargedisplay'

MQTT sync for display labels

The integration should create labels for the display (both top label and regular label) and these should be synced over MQTT with the integration.

entities are not linked to devices after upgrade to 0.12

I still see 5 devices and 26 entities after the upgrade, and the entities still work (button press, etc.)
But the entities no longer seem to be linked to the devices.
See the screenshot of my bar module 1 below.

I have a button with display and 3 bar modules.
Firmware 1.11

image

image

Two B+'s, automation assigned to B+ nr. 1 is also triggered by B+ nr. 2

Describe the bug
I added first B+ with ID 45_a450 to HA.
Then added second B+ with ID 45_a5d0.
I created an automation for lowering my Luxaflex screens, made sure that this automation is triggered by button/btn_45a450/button/6 (checked with MQTT-explorer).
Same automation is triggered when clicking button from second B+ (ID 45_a5d0).
(This is done with Button+ integration v0.0.6 installed, integration reloaded and devices re-added)

To Reproduce

  • Add B+ no.1 and B+ no.2
  • Create automation for B+ nr. 1, button 6 (check for proper ID of this Button)
  • Reload automation YAML's
  • Click button 6 on B+ no.1, automation is triggered -> ok, is expected behaviour
  • Click button 6 on B+ no.2, automation is triggered -> not ok, no automation is assigned to this button

Expected behavior
Different B+'s with different ID's not to influence each-other, not to trigger each-others actions.

Automation:
alias: B+LuxStdkOpen
description: ""
trigger:

  • platform: state
    entity_id:
    • button.btn_45a450_6
      condition: []
      action:
  • service: scene.turn_on
    metadata: {}
    target:
    entity_id: scene.std_open
    mode: single

No automation exists for B+ with id 45_a5d0 on button-6

Documentation for installation and inner workings.

Documentation should be added how the integrations maps entities to button+ buttons, leds and screen labels.
It should also document how the MQTT broker from Home Assistant is used and how to install and update it using HACS.

The Readme needs some polishing as well.

Integration does not work after upgrade to 0.9

After updating integration to version 0.9 Button+ integration stops working.

I use HA2024.4.2

Logger: homeassistant.config_entries
Source: config_entries.py:504
First occurred: 16:15:15 (1 occurrences)
Last logged: 16:15:15

Error setting up entry btn_462b80 for button_plus
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 504, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/button_plus/__init__.py", line 25, in async_setup_entry
    device_configuration: DeviceConfiguration = DeviceConfiguration.from_json(entry.data.get("config"))
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/button_plus/button_plus_api/model.py", line 206, in from_json
    core=Core.from_dict(data['core']),
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/button_plus/button_plus_api/model.py", line 80, in from_dict
    topics=data['topics']
           ~~~~^^^^^^^^^^
KeyError: 'topics'

Create model for device config.

Currently the config gets parsed from Json and is used directly with getters, for instance

config = json.loads(json_config)
device_name = config.get('core').get('name')
device_id = config.get('info').get('id')

A model should be created for the config format of the button plus according to the following json:

{
    "info": {
        "id": "btn_1111a1",
        "mac": "FF:12:FF:34:56:F1",
        "ipaddress": "192.168.1.1",
        "firmware": "1.03",
        "largedisplay": 0,
        "connectors": [
            {
                "id": 0,
                "type": 2
            },
            {
                "id": 1,
                "type": 1
            },
            {
                "id": 2,
                "type": 1
            },
            {
                "id": 3,
                "type": 1
            }
        ],
        "sensors": [
            {
                "sensorid": 1,
                "description": "Sensirion STS35 Temperature Sensor"
            }
        ]
    },
    "core": {
        "name": "DevButtonPlus",
        "location": "Livingroom",
        "invert": true,
        "autobackup": true,
        "brightnesslargedisplay": 100,
        "brightnessminidisplay": 100,
        "ledcolorfront": 0,
        "ledcolorwall": 0,
        "color": 0
    },
    "mqttbuttons": [
        {
            "id": 0,
            "label": "display left",
            "toplabel": "display label left",
            "ledcolorfront": 0,
            "ledcolorwall": 0,
            "topics": []
        },
        {
            "id": 1,
            "label": "display right",
            "toplabel": "display label right",
            "ledcolorfront": 0,
            "ledcolorwall": 0,
            "topics": []
        },
        {
            "id": 2,
            "label": "Btn 1 left",
            "toplabel": "Label 1 left",
            "ledcolorfront": 0,
            "ledcolorwall": 0,
            "topics": []
        },
        {
            "id": 3,
            "label": "Btn 1 right",
            "toplabel": "Label 1 right",
            "ledcolorfront": 0,
            "ledcolorwall": 0,
            "topics": []
        },
        {
            "id": 4,
            "label": "Btn 2 left",
            "toplabel": "Label 2 left",
            "ledcolorfront": 0,
            "ledcolorwall": 0,
            "topics": []
        },
        {
            "id": 5,
            "label": "Btn 2 right",
            "toplabel": "Label 2 right",
            "ledcolorfront": 0,
            "ledcolorwall": 0,
            "topics": []
        },
        {
            "id": 6,
            "label": "Btn 3 left",
            "toplabel": "Label 3 left",
            "ledcolorfront": 0,
            "ledcolorwall": 0,
            "topics": []
        },
        {
            "id": 7,
            "label": "Btn 3 right",
            "toplabel": "Label 3 right",
            "ledcolorfront": 0,
            "ledcolorwall": 0,
            "topics": []
        }
    ],
    "mqttdisplays": [
        {
            "x": 0,
            "y": 0,
            "fontsize": 4,
            "align": 0,
            "width": 50,
            "label": "Amsterdam",
            "unit": "",
            "round": 0,
            "topics": [
                {
                    "brokerid": "buttonplus",
                    "topic": "system/datetime/amsterdam",
                    "payload": "",
                    "eventtype": 15
                }
            ]
        },
        {
            "x": 0,
            "y": 40,
            "fontsize": 2,
            "align": 0,
            "width": 30,
            "unit": "°C",
            "round": 1,
            "topics": [
                {
                    "brokerid": "buttonplus",
                    "topic": "button/btn_4967c8/temperature",
                    "payload": "",
                    "eventtype": 15
                }
            ]
        }
    ],
    "mqttbrokers": [
        {
            "brokerid": "buttonplus",
            "url": "mqtt://mqtt.button.plus",
            "port": 0,
            "wsport": 0
        }
    ],
    "mqttsensors": [
        {
            "sensorid": 1,
            "topic": {
                "brokerid": "buttonplus",
                "topic": "button/btn_4967c8/temperature",
                "payload": "",
                "eventtype": 18
            },
            "interval": 10
        }
    ]
}

retain topics for labels and top_labels

Values of the labels and top labels disappear after certain time (i guess 10 minutes). If I make the topics retain by publishing with MQTT explorer with the retian flag the value remains.

Use connections from device config to setup hass devices

Currently the devices are hardcoded on button ids, but should be retrieved from the connectors part of the json config:

Types are defined as following:
1 -> BAR module
2 -> Dispay Module

{
    "info": {
        "connectors": [
            {
                "id": 0,
                "type": 2
            },
            {
                "id": 1,
                "type": 1
            },
            {
                "id": 2,
                "type": 1
            },
            {
                "id": 3,
                "type": 1
            }
        ]
    }
}

Error messages in log after adding second B+

Describe the bug
Removed earlier versions of B+ with ID btn_45a450 and B+ with ID btn_45a5d0.

Added B+ btn_45a450, checked log file, no warnings, no errors.

Added B+ btn_45a5d0, checked log file, following errors occur:

2024-01-22 12:11:33.794 ERROR (MainThread) [homeassistant.components.button] Error adding entities for domain button with platform button_plus
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 563, in _async_add_entity
    entity.add_to_platform_start(
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1250, in add_to_platform_start
    raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Entity 'button.btn_45a450_0' cannot be added a second time to an entity platform
2024-01-22 12:11:33.819 ERROR (MainThread) [homeassistant.components.text] Error adding entities for domain text with platform button_plus
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 563, in _async_add_entity
    entity.add_to_platform_start(
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1250, in add_to_platform_start
    raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Entity 'text.label_btn_45a450_0' cannot be added a second time to an entity platform
2024-01-22 12:11:33.825 ERROR (MainThread) [homeassistant.components.button] Error while setting up button_plus platform for button
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 368, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 563, in _async_add_entity
    entity.add_to_platform_start(
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1250, in add_to_platform_start
    raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Entity 'button.btn_45a450_0' cannot be added a second time to an entity platform
2024-01-22 12:11:33.834 ERROR (MainThread) [homeassistant.components.text] Error while setting up button_plus platform for text
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 368, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 563, in _async_add_entity
    entity.add_to_platform_start(
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1250, in add_to_platform_start
    raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Entity 'text.label_btn_45a450_0' cannot be added a second time to an entity platform

Despite the errors, both B+'s are working properly (except earlier bug mentioned in #36, but this is area related only)

home-assistant_2024-01-22T11-12-40.106Z.log

Unable to add Button+ to integration

When adding the integration to HA and setting up the initial config I always get a message 'Failed to set up' when I try to fetch my button+ through the button.plus website.

I have uploaded the current config to the button.plus website.

What am I missing?

The log gives me this error:

Logger: homeassistant.config_entries
Source: config_entries.py:594
First occurred: 22:14:41 (9 occurrences)
Last logged: 22:50:27

Error setting up entry btn_4674c0 for button_plus
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/button_plus/init.py", line 26, in async_setup_entry
device_configuration: DeviceConfiguration = DeviceConfiguration.from_json(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/button_plus/button_plus_api/model.py", line 259, in from_json
data = json.loads(json_data)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/json/init.py", line 339, in loads
raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not NoneType

ButtonPlusBrightness is overriding deprecated methods on an instance of NumberEntity

After upgrading the HA integration from version 0.9 to 0.12 I get this warning in the HA log:

Logger: homeassistant.components.number
Source: components/number/init.py:216
integration: Number (documentation, issues)
First occurred: 10:34:27 (1 occurrences)
Last logged: 10:34:27

custom_components.button_plus.number::ButtonPlusBrightness is overriding deprecated methods on an instance of NumberEntity, this is not valid and will be unsupported from Home Assistant 2022.10. Please report it to the custom integration author

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.