Examples of SwitchItem


Examples of org.openhab.core.library.items.SwitchItem

  public void testOrFunction_differntTypes() {
    DimmerItem dimmer1 = new DimmerItem("TestDimmer1");
    dimmer1.setState(new DecimalType("42"));
    DimmerItem dimmer2 = new DimmerItem("TestDimmer2");
    dimmer2.setState(new DecimalType("0"));
    SwitchItem switch1 = new SwitchItem("TestSwitch1");
    switch1.setState(OnOffType.ON);
    SwitchItem switch2 = new SwitchItem("TestSwitch2");
    switch2.setState(OnOffType.OFF);
   
    items.add(dimmer1);
    items.add(dimmer2);
    items.add(switch1);
    items.add(switch2);
View Full Code Here

Examples of org.openhab.core.library.items.SwitchItem

  /**
   * @{inheritDoc}
   */
  public GenericItem createItem(String itemTypeName, String itemName) {
    if (itemTypeName.equals(ITEM_TYPES[0])) return new SwitchItem(itemName);
    if (itemTypeName.equals(ITEM_TYPES[1])) return new RollershutterItem(itemName);
    if (itemTypeName.equals(ITEM_TYPES[2])) return new ContactItem(itemName);
    if (itemTypeName.equals(ITEM_TYPES[3])) return new StringItem(itemName);
    if (itemTypeName.equals(ITEM_TYPES[4])) return new NumberItem(itemName);
    if (itemTypeName.equals(ITEM_TYPES[5])) return new DimmerItem(itemName);
View Full Code Here

Examples of org.openhab.core.library.items.SwitchItem

  @Test
  public void testParseBindingConfig() throws BindingConfigParseException {
    ExecBindingConfig config = new ExecGenericBindingProvider.ExecBindingConfig();
    String bindingConfig = "ON:some command to execute, OFF: 'other command with comma\\, and \\'quotes\\' and slashes \\\\ ', *:and a fallback";
    SwitchItem item = new SwitchItem("");
   
    provider.parseLegacyOutBindingConfig(item, bindingConfig, config);
   
    Assert.assertEquals(3, config.size());
    Assert.assertEquals("some command to execute", config.get(OnOffType.ON).commandLine);
View Full Code Here

Examples of org.openhab.core.library.items.SwitchItem

  private void parseButtonWithRefresh(String name, String config,
      Button.PressType type, String address, String[] groups)
      throws BindingConfigParseException {

    Item item = new SwitchItem(name);
    provider.processBindingConfiguration("context", item, config);
    Button button = (Button) provider.getItemConfig(name);

    assertEquals(name, button.getName());
    assertEquals(address, button.getAddress());
View Full Code Here

Examples of org.openhab.core.library.items.SwitchItem

  }

  private void parseButton(String name, String config, Button.PressType type,
      String address) throws BindingConfigParseException {

    Item item = new SwitchItem(name);
    provider.processBindingConfiguration("context", item, config);
    Button button = (Button) provider.getItemConfig(name);

    assertEquals(name, button.getName());
    assertEquals(address, button.getAddress());
View Full Code Here

Examples of org.openhab.core.library.items.SwitchItem

  }

  private void parseChannelConfig(String name, String config, String address,
      int channel) throws BindingConfigParseException {

    Item item = new SwitchItem(name);
    provider.processBindingConfiguration("context", item, config);
    ModuleChannel c = (ModuleChannel) provider
        .getItemConfig(name);

    assertEquals(name, c.getName());
View Full Code Here

Examples of org.openhab.core.library.items.SwitchItem

    @Before
    public void setUpDefaultDevice() {
        parameterAddress = new EnoceanParameterAddress(EnoceanId.fromString(EnoceanBindingProviderMock.DEVICE_ID), CHANNEL, (String) null);
        provider.setParameterAddress(parameterAddress);
        provider.setItem(new SwitchItem("dummie"));
        provider.setEep(EEPId.EEP_F6_02_01);
        binding.addBindingProvider(provider);
    }
View Full Code Here

Examples of org.openhab.core.library.items.SwitchItem

    public void testReceiveButtonPress() {
        parameterAddress = new EnoceanParameterAddress(EnoceanId.fromString(EnoceanBindingProviderMock.DEVICE_ID), Parameter.I);
        provider.setParameterAddress(parameterAddress);
        binding.addBindingProvider(provider);

        provider.setItem(new SwitchItem("dummie"));
        binding.valueChanged(parameterAddress, ButtonState.PRESSED);
        assertEquals("Update State", OnOffType.ON, publisher.getUpdateState());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.