private void CreateOrUpdateSensor(Sensor sensor)
        {
            MySensorsNodeOutput output = GetMySensorsNodeOutput(sensor);

            if (output == null)
            {
                MySensorsNode node = GetMySensorsNode(sensor.nodeId);
                node.AddInputAndOutput(sensor);
                engine.UpdateNodeInEditor(node);
                engine.UpdateNodeInDb(node);
            }
            else
            {
                engine.UpdateOutput(output.Id, sensor.state, sensor.GetSimpleName3());
            }
        }
Exemplo n.º 2
0
        public void AddInputAndOutput(Sensor sensor)
        {
            MySensorsNodeInput input = new MySensorsNodeInput {
                Name = sensor.sensorId.ToString()
            };

            input.sensorId  = sensor.sensorId;
            input.nodeId    = sensor.nodeId;
            input.SlotIndex = sensor.sensorId;
            AddInput(input);

            MySensorsNodeOutput output = new MySensorsNodeOutput {
                Name = sensor.GetSimpleName3()
            };

            output.sensorId = sensor.sensorId;
            output.nodeId   = sensor.nodeId;
            //todo output.Value = sensor.state;
            output.SlotIndex = sensor.sensorId;
            AddOutput(output);
        }
Exemplo n.º 3
0
        public void AddInputAndOutput(Sensor sensor)
        {
            MySensorsNodeInput input = new MySensorsNodeInput { Name = sensor.sensorId.ToString() };
            input.sensorId = sensor.sensorId;
            input.nodeId = sensor.nodeId;
            input.SlotIndex = sensor.sensorId;
            AddInput(input);

            MySensorsNodeOutput output = new MySensorsNodeOutput { Name = sensor.GetSimpleName3() };
            output.sensorId = sensor.sensorId;
            output.nodeId = sensor.nodeId;
            //todo output.Value = sensor.state;
            output.SlotIndex = sensor.sensorId;
            AddOutput(output);
        }