Rademacher Homepilot (DuoFern) via http-Binding

Now, last for today, a partial success with the fan relay.

I finally found the definition of the on / off status here.

So I took the switch Thing and added a transformation as such:

       Type switch : Ventilator_Waschraum "Ventilator Waschraum" [  // Relay switch  DID=<myDID>
            stateExtension="/v4/devices/<myDID>",
            stateTransformation="JSONPATH:$.device.statusesMap.Position∩JS:toSwitch.js",
            commandExtension="/devices/<myDID>", //
            onValue="{\"name\":\"TURN_ON_CMD\"}",
            offValue="{\"name\":\"TURN_OFF_CMD\"}"
        ]

under the assumption that this will integrate the status and the control element into ONE thing.

The script toSwitch.js goes as such:

(function(x){
    try{
        if (x == 0) {
            return (OnOffType.from(false));
        }
        return ((OnOffType.from(true)));
    } catch(e) {
        return null;
    }
})(input)

…which works because the enum is automatically imported in the openHAB scope :partying_face:

I see that it’s working because in difference to before, the GUI element stays in the state I switch (instead of jumping back to UNDEF after one or two seconds), and there are no errors in the console log.

BUT: the switch state seems not to be updated with a regular interval, but only each time the switch element in the GUI is manually actuated, and only in this case there is a console log about a changed state. (Just to be sure I tried it without the concatenated transformation, which did not change anything about the updating behavior, but brought back the UNDEF state).

This is, uhm, not very nice, because I am using the internal timer function (“Treppenhausfunktion”) of the actuator, which automatically switches it off after 15 minutes. And OH would never notice this. :stuck_out_tongue_closed_eyes:

In two separate Things as suggested before this is not an issue, well, but this would again decouple the OH internal switch state variable from the real hardware, so no real win.

Now already being so close, I would be very happy to hear if anyone has an idea of how to convince OH to update the switch status on a regular poll (as all the other statuses…)

1 Like