Tabnine Logo
Device
Code IndexAdd Tabnine to your IDE (free)

How to use
Device
in
ru.iris.common.database.model.devices

Best Java code snippets using ru.iris.common.database.model.devices.Device (Showing top 10 results out of 315)

origin: MrNeuronix/IRISv2

device = new Device();
device.setSource("noolite");
device.setInternalName("noolite/channel/" + channel);
device.setStatus("listening");
device.setType("Noolite Device");
device.setManufName("Nootechnika");
device.setNode((short) (1000 + channel));
device.setUuid(UUID.randomUUID().toString());
  device.setInternalType("switch");
  device.addValue(new DeviceValue("channel", String.valueOf(channel), "", "", device.getUuid(), true));
  device.addValue(new DeviceValue("type", "switch", "", "", device.getUuid(), false));
} else {
  device.setInternalType("sensor");
  device.addValue(new DeviceValue("channel", String.valueOf(channel), "", "", device.getUuid(), true));
  device.addValue(new DeviceValue("type", "sensor", "", "", device.getUuid(), false));
  device.addValue(new DeviceValue("sensorname", sensor.name(), "", "", device.getUuid(), false));
  LOGGER.info("Channel " + channel + ": Got OFF command");
  updateValue(device, "Level", "0");
  DBLogger.info("Device is OFF", device.getUuid());
  SensorData.log(device.getUuid(), "Switch", "OFF");
  if (device.getProductName().equals("unknown")) {
    device.setProductName("Generic Switch");
  messaging.broadcast("event.devices.noolite.value.changed", new GenericAdvertisement("DeviceOff", device.getUuid()));
  break;
origin: MrNeuronix/IRISv2

private void deviceSetLevel(GenericAdvertisement advertisement, Integer level) {
  String label = "Level";
  String uuid;
  if (level == null) {
    level = (Integer) advertisement.getValue("data");
    label = (String) advertisement.getValue("label");
    uuid = (String) advertisement.getValue();
  } else {
    uuid = (String) advertisement.getValue();
  }
  Device ZWaveDevice = Device.getDeviceByUUID(uuid);
  if (ZWaveDevice != null && !ZWaveDevice.getSource().equals("zwave")) {
    // not zwave
    return;
  }
  if (ZWaveDevice == null) {
    LOGGER.info("Cant find device with UUID " + uuid);
    return;
  }
  int node = ZWaveDevice.getNode();
  if (!ZWaveDevice.getStatus().equals("Dead")) {
    LOGGER.info("Setting value: " + level + " to label \"" + label + "\" on node " + node + " (UUID: " + uuid + ")");
    setValue(uuid, label, level);
  } else {
    LOGGER.info("Node: " + node + " Cant set empty value or node dead");
  }
}
origin: MrNeuronix/IRISv2

private void updateValue(Device device, String label, String value) {
  DeviceValue deviceValue = device.getValue(label);
  if (deviceValue == null) {
    deviceValue = new DeviceValue();
    deviceValue.setLabel(label);
    deviceValue.setValue(value);
    deviceValue.setReadonly(false);
    deviceValue.setValueId("{ }");
    device.addValue(deviceValue);
  } else {
    device.setValue(label, value);
  }
}
origin: MrNeuronix/IRISv2

private void setValue(String uuid, String label, Integer value) {
  Device device = Device.getDeviceByUUID(uuid);
  DeviceValue zv = device.getValue(label);
  if (zv != null) {
    if (!Manager.get().isValueReadOnly(gson.fromJson(zv.getValueId(), ValueId.class))) {
      setTypedValue(gson.fromJson(zv.getValueId(), ValueId.class), String.valueOf(value));
    } else {
      LOGGER.info("Value \"%s\" is read-only! Skip.", label);
    }
  }
}
origin: MrNeuronix/IRISv2

ZWaveDevice = new Device();
ZWaveDevice.setInternalType(type);
ZWaveDevice.setSource("zwave");
ZWaveDevice.setInternalName("zwave/" + type + "/" + notification.getNodeId());
ZWaveDevice.setType(Manager.get().getNodeType(notification.getHomeId(), notification.getNodeId()));
ZWaveDevice.setNode(notification.getNodeId());
ZWaveDevice.setUuid(uuid);
ZWaveDevice.setManufName(manufName);
ZWaveDevice.setProductName(productName);
ZWaveDevice.setStatus(state);
ZWaveDevice.addValue(new DeviceValue(
    label,
    uuid,
beaming.setValue(String.valueOf(Manager.get().isNodeBeamingDevice(homeId, ZWaveDevice.getNode())));
beaming.setReadonly(true);
ZWaveDevice.addValue(beaming);
ZWaveDevice.setManufName(manufName);
ZWaveDevice.setProductName(productName);
ZWaveDevice.setStatus(state);
LOGGER.info("Node " + ZWaveDevice.getNode() + ": Add \"" + label + "\" value \"" + Utils.getValue(notification.getValueId()) + "\"");
DeviceValue udv = ZWaveDevice.getValue(label);
origin: MrNeuronix/IRISv2

    data.put("uuid", device.getUuid());
    data.put("label", Manager.get().getValueLabel(notification.getValueId()));
    data.put("data", String.valueOf(Utils.getValue(notification.getValueId())));
device = Device.getDeviceByNode(node);
device.removeValue(manager.getValueLabel(notification.getValueId()));
data.put("uuid", device.getUuid());
data.put("label", Manager.get().getValueLabel(notification.getValueId()));
data.put("data", String.valueOf(Utils.getValue(notification.getValueId())));
  LOGGER.info("Node " + device.getNode() + ": Value " + manager.getValueLabel(notification.getValueId()) + " removed");
device = Device.getDeviceByNode(node);
if (manager.isNodeAwake(homeId, device.getNode()) && device.getStatus().equals("Sleeping")) {
  LOGGER.info("Setting node " + device.getNode() + " to LISTEN state");
  device.setStatus("Listening");
    device.getNode() + ": " +
    "Value for label \"" + manager.getValueLabel(notification.getValueId()) + "\" changed --> " +
    "\"" + Utils.getValue(notification.getValueId()) + "\"");
DeviceValue udvChg = device.getValue(manager.getValueLabel(notification.getValueId()));
  device.removeValue(udvChg);
else
  udvChg = new DeviceValue();
origin: MrNeuronix/IRISv2

  if (device != null && !device.getSource().equals("noolite")) {
    LOGGER.info("Device with UUID " + uuid + " is not Noolite!");
    return;
  channel = Byte.valueOf(device.getValue("channel").getValue());
} else {
  channel = Double.valueOf(advertisement.getValue().toString()).byteValue();
    LOGGER.info("Turn on device on channel " + channel);
    updateValue(device, "Level", "255");
    DBLogger.info("Device is ON", device.getUuid());
    pc.turnOn(channel);
    break;
    LOGGER.info("Turn off device on channel " + channel);
    updateValue(device, "Level", "0");
    DBLogger.info("Device is OFF", device.getUuid());
    pc.turnOff(channel);
    break;
    if (device.getValue("type") != null && device.getValue("type").getValue().contains("dimmer")) {
      if (level > 99 || level == 99) {
        DBLogger.info("Device is ON", device.getUuid());
        DBLogger.info("Device is OFF", device.getUuid());
        DBLogger.info("Device level set: " + level, device.getUuid());
origin: MrNeuronix/IRISv2

if (Manager.get().isNodeFailed(homeId, ZWaveDevice.getNode())) {
  LOGGER.info("Setting node " + ZWaveDevice.getNode() + " to DEAD state");
  ZWaveDevice.setStatus("dead");
  ZWaveDevice.save();
if (!Manager.get().isNodeAwake(homeId, ZWaveDevice.getNode())) {
  LOGGER.info("Setting node " + ZWaveDevice.getNode() + " to SLEEP state");
  ZWaveDevice.setStatus("sleeping");
  Manager.get().refreshNodeInfo(homeId, ZWaveDevice.getNode());
  ZWaveDevice.save();
origin: MrNeuronix/IRISv2

private void updateValue(Device device, String label, String value) {
  DeviceValue deviceValue = device.getValue(label);
  if (deviceValue == null) {
    deviceValue = new DeviceValue();
    deviceValue.setLabel(label);
    deviceValue.setValue(value);
    deviceValue.setReadonly(false);
    deviceValue.setValueId("{ }");
  } else {
    device.setValue(label, value);
  }
}
origin: MrNeuronix/IRISv2

  public static void set(String name, int value) {
    Device device = Ebean.find(Device.class).where().eq("friendlyname", name).findUnique();

    if (device == null) {
      LOGGER.error("Device not found: " + name);
      return;
    }
    if (value == 255)
      messaging.broadcast("event.devices.setvalue", new GenericAdvertisement("DeviceOn", device.getUuid()));
    else
      messaging.broadcast("event.devices.setvalue", new GenericAdvertisement("DeviceOff", device.getUuid()));
  }
}
ru.iris.common.database.model.devicesDevice

Most used methods

  • getUuid
  • <init>
  • addValue
  • getSource
  • getValue
  • save
  • setInternalName
  • setInternalType
  • setManufName
  • setNode
  • setProductName
  • setSource
  • setProductName,
  • setSource,
  • setStatus,
  • setType,
  • setUuid,
  • getDeviceByNode,
  • getDeviceByUUID,
  • getInternalName,
  • getNode,
  • getProductName

Popular in Java

  • Making http post requests using okhttp
  • onCreateOptionsMenu (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • getApplicationContext (Context)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now