lifeemotions / knx.net

KNX.net provides a KNX API for .NET
MIT License
101 stars 47 forks source link

Feedback problem-2 #64

Closed Malexys closed 3 years ago

Malexys commented 3 years ago

The last code I prepared but I could not run it again please help :(

//5/0/8 temp set //5/0/7 current temp. feedback

public void Event(string address, string state) {

        if (address=="5/0/7")
        {
            var temp1 = (decimal)_connection.FromDataPoint("9.001", state);
            txt.Text = "Temperature: " + temp1;
            comboBox1.Items.Add(temp1);

        }
        else if (address=="5/0/7")
        {
            var temp2 = (decimal)_connection.FromDataPoint("9.001", state);
            txt.Text = "Temperature: " + temp2;
        }
        else
        {

        }

        _connection.Disconnect();
    }
    private static KnxConnection _connection;
    private void button7_Click(object sender, EventArgs e)
    {
        _connection = new KnxConnectionRouting { Debug = false, ActionMessageCode = 0x29 };
        _connection.Connect();
        _connection.KnxEventDelegate += new KnxConnection.KnxEvent(Event);
        _connection.KnxStatusDelegate += new KnxConnection.KnxStatus(Event);

        _connection.Action("5/0/8", _connection.ToDataPoint("9.001", 24.0f));

        _connection.Disconnect();

    }