Comments (9)
That beats the purpose of auto-discovery of entities, and you can't reuse that entity in multiple automations, you would have to reuse the topic manually
from architecture.
We usually implement buttons that are stateless as events and not entities. That solves the problem I think. Events can have whatever event data that is needed, ie button press characteristics.
from architecture.
The only problem with events is then you can’t trll how long a button is held down. I’m using a Lutron Caseta custom component that uses sensors for the pico remotes and if I press and hold a button the sensor stays active until I release it, so I could theoretically do something different for a long press. The actual remotes themselves don’t report special long press events, just key down and key up events
from architecture.
@MartinHjelmare does it matter if a button has support for state or not? Very few button types are going to have a "pressed" state for long (there are a few red emergency buttons that stay locked once pressed).
Also how would "events" be implemented in an "auto-discovery" component like mqtt?
@cgarwood as long as you receive both events, you can get around it with automations and timers but that would again be workarounds for something that is basic to some buttons.
If we would have a new type of entity based on a sensor that has knowledge of key up/ key down and always publishes events for automation, would make life easier for a lot of things.
from architecture.
I think for Z-Wave, the button itself will recognize if it's pressed once, twice or 3 times and notify us of that and we translate that to an event. From a signal sending perspective, that also makes the most sense.
from architecture.
Thank I guess this is more an MQTT binary_sensor problem because we don't have events triggered on messages?
from architecture.
You can have an automation listen to messages on an MQTT topic, that would solve that?
from architecture.
You can write an automation that
- listens to a wildcard topic on MQTT
- fires an event with that message
That will work like auto-discovery and you can build automations on top of that event. Also, you can just listen multiple times to the same wildcard topic in automations.
from architecture.
I think we should close this.
- Stateless buttons should be implemented as events.
- MQTT now writes the state change immediately to the state machine, so has less risk of loosing quick state changes.
- Integrations that use MQTT as transport should implement new components, that depend on the mqtt component, that support buttons as events. The new components can handle discovery as they need.
- We don't need to support auto discovery of every type of device in the general mqtt component.
from architecture.
Related Issues (20)
- Splitting tests files in smaller files in components/modules tests HOT 1
- Feature Request HOT 1
- Add favorite position to Cover entity HOT 10
- Add feature light distribution control to LightEntity
- Add new CURRENT_HVAC constants HOT 1
- Add Home Appliance entity
- Officially allow enities to set their entity ID not based on their names HOT 2
- Custom Device Class for Binary Sensors HOT 9
- Installed homeassistant supervised on my Linux machine; can't get it to run. HOT 1
- Expand enqueue options media player HOT 2
- Extend Rest API - unique_id HOT 3
- Add "status" as an attribute to CalendarEvents HOT 5
- Add list of (upcoming) calendar events to templating HOT 1
- Creating automations on the fly HOT 1
- Optional health check HOT 2
- Open letter for improving Home Assistant's Authentication system HOT 7
- Add device_class Heater HOT 2
- Area Units HOT 3
- New Device class for Reactive Energy (varh) HOT 1
- "Lost" device HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from architecture.