This page last changed on Feb 16, 2016 by nielsd.

About the question I asked on the Velbus Forum: http://forum.velleman.eu/viewtopic.php?f=81&t=14850&start=30

When I add a custom sensor, and add these values:

on = heat_comfort
off = heat_day
off = heat_night
off = heat_safe

After "Submit" only one of the "off" values keeps existing. So it looks like it is not possible to add multiple values with the same name?

Stuart also said "(Don't link anything with the Off state)", this also is not possible in the designer?

Than you

Hi Niels,

Sorry that idea didn't work. I was convinced it would.

My initial suggestion will work (as I have it running on my controllers) but it will require more work.

You'll need to create 4 virtual switch states using the 'In-Memory virtual command' protocol.

http://www.openremote.org/display/docs/OpenRemote+2.0+How+To+-+In-memory+Virtual+Command+Protocol

You'll need...

3 commands;
ON, OFF & status

Then a sensor looking at the status command

And a switch using the sensor and the two state commands.

The complex bit is creating a set of rules that allows only one virtual switch to be active at any time.

However, once you've got those rules working, it's easy enough to add extra commands to sync to your glass panel.

The biggest problem with this approach, and its not a major issue, is that when the controller is first loaded it will be out of sync with your glass panel.

There is a way to use a rule to check the temp_mode_status of the glass panel and set the virtual switches, but I'll have to test this before I give more details.

However, to get you started, here are the rules I'm using to keep 3 virtual switches in order


package org.openremote.controller.protocol;

global org.openremote.controller.statuscache.CommandFacade execute;

import java.util.*;


// Block of rules for Preset-Groups



rule "Preset-Group-A-A"
when
    $evt:Event(source matches "Preset-Group-A-A-status", $source : source) // NOTE SENSOR NAME IS WHAT IS BEING COMPARED HERE
then
    String buttonStatus = $evt.getValue().toString();
    boolean isActive = buttonStatus != null && buttonStatus.equalsIgnoreCase("on");

    System.out.println("Button Status Change '" + $source + "': " + buttonStatus);

    // EXECUTE ANY COMMANDS BY USING THEIR NAME AND VALUE TO SET
    // ADD ADDITIONAL COMMANDS AS REQUIRED

    if (isActive)
    {
        execute.command("Preset-GroupA-B-Off", ""); // Uncomment to send command
        execute.command("Preset-GroupA-C-Off", ""); // Uncomment to send command

    }
    else
    {
//        execute.command("Relay 01 Off", ""); // Uncomment to send command
//        execute.command("Relay 01 Virtual", "OFF"); // This is just a virtual command to fake relay feedback
    }
end




rule "Preset-Group-A-B"
when
    $evt:Event(source matches "Preset-Group-A-B-status", $source : source) // NOTE SENSOR NAME IS WHAT IS BEING COMPARED HERE
then
    String buttonStatus = $evt.getValue().toString();
    boolean isActive = buttonStatus != null && buttonStatus.equalsIgnoreCase("ON");

    System.out.println("Button Status Change '" + $source + "': " + buttonStatus);

    // EXECUTE ANY COMMANDS BY USING THEIR NAME AND VALUE TO SET
    // ADD ADDITIONAL COMMANDS AS REQUIRED

    if (isActive)
    {
        execute.command("Preset-GroupA-A-Off", ""); // Uncomment to send command
        execute.command("Preset-GroupA-C-Off", ""); // Uncomment to send command

    }
    else
    {
//        execute.command("Relay 01 Off", ""); // Uncomment to send command
//        execute.command("Relay 01 Virtual", "OFF"); // This is just a virtual command to fake relay feedback
    }
end




rule "Preset-Group-A-C"
when
    $evt:Event(source matches "Preset-Group-A-C-status", $source : source) // NOTE SENSOR NAME IS WHAT IS BEING COMPARED HERE
then
    String buttonStatus = $evt.getValue().toString();
    boolean isActive = buttonStatus != null && buttonStatus.equalsIgnoreCase("ON");

    System.out.println("Button Status Change '" + $source + "': " + buttonStatus);

    // EXECUTE ANY COMMANDS BY USING THEIR NAME AND VALUE TO SET
    // ADD ADDITIONAL COMMANDS AS REQUIRED

    if (isActive)
    {
        execute.command("Preset-GroupA-A-Off", ""); // Uncomment to send command
        execute.command("Preset-GroupA-B-Off", ""); // Uncomment to send command

    }
    else
    {
//        execute.command("Relay 01 Off", ""); // Uncomment to send command
//        execute.command("Relay 01 Virtual", "OFF"); // This is just a virtual command to fake relay feedback
    }
end

Obviously you'll need to edit the sensor and command names.

I'll help as much as I can.

Good luck,

Stuart

Posted by mdar at Feb 16, 2016 15:53

Hi

I think I've worked out how to use 4 simple rules to keep the virtual switches in sync with a lead glass panel, with a bonus of being able to use the same set of rules to keep other glass panels in sync.

Even without using the OpenRemote interface, however the mode is changed in the lead panel, other panels can be kept in sync.
I've very tempted to run these rules at home, because I'm forever setting 4 panels to the same mode.

........ I'll test that logic before I post it here....

Posted by mdar at Feb 16, 2016 17:13

Hi,

Well, after a little bit of playing around with "In-Memory Virtual" commands and switches, then some testing of rules, I can tell you that I have got it working!!!!

I now have an OpenRemote panel with 4 switches (showing as radial buttons), linked to 4 virtual switches that will switch each other off, so that only 1 is active at any time.

The active switch sets the thermostat mode of a glass panel, but it would be really easy to add extra Velbus glass panels. (At the moment the first generation VMB1TS isn't supported)

I have included a debounce timer so it may take up to 16 seconds for the radial buttons to respond to a Temp_Mode_Status change with in the glass panel (for example if a Velbus timed event changes the mode)

The rules I've used are these:-



// Block of rules for TEMPERATURE MODE control from radial buttons - (Virtual switches)



rule "Temp_Mode_Radial_COMFORT"
when
    $evt:Event(source matches "01-52_Comfort", $source : source) // NOTE SENSOR NAME IS WHAT IS BEING COMPARED HERE
then
    String buttonStatus = $evt.getValue().toString();
    boolean isActive = buttonStatus != null && buttonStatus.equalsIgnoreCase("ON");

    System.out.println("Temp Mode Change '" + $source + "': " + buttonStatus);

    // EXECUTE ANY COMMANDS BY USING THEIR NAME AND VALUE TO SET
    // ADD ADDITIONAL COMMANDS AS REQUIRED

    if (isActive)
    {
        execute.command("01-52_Day_Off", ""); // Uncomment to send command
        execute.command("01-52_Night_Off", ""); // Uncomment to send command
        execute.command("01-52_Safe_Off", ""); // Uncomment to send command
        execute.command("01-52-GPnx-TempMode-HeatComfort", ""); // Uncomment to send command

    }
    else
    {
//        execute.command("Something_Else", ""); // Edit and uncomment to send command
//        execute.command("Something_Else", ""); // Edit and uncomment to send command
    }
end


rule "Temp_Mode_Radial_DAY"
when
    $evt:Event(source matches "01-52_Day", $source : source) // NOTE SENSOR NAME IS WHAT IS BEING COMPARED HERE
then
    String buttonStatus = $evt.getValue().toString();
    boolean isActive = buttonStatus != null && buttonStatus.equalsIgnoreCase("ON");

    System.out.println("Temp Mode Change '" + $source + "': " + buttonStatus);

    // EXECUTE ANY COMMANDS BY USING THEIR NAME AND VALUE TO SET
    // ADD ADDITIONAL COMMANDS AS REQUIRED

    if (isActive)
    {
        execute.command("01-52_Comfort_Off", ""); // Uncomment to send command
        execute.command("01-52_Night_Off", ""); // Uncomment to send command
        execute.command("01-52_Safe_Off", ""); // Uncomment to send command
        execute.command("01-52-GPnx-TempMode-HeatDay", ""); // Uncomment to send command

    }
    else
    {
//        execute.command("Something_Else", ""); // Edit and uncomment to send command
//        execute.command("Something_Else", ""); // Edit and uncomment to send command
    }
end


rule "Temp_Mode_Radial_NIGHT"
when
    $evt:Event(source matches "01-52_Night", $source : source) // NOTE SENSOR NAME IS WHAT IS BEING COMPARED HERE
then
    String buttonStatus = $evt.getValue().toString();
    boolean isActive = buttonStatus != null && buttonStatus.equalsIgnoreCase("ON");

    System.out.println("Temp Mode Change '" + $source + "': " + buttonStatus);

    // EXECUTE ANY COMMANDS BY USING THEIR NAME AND VALUE TO SET
    // ADD ADDITIONAL COMMANDS AS REQUIRED

    if (isActive)
    {
        execute.command("01-52_Comfort_Off", ""); // Uncomment to send command
        execute.command("01-52_Day_Off", ""); // Uncomment to send command
        execute.command("01-52_Safe_Off", ""); // Uncomment to send command
        execute.command("01-52-GPnx-TempMode-HeatNight", ""); // Uncomment to send command

    }
    else
    {
//        execute.command("Something_Else", ""); // Edit and uncomment to send command
//        execute.command("Something_Else", ""); // Edit and uncomment to send command
    }
end



rule "Temp_Mode_Radial_SAFE"
when
    $evt:Event(source matches "01-52_Safe", $source : source) // NOTE SENSOR NAME IS WHAT IS BEING COMPARED HERE
then
    String buttonStatus = $evt.getValue().toString();
    boolean isActive = buttonStatus != null && buttonStatus.equalsIgnoreCase("ON");

    System.out.println("Temp Mode Change '" + $source + "': " + buttonStatus);

    // EXECUTE ANY COMMANDS BY USING THEIR NAME AND VALUE TO SET
    // ADD ADDITIONAL COMMANDS AS REQUIRED

    if (isActive)
    {
        execute.command("01-52_Comfort_Off", ""); // Uncomment to send command
        execute.command("01-52_Day_Off", ""); // Uncomment to send command
        execute.command("01-52_Night_Off", ""); // Uncomment to send command
        execute.command("01-52-GPnx-TempMode-HeatSafe", ""); // Uncomment to send command

    }
    else
    {
//        execute.command("Something_Else", ""); // Edit and uncomment to send command
//        execute.command("Something_Else", ""); // Edit and uncomment to send command
    }
end




// Block of rules to check status of Glass panel temp mode and set virtual relays


rule "Read temp mode sensor_COMFORT"

    timer (int: 4s) // Debounce timer

when
    $evt:Event(source matches "01-52___Temp_Mode_STATUS_Custom_sensor", $source : source) // NOTE SENSOR NAME IS WHAT IS BEING COMPARED HERE
then
    String buttonStatus = $evt.getValue().toString();
    boolean isActive = buttonStatus != null && buttonStatus.equalsIgnoreCase("heat_comfort");

    System.out.println("Temp Mode Change '" + $source + "': " + buttonStatus);

    // EXECUTE ANY COMMANDS BY USING THEIR NAME AND VALUE TO SET
    // ADD ADDITIONAL COMMANDS AS REQUIRED

    if (isActive)
    {
        execute.command("01-52_Comfort_On", ""); // Uncomment to send command
        execute.command("01-52_Day_Off", ""); // Uncomment to send command
        execute.command("01-52_Night_Off", ""); // Uncomment to send command
        execute.command("01-52_Safe_Off", ""); // Uncomment to send command

    }
    else
    {
//        execute.command("Relay 01 Off", ""); // Uncomment to send command
//        execute.command("Relay 01 Virtual", "OFF"); // This is just a virtual command to fake relay feedback
    }
end


rule "Read temp mode sensor_DAY"

    timer (int: 4s) // Debounce timer

when
    $evt:Event(source matches "01-52___Temp_Mode_STATUS_Custom_sensor", $source : source) // NOTE SENSOR NAME IS WHAT IS BEING COMPARED HERE
then
    String buttonStatus = $evt.getValue().toString();
    boolean isActive = buttonStatus != null && buttonStatus.equalsIgnoreCase("heat_day");

    System.out.println("Temp Mode Change '" + $source + "': " + buttonStatus);

    // EXECUTE ANY COMMANDS BY USING THEIR NAME AND VALUE TO SET
    // ADD ADDITIONAL COMMANDS AS REQUIRED

    if (isActive)
    {
        execute.command("01-52_Comfort_Off", ""); // Uncomment to send command
        execute.command("01-52_Day_On", ""); // Uncomment to send command
        execute.command("01-52_Night_Off", ""); // Uncomment to send command
        execute.command("01-52_Safe_Off", ""); // Uncomment to send command

    }
    else
    {
//        execute.command("Relay 01 Off", ""); // Uncomment to send command
//        execute.command("Relay 01 Virtual", "OFF"); // This is just a virtual command to fake relay feedback
    }
end


rule "Read temp mode sensor_NIGHT"

    timer (int: 4s) // Debounce timer

when
    $evt:Event(source matches "01-52___Temp_Mode_STATUS_Custom_sensor", $source : source) // NOTE SENSOR NAME IS WHAT IS BEING COMPARED HERE
then
    String buttonStatus = $evt.getValue().toString();
    boolean isActive = buttonStatus != null && buttonStatus.equalsIgnoreCase("heat_night");

    System.out.println("Temp Mode Change '" + $source + "': " + buttonStatus);

    // EXECUTE ANY COMMANDS BY USING THEIR NAME AND VALUE TO SET
    // ADD ADDITIONAL COMMANDS AS REQUIRED

    if (isActive)
    {
        execute.command("01-52_Comfort_Off", ""); // Uncomment to send command
        execute.command("01-52_Day_Off", ""); // Uncomment to send command
        execute.command("01-52_Night_On", ""); // Uncomment to send command
        execute.command("01-52_Safe_Off", ""); // Uncomment to send command

    }
    else
    {
//        execute.command("Relay 01 Off", ""); // Uncomment to send command
//        execute.command("Relay 01 Virtual", "OFF"); // This is just a virtual command to fake relay feedback
    }
end



rule "Read temp mode sensor_SAFE"

    timer (int: 4s) // Debounce timer

when
    $evt:Event(source matches "01-52___Temp_Mode_STATUS_Custom_sensor", $source : source) // NOTE SENSOR NAME IS WHAT IS BEING COMPARED HERE
then
    String buttonStatus = $evt.getValue().toString();
    boolean isActive = buttonStatus != null && buttonStatus.equalsIgnoreCase("heat_safe");

    System.out.println("Temp Mode Change '" + $source + "': " + buttonStatus);

    // EXECUTE ANY COMMANDS BY USING THEIR NAME AND VALUE TO SET
    // ADD ADDITIONAL COMMANDS AS REQUIRED

    if (isActive)
    {
        execute.command("01-52_Comfort_Off", ""); // Uncomment to send command
        execute.command("01-52_Day_Off", ""); // Uncomment to send command
        execute.command("01-52_Night_Off", ""); // Uncomment to send command
        execute.command("01-52_Safe_On", ""); // Uncomment to send command

    }
    else
    {
//        execute.command("Relay 01 Off", ""); // Uncomment to send command
//        execute.command("Relay 01 Virtual", "OFF"); // This is just a virtual command to fake relay feedback
    }
end

Please let me know if you need any help setting up the various virtual switches.

Cheers,

Stuart

Cannot resolve external resource into attachment.

Posted by mdar at Feb 16, 2016 20:34

Hi Stuart,
thank you very much for the effort!

I'll try it as soon as possible and let you know if it works.

Thx!

Posted by nielsd at Feb 17, 2016 10:09

Hello Niels,

How are you getting on?

Is it all making sense?

Please give me a shout if you'd like anything explaining in more detail.

I'm really curious to see what you come up with

Cheers,

Stuart

Posted by mdar at Feb 20, 2016 13:09
Document generated by Confluence on Jun 05, 2016 09:34