I am new to Homeassistant and to this community and both are really great!
As i have been running FHEM for 10+ years now i am now in the process of transitioning over to homeassistant. In general i have not encountered any bigger roadblocks but now i have somewhat hit a problem that i cannot come to a good solution for.
My smart-home has historically grown and has all kinds of components - FS20, Intertechno, TASMOTA-Wifi-Stuff, Hue, Tradfri and a large homematic setup. FHEM used to serve as the thing that keeps everything together and now i want to move this role over to Homeassistant.
I have one “automation” that triggers the lights to go on for a specific period when the front door gets opened from the “outside”. The lights are also directly bound to movement sensors in the specific rooms - ie Tradfri Sensor with Tradfri bulb, Homematic Sensor with homematic bulb - direct pairing, no central computersystem involved.
What i cannot accomplish now is to trigger the homematic lights to be turned on in a way that if the movement detector detects movement after the initial period (eg 5 minutes after opening the door) it will keep refreshing the on-command and homeassistant will not turn it of after the 5 minute timer has expired.
The problem is, that once the movement detector takes over Homeassistant would still turn the light off unless i do complicated tracking with automations based on the movement detector events or switch events. What i used to have in fhem is to just say turn the light on-for-timer 300. That way the device did the accounting and the movement detector just reset this timer whenever it sensed something.
I hope the explanation makes sense and that someone here has a “nice” way of solving this
Could the timer be used to replicate that functionality? I have to admit I didn’t fully grasp what you’re trying to achieve or what the problem is.
Door opens, Homeassistant triggers a light to go on
It starts a timer - either in the automation itself or as a timer object
I move around in the room - the movement detector sees that and sends messages to the same light (stay on for 5 more minutes)
the timer expires on homeassistant and an automation says: turn off the light
The light is now off, although there was recent movement
I think it would work to “prolong” the timer with the movement detector as well but i feel it will create a lot of complexity in the whole system.
As you are probably the expert on homematic here i’d like to drop a followup question: My devices usually have multiple channels - homeassistant however only detects one of them. I use this again for my movement detector setup in a way that in the device i have rules (channel 1 [controlled by the physical button] OR (channel 2 [controlled by the movement detector to 100%] AND channel 3 [controlled by a timer to be put to either 40% or 0% depending on day or night). Is there any way to set values to the specific channels or see them as distinct entities?
If you have answered all these questions with yes (and it’s not a mix of HomeMatic and HomeMatic IP), then I wouldn’t use Home Assistant at all, but instead use Direktverknüpfungen. What you want to do can be done with the Expertenmodus, which is explained here very well: https://www.youtube.com/watch?v=1B4iwtK1Rmo
If other ecosystems are involved I’ll have to think of a solution.
About the other question: what kind of device are you talking about? Usually all channels should be available as entities if we are talking about actors or sensors. Only buttons are hidden from the UI because they have no persistent state. So if there are channels missing, that could be a bug. With one more exception: HomeMatic IP actors use 3 virtual channels for actors, and we only create entities for the first one.
That being said, you can manually control devices using the _homematic.put_paramset or homematic.set_device_value services mentioned in the documentation.
light as well as motion sensor are homematic - the trigger for the whole thing however is a Wiegand-Based Pin-Pad connected to a raspi
The idea with the “Direktverknüpfungen” however could still work if i would delegate that kind of setup into the Homematic - eg by using on of the push-button-homematic-interface controllers that i have laying around. Not great but still better than manually keeping track of the state of the system.
I’ll take that aproach as a last resort and will try my luck with the put_paramset first.
Regarding the lamp: It is a HM-LC-Dim1TPBU-FM Dimmer. In the CCU webIF it shows
but in HA it only gives:
one line - but as a new user i seem not to be able to upload to pictures in one post
From the state i see in HA it seems it is showing channel 1 only.
One thing to mention here - “Modus vereinfachte Konfiguration aktivieren” needs to be off for the user or it will show the same in the CCU webIF. I set that for all of my users however and even tried switching it on or off and restarting HA in between.
class Dimmer(GenericDimmer, HelperWorking):
"""
Dimmer switch that controls level of light brightness.
"""
@property
def ELEMENT(self):
if "Dim2L" in self._TYPE or "Dim2T" in self._TYPE or self._TYPE == "HM-DW-WM" or self._TYPE == "HM-LC-DW-WM":
return [1, 2]
return [1]
Here only a few devices get more than 1 channel - HM-LC-Dim1TPBU-FM isn’t one of them
Would you be willing to add this here?
if self._TYPE == "HM-LC-Dim1TPBU-FM":
return [1, 2, 3]
Ok, so that’s one of the very few Non-IP devices that has virtual actor-channels. Only advanced users use them, and back then when we did the integration we decided that regular users would only really need the first channel, as the other two would only confuse them - controlling them has unexpected results if you don’t know how they work. So for now I would vote to leave it the way it is. As you have learned, you can still control the channels manually, although it’s a bit more effort.
Ideally there would be something like an expert-mode for the integration where the additional channels would be displayed, just like on the CCU. But so far we don’t provide this.
That being said, I’ve been thinking about rewriting the whole integration to be more low level in general (which would display the additional channels), but haven’t found the time to take care of it. It would be a pretty huge rewrite, and my time is limited. So I hope for the time being you’re ok with accomplishing your automations using the available workarounds.
Regarding your initial problem (the automation):
I would recommend using the DirektverknĂĽpfungen. They have the advantage, that the automation would keep working even while Home Assistant is down for maintenance / updates.
Here’s what I would do:
Set a static ON_TIME of x minutes for the light
Use a DirektverknĂĽpfung to turn on the light when motion is detected
Configure a Virtueller Taster (the CCU offers 50 virtual buttons) to turn on the light as well
Use the homematic.virtualkey service to trigger the virtual button from Home Assistant based on however your PIN-Pad is already turning on the light (example)
This approach assumes that the light we’re talking about doesn’t require an always-on mode. If it does, the virtual channels you’re already seem to be using could be used to achieve that. If I recall correctly there’s actually an example of exactly this use case in the video I have linked above.
@irqnet
There’s actually a service available to do this directly from Home Assistant: homematic.set_variable_value
Thanks for the explanation. I absolutely understand that these virtual channels are confusing for the average user and that switching them without having the proper setup in the device itself might be creating some problems. For my use cases however i have in all of these dimmers configured the first channel to be something that does not actually control the light directly.
The change i described above introduced the 2 additional channels as entities as desired so if you would not want to add it into the general source code i will probably try to come up with a way to patch it in the file itself during startup (or at container creation as i am using docker). This way i can keep using the nice UI elements and control the 3 channels by HA standard means.
As far as i saw the “new” concept of devices having child-entities would actually fit homematic pretty well. In this setup with the virtual channels the device would give the “actual” value for LEVEL for instance while the 3 virtual channels would give the inputs for the calculation only.
The ON_TIME story i have meanwhile resolved by the put_paramset as described above. This gives the best flexibility and there is only one automation per light that needs to do it. It seems to work well in my first tests. If i find a downside to the setup i might switch over to the DirektverknĂĽpfung but the direct call is a rather simple solution and looking at what fhem did to turn on the lights i found it was doing essentially the same thing in its source code.
You’re correct about the two telegrams. But the way you are doing it is the best solution I know of if you only want to control this in Home Assistant.
If you are open to also make use of “Direktverknüpfungen” on your CCU, then you can assign a short or long press of the virtual buttons of your CCU to the device. In the “Direktverknüpfung” you can pass the ON_TIME together with the switch-action. And then you just press that virtual button from Home Assistant. It will look something like this: