Open flatsiedatsie opened 5 years ago
@flatsiedatsie do I understand correctly that you mean https://iot.mozilla.org/schemas/#PushButton ? Would it make sense to map that to MySensors as S_BINARY with V_TRIPPED?
How are the other Mozilla types mapped to MySensors? (I guess it would make sense to look at S_BINARY with V_STATUS as a comparison.)
Would it make sense to map that to MySensors as S_BINARY with V_TRIPPED?
I don't know. Would that work? I'd just like to signal to the controller interface that the button should immediately return to the unpressed state after it is pressed. Right now my nodes 'hack' it by sending a "go back to unpressed state" update after they receive the signal. But in some scenario's that creates unforeseen complexity. And if the return signal is not received, then the controller UX is left in a weird/impossible state.
I'll share a first version of the adapter soon (possibly today), there you can see the initial mapping (still very incomplete, but it works for a few device types now)
Getting back to this: do you think most MySensors users would find the behaviour or an S_BINARY with V_TRIPPED being turned into a pushbutton predictable?
If so, then I can make this the behaviour of the WebThings adapter.
I would suggest using S_SCENE_CONTROLLER which usually is a panel with multiple push buttons. The corresponding V_SCENE_ON is triggered when button is pressed. Some scene controllers use V_SCENE_OFF when doing a long press.
Hmm, I was just thinking that V_TRIPPED feels more like sensor data than an actuator.
The S_SCENE_CONTROLLER option could work, but feels again a bit like a hack.
Which would again make the point that a dedicated push button type would be really useful?
Just thinking out loud: how about this situation:
S_BINARY <- handles toggle buttons
S_EVENT / S_NOTIFY / S_UNARY / S_MONO / S_PUSH / S_SINGLE <- This handles signals that are not binary, but indicate an event has occurred. Such as push buttons.
You could create pretty much al singular and binary actuators and sensors with this.
It would also be interesting to decree that all MySensors S_TYPES should henceforth have V_UX / V_META, as well as V_UNIT, to help interfaces better understand how to optimally present the data.
If this was universalized it could be interesting.
Some examples:
A push button: S_EVENT = "Rocket main engine"
A singular sensor: S_EVENT = "Passing the equator"
A smoke alarm would have two children: S_EVENT = "Smoke detected!"
S_BINARY = "Armed and ready"
Just having some fun: perhaps it would be possible to deal with the issue that S_TYPES will never cover all use cases. Maybe they can be decoupled from this all together? Imagine if there were fewer S_TYPES:
S_MONO S_BINARY S_STRING S_VARIABLE
Then a lot of existing S_TYPES would be described differently:
A wind vane child: S_STRING = "Wind direction"
A bathroom scale: S_VARIABLE = "Your weight"
A controller for a thermostat. S_VARIABLE = "Desired temperature"
The actual temperature in the room: S_VARIABLE = "Desired temperature"
An air quality sensor: S_VARIABLE = "Fine dust on the balcony"
A bathroom scale: S_VARIABLE = "Your weight"
A dimmer: S_VARIABLE = "Dimmable lamp"
Further musings
Perhaps it could be interesting to add a way of communicating what an entire device is for. This would allow controllers to show related icons, for example.
I_TYPE = "weather_station" or I_TYPE = "doorbell" or I_TYPE = "thermostat" or I_TYPE = "powerplug" or I_TYPE = "power_management" or I_TYPE = "personal_health"
Perhaps this could be aligned with a standard, like the one Mozilla is trying to make.
A lot of these musings have been influenced by working on the MySensors adapter for the Mozilla Webthings Gateway.
Does anyone know how popular controllers like OpenHab and HomeAssistant handle this type of button? Or don't they support this use case?
In Home Assistant, for now, we treat sensors that report V_TRIPPED as binary sensors with state. We don't specifically support push buttons although S_SCENE_CONTROLLER + V_SCENE_ON can be used for that.
I'm planning to fire Home Assistant events for binary sensors, on child update, besides the normal state changes, to allow users to write automations that listen for events and not only state changes. In Home Assistant stateless devices are usually represented as events that fire.
If mysensors would be more specific in reporting if a button has state or is stateless, I think that would allow for a better user experience, where controllers can present the devices and their behavior more close to what they actually are.
@MartinHjelmare How could we do that? Do you agree we could explore adding an S_PUSH
type?
It would probably involve adding a new S type and one to many V types for the different push events. Probably at least two different push events, click and hold (long press) should be represented.
I haven't given this much thought yet.
I am really missing a built-in push button type.
I was again triggered to create this request while working on a mysensors adapter for the Mozilla Gateway. It has the 'push-button' capability. But I cannot map that to anything in MySensors.
Earlier I noticed that in my sketches I wish I could more clearly have a pushbutton child. For example, in Domoticz a user now has to manually switch a button onto a pushbutton type via the interface. It would be great if this intention could already be built in.