Dear All, can someone help me use HomeStatus?
I am still learning how to use dummy.
I want to set HomeStatus 1:
set device1 on;; set device2 on;; etc
Could someone teach me what to set in FHEM and in FTUI's widget?
Thanks.
Hi,
I think it is necessary that you provide more information.
Where are your problems?
I think for learning how to use a dummy a first look at the reference guide is a good idea:
https://fhem.de/commandref.html#dummy
For the general procedure (how I would do it):
Create a dummy for the homestatus. Set the STATE of the homestatus via ftui and the homestatus widget to a specific value (e.g. "1").
Then you would need to use a DOIF to interact with the changes of the homestatus dummy and set specific FHEM commands.
e.g. (Pseudo-Code)
DEFINE di_homestatus DOIF ([homestatus] eq "1") (set device1 on; set device2 off)
DOELSE ([homestatus] eq "2") (set device2 on; set device1 on)
That would turn device1 on if the homestatus = "1" and simultaneously turn device 2 off.
If the homestatus would be set to "2" device1 would be turned off and device2 would be turned on.
Thank you.
I do not understand if DOIF work in real-time.
I am currently using notify or AT:
define AtHome notify HomeStatus:1 { if (<EXPR>) {fhem("...")} }
or
define AtHomeCheck at *+00:30:00 { if (<EXPR>) {fhem("...")} }
First one works when there is a state change of HomeStatus.
Second one checks periodically.
But I would like to make some sort of DOIF, for example
If (HomeStatus == 1 && ReadingVal("<DEV>", "<Parameter>", "0") < 20) { fhem("turn fans on") }
But I have not be able to understand when DOIFs get executed.
Very basically: yes, DOIF works in real time - except if you use time conditions.
1 - Trigger
DOIF works event driven. Either the "changing state" event or the "changing reading" event.
[device] will be triggered when the status of the device changes.
[device:reading] will be triggered when the corresponding reading generates an event
With a question mark before, you can evaluate the status or readings of a device in a conditional expression WITHOUT triggering the DOIF.
([?device:reading] eq "25") will not trigger the DOIF, but can be used in combination with a triggering clause to evaluate the value at the moment when the triggering clause will become true.
For example:
([device] eq "on" and [?Sensor:temperature] < 20): the temperature will only be evaluated when the status of the device becomes "on" and not permanently with each temperature change.
So, when planning to setup a DOIF, you have to define which Events will trigger and which conditions will be only conditions.
And you can use time conditions [hh:mm]. They will trigger the DOIF by the given time.
2 - State of the DOIF
The state of the DOIF changes when one of the conditions becomes true. If will remain there as long as this conditions remains true (no other DOELSEIF branch of the DOIF will be executed. To prevent that, you can setup the "do always" attribute. In that case, all the conditions will be evaluated each time one of the triggering conditions becomes true.)
DOIF ([MyHome] eq "PRESENT" and [?DEV:Parameter] < 20)
(set fans on)
will turn the fans on when the status of MyHome becomes "PRESENT", but only if at this moment the temp is under 20. Any change of the temperature will not turn the fans on. As long as MyHome remains PRESENT, nothing will happen.
DOIF ([MyHome] eq "PRESENT" and [DEV:Parameter] < 20)
(set fans on)
will turn the fans on either when MyHome status becomes PRESENT (and at this time the temp is under 20) or when temp becomes < 20 (and at this times, MyHome is PRESENT). Once turned on, nothing will happen, as long as both conditions remain true. If one becomes false, the DOIF will reinit. That means, if you are permanently present, and the temperatures goes under 20 and then over 20 and then again under 20, the fans will be turned on twice.
Hope that helps.
what is wrong here:
define TempModeSwitch DOIF ([?TempMode] eq "off") (set LR_Wall desiredTemperature 5;; set BeR_Bed desiredTemperature 5;; set BR_Bath desiredTemperature 5;; set KR_KR desiredTemperature 5;; set G_WC desiredTemperature 5)
It does not seem to trigger... :(
(Value("TempMode") eq "off") (set LR_Wall desiredTemperature 5; set BeR_Bed desiredTemperature 5; set BR_Bath desiredTemperature 5; set KR_KR desiredTemperature 5; set G_WC desiredTemperature 5)
This also does not work.
But if I enter:
{ Value("TempMode") eq "off }
it gives me 1
So the statement is valid, but it never executes the rest... :/
define TempModeSwitch DOIF ([?TempMode] eq "off")
You used a question mark. This is only a condition. But your doif has no trigger at all. Will do nothing. You must have at least one trigger, in order to have the other conditions evaluated.
(Value("TempMode") eq "off")
This is only a comparison, but again no trigger. A trigger must be either:
[Device] #for a Event "state" triggering
[Device:Reading] #for an Event "Reading" triggering
[hh:mm] #for a time triggering
(set LR_Wall desiredTemperature 5;; set BeR_Bed desiredTemperature 5;; set BR_Bath desiredTemperature 5;;
The different commands must be separated by a coma, not a semicolon.
So if you write :
define TempModeSwitch DOIF ([TempMode] eq "off") (set LR_Wall desiredTemperature 5, set BeR_Bed desiredTemperature 5, set BR_Bath desiredTemperature 5, set KR_KR desiredTemperature 5, set G_WC desiredTemperature 5)
it will set the desired temperatures each time the Device named "TempMode" enters the "off" state.