Hello, i have Trobble with the quantity of Sensors.
But the first, sorry for my English, its not the best.
Some keydata,
Motherboard: Ardoino UNO
Ethernetshield: W5100
Use D18B20 Temperature sensor
So: When i take more than 11 sensors outside from the //, than the void setup become like a loop and tcp to my homeassistant don´t work!
When i take Sensor 1 in the // and take the 12 outside from the // ,than the program makes what i want. So i think i cant´t use more than 11 Sensors...
I hope somebody can help me, and thanks
Now the Skript:
______________________________________________________________________________________________________________________________________________________________
// Enable debug prints to serial monitor
#define MY_DEBUG
// Enable and select radio type attached
//#define MY_RADIO_RF24
//#define MY_RADIO_NRF5_ESB
//#define MY_RADIO_RFM69
//#define MY_RADIO_RFM95
// Enable gateway ethernet module type
#define MY_GATEWAY_W5100
// W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal)
//#define MY_W5100_SPI_EN 4
// Enable Soft SPI for NRF radio (note different radio wiring is required)
// The W5100 ethernet module seems to have a hard time co-operate with
// radio on the same spi bus.
#if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD)
#define MY_SOFTSPI
#define MY_SOFT_SPI_SCK_PIN 14
#define MY_SOFT_SPI_MISO_PIN 16
#define MY_SOFT_SPI_MOSI_PIN 15
#endif
// When W5100 is connected we have to move CE/CSN pins for NRF radio
#ifndef MY_RF24_CE_PIN
#define MY_RF24_CE_PIN 5
#endif
#ifndef MY_RF24_CS_PIN
#define MY_RF24_CS_PIN 6
#endif
// Enable UDP communication
//#define MY_USE_UDP // If using UDP you need to set MY_CONTROLLER_IP_ADDRESS or MY_CONTROLLER_URL_ADDRESS below
// Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
#define MY_IP_ADDRESS 192,168,178,66
// If using static ip you can define Gateway and Subnet address as well
//#define MY_IP_GATEWAY_ADDRESS 192,168,178,1
//#define MY_IP_SUBNET_ADDRESS 255,255,255,0
// Renewal period if using DHCP
//#define MY_IP_RENEWAL_INTERVAL 60000
// The port to keep open on node server mode / or port to contact in client mode
#define MY_PORT 5003
// Controller ip address. Enables client mode (default is "server" mode).
// Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
//#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254
//#define MY_CONTROLLER_URL_ADDRESS "my.controller.org"
// The MAC address can be anything you want but should be unique on your network.
// Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
// Note that most of the Arduino examples use "DEAD BEEF FEED" for the MAC address.
#define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
// Enable inclusion mode
#define MY_INCLUSION_MODE_FEATURE
// Enable Inclusion mode button on gateway
//#define MY_INCLUSION_BUTTON_FEATURE
// Set inclusion mode duration (in seconds)
#define MY_INCLUSION_MODE_DURATION 60
// Digital pin used for inclusion mode button
//#define MY_INCLUSION_MODE_BUTTON_PIN 3
// Set blinking period
#define MY_DEFAULT_LED_BLINK_PERIOD 300
// Flash leds on rx/tx/err
// Uncomment to override default HW configurations
//#define MY_DEFAULT_ERR_LED_PIN 7 // Error led pin
//#define MY_DEFAULT_RX_LED_PIN 8 // Receive led pin
//#define MY_DEFAULT_TX_LED_PIN 9 // Transmit led pin
#if defined(MY_USE_UDP)
#include <EthernetUdp.h>
#endif
#include <Ethernet.h>
#include <MySensors.h>
//Temperatur
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 3 // alle Temperaturfühler an PIN 10
#define TEMPERATURE_PRECISION 9
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
float Temperatur[15]; // Vorgabe der Maximalen Sensoren
//Temperaturfühleradressen
DeviceAddress Sensor1 = {0x28, 0xFF, 0x64, 0x1F, 0x57, 0xF0, 0xF5, 0x37}; //S1Kessel
DeviceAddress Sensor2 = {0x28, 0xFF, 0x64, 0x1F, 0x57, 0xD7, 0x09, 0x4F}; //S2Kessel
DeviceAddress Sensor3 = {0x28, 0xFF, 0x64, 0x1F, 0x57, 0xE4, 0xBF, 0xD8}; //S3Kessel
DeviceAddress Sensor4 = {0x28, 0xFF, 0x64, 0x1F, 0x57, 0xE4, 0x5D, 0x8D}; //S4Kessel
DeviceAddress Sensor5 = {0x28, 0xFF, 0x64, 0x1F, 0x57, 0xD7, 0x98, 0x00}; //S5HVL
DeviceAddress Sensor6 = {0x28, 0xFF, 0x64, 0x1F, 0x57, 0xDB, 0x11, 0x5D}; //S6HRL
DeviceAddress Sensor7 = {0x28, 0xFF, 0x64, 0x1F, 0x57, 0xE4, 0x18, 0xF4}; //S7WP1VL
DeviceAddress Sensor8 = {0x28, 0xFF, 0x64, 0x1F, 0x57, 0xC1, 0x30, 0x2B}; //S8WP1RL
DeviceAddress Sensor9 = {0x28, 0xFF, 0x64, 0x1F, 0x57, 0xC7, 0x3C, 0x22}; //S9WP2VL
DeviceAddress Sensor10 = {0x28, 0xFF, 0x64, 0x1F, 0x57, 0xC4, 0xEC, 0x20}; //S10WP2RL
DeviceAddress Sensor11 = {0x28, 0xFF, 0x64, 0x1F, 0x57, 0xDB, 0x11, 0x5D}; //S11GHVL
DeviceAddress Sensor12 = {0x28, 0xFF, 0x64, 0x1F, 0x57, 0xE4, 0x18, 0xF4}; //S12GHRL
DeviceAddress Sensor13 = {0x28, 0xFF, 0x64, 0x1F, 0x57, 0xC1, 0x30, 0x2B}; //S13WP1ZL
DeviceAddress Sensor14 = {0x28, 0xFF, 0x64, 0x1F, 0x57, 0xE4, 0xBF, 0xD8}; //S14WP1AL
//DeviceAddress Sensor15 = {0x28, 0xAA, 0x3D, 0xB4, 0x4F, 0x14, 0x01, 0x9D}; //
void setup()
{
//Sensor 1
sensors.setResolution(Sensor1, TEMPERATURE_PRECISION);
Serial.print(F("Temperatursensor 1 Resolution: "));
sensors.requestTemperatures();// Temperatur wird ermittelt
Temperatur[1] = sensors.getTempC(Sensor1);
Serial.print(sensors.getResolution(Sensor1), DEC);
Serial.print(F( " "));
Serial.print(Temperatur[1]);
Serial.println(F(" °C"));
//Sensor 2
sensors.setResolution(Sensor2, TEMPERATURE_PRECISION);
Serial.print(F("Temperatursensor 2 Resolution: "));
sensors.requestTemperatures();// Temperatur wird ermittelt
Temperatur[2] = sensors.getTempC(Sensor2);
Serial.print(sensors.getResolution(Sensor2), DEC);
Serial.print(F( " "));
Serial.print(Temperatur[2]);
Serial.println(F(" °C"));
//Sensor 3
sensors.setResolution(Sensor3, TEMPERATURE_PRECISION);
Serial.print(F("Temperatursensor 3 Resolution: "));
sensors.requestTemperatures();// Temperatur wird ermittelt
Temperatur[3] = sensors.getTempC(Sensor3);
Serial.print(sensors.getResolution(Sensor3), DEC);
Serial.print(F( " "));
Serial.print(Temperatur[3]);
Serial.println(F(" °C"));
//Sensor 4
sensors.setResolution(Sensor4, TEMPERATURE_PRECISION);
Serial.print(F("Temperatursensor 4 Resolution: "));
sensors.requestTemperatures();// Temperatur wird ermittelt
Temperatur[4] = sensors.getTempC(Sensor4);
Serial.print(sensors.getResolution(Sensor4), DEC);
Serial.print(F( " "));
Serial.print(Temperatur[4]);
Serial.println(F(" °C"));
//Sensor 5
sensors.setResolution(Sensor5, TEMPERATURE_PRECISION);
Serial.print(F("Temperatursensor 5 Resolution: "));
sensors.requestTemperatures();// Temperatur wird ermittelt
Temperatur[5] = sensors.getTempC(Sensor5);
Serial.print(sensors.getResolution(Sensor5), DEC);
Serial.print(F( " "));
Serial.print(Temperatur[5]);
Serial.println(F(" °C"));
//Sensor 6
sensors.setResolution(Sensor6, TEMPERATURE_PRECISION);
Serial.print(F("Temperatursensor 6 Resolution: "));
sensors.requestTemperatures();// Temperatur wird ermittelt
Temperatur[6] = sensors.getTempC(Sensor6);
Serial.print(sensors.getResolution(Sensor6), DEC);
Serial.print(F( " "));
Serial.print(Temperatur[6]);
Serial.println(F(" °C"));
//Sensor 7
sensors.setResolution(Sensor7, TEMPERATURE_PRECISION);
Serial.print(F("Temperatursensor 7 Resolution: "));
sensors.requestTemperatures();// Temperatur wird ermittelt
Temperatur[7] = sensors.getTempC(Sensor7);
Serial.print(sensors.getResolution(Sensor7), DEC);
Serial.print(F( " "));
Serial.print(Temperatur[7]);
Serial.println(F(" °C"));
//Sensor 8
sensors.setResolution(Sensor8, TEMPERATURE_PRECISION);
Serial.print(F("Temperatursensor 8 Resolution: "));
sensors.requestTemperatures();// Temperatur wird ermittelt
Temperatur[8] = sensors.getTempC(Sensor8);
Serial.print(sensors.getResolution(Sensor8), DEC);
Serial.print(F( " "));
Serial.print(Temperatur[8]);
Serial.println(F(" °C"));
//Sensor 9
sensors.setResolution(Sensor9, TEMPERATURE_PRECISION);
Serial.print(F("Temperatursensor 9 Resolution: "));
sensors.requestTemperatures();// Temperatur wird ermittelt
Temperatur[9] = sensors.getTempC(Sensor9);
Serial.print(sensors.getResolution(Sensor9), DEC);
Serial.print(F( " "));
Serial.print(Temperatur[9]);
Serial.println(F(" °C"));
//Sensor 10
sensors.setResolution(Sensor10, TEMPERATURE_PRECISION);
Serial.print(F("Temperatursensor 10 Resolution: "));
sensors.requestTemperatures();// Temperatur wird ermittelt
Temperatur[10] = sensors.getTempC(Sensor10);
Serial.print(sensors.getResolution(Sensor10), DEC);
Serial.print(F( " "));
Serial.print(Temperatur[10]);
Serial.println(F(" °C"));
//Sensor 11
sensors.setResolution(Sensor11, TEMPERATURE_PRECISION);
Serial.print(F("Temperatursensor 11 Resolution: "));
sensors.requestTemperatures();// Temperatur wird ermittelt
Temperatur[11] = sensors.getTempC(Sensor11);
Serial.print(sensors.getResolution(Sensor11), DEC);
Serial.print(F( " "));
Serial.print(Temperatur[11]);
Serial.println(F(" °C"));
//Sensor 12
sensors.setResolution(Sensor12, TEMPERATURE_PRECISION);
Serial.print(F("Temperatursensor 12 Resolution: "));
sensors.requestTemperatures();// Temperatur wird ermittelt
Temperatur[12] = sensors.getTempC(Sensor12);
Serial.print(sensors.getResolution(Sensor12), DEC);
Serial.print(F( " "));
Serial.print(Temperatur[12]);
Serial.println(F(" °C"));
//Sensor 13
sensors.setResolution(Sensor13, TEMPERATURE_PRECISION);
Serial.print(F("Temperatursensor 13 Resolution: "));
sensors.requestTemperatures();// Temperatur wird ermittelt
Temperatur[13] = sensors.getTempC(Sensor13);
Serial.print(sensors.getResolution(Sensor13), DEC);
Serial.print(F( " "));
Serial.print(Temperatur[13]);
Serial.println(F(" °C"));
//Sensor 14
sensors.setResolution(Sensor14, TEMPERATURE_PRECISION);
Serial.print(F("Temperatursensor 14 Resolution: "));
sensors.requestTemperatures();// Temperatur wird ermittelt
Temperatur[14] = sensors.getTempC(Sensor14);
Serial.print(sensors.getResolution(Sensor14), DEC);
Serial.print(F( " "));
Serial.print(Temperatur[14]);
Serial.println(F(" °C"));
#define CHILD_ID_1 1
#define CHILD_ID_2 2
#define CHILD_ID_3 3
#define CHILD_ID_4 4
#define CHILD_ID_5 5
#define CHILD_ID_6 6
#define CHILD_ID_7 7
#define CHILD_ID_8 8
#define CHILD_ID_9 9
#define CHILD_ID_10 10
#define CHILD_ID_11 11
#define CHILD_ID_12 12
#define CHILD_ID_13 13
#define CHILD_ID_14 14
}
void presentation()
{
// Send the sketch info to the gateway
sendSketchInfo("Wärmespeicher", "1.0");
present(CHILD_ID_1, S_TEMP, "Stufe 1");
present(CHILD_ID_2, S_TEMP, "Stufe 2");
present(CHILD_ID_3, S_TEMP, "Stufe 3");
present(CHILD_ID_4, S_TEMP, "Stufe 4");
present(CHILD_ID_5, S_TEMP, "Haus Vorlauf");
present(CHILD_ID_6, S_TEMP, "Haus Rücklauf");
present(CHILD_ID_7, S_TEMP, "Wärmepumpe 1 Vorlauf");
present(CHILD_ID_8, S_TEMP, "Wärmepumpe 1 Rücklauf");
present(CHILD_ID_9, S_TEMP, "Wärmepumpe 2 Vorlauf");
present(CHILD_ID_10, S_TEMP, "Wärmepumpe 2 Rücklauf");
present(CHILD_ID_11, S_TEMP, "Gasheizung Vorlauf");
present(CHILD_ID_12, S_TEMP, "Gasheizung Rücklauf");
present(CHILD_ID_13, S_TEMP, "Wärmepumpe 1 Zuluft");
present(CHILD_ID_14, S_TEMP, "Wärmepumpe 1 Abluft");
//15 nicht belegt
}
void loop()
{
sensors.requestTemperatures();// Temperatur wird ermittelt
Temperatur[1] = sensors.getTempC(Sensor1);
Temperatur[2] = sensors.getTempC(Sensor2);
Temperatur[3] = sensors.getTempC(Sensor3);
Temperatur[4] = sensors.getTempC(Sensor4);
Temperatur[5] = sensors.getTempC(Sensor5);
Temperatur[6] = sensors.getTempC(Sensor6);
Temperatur[7] = sensors.getTempC(Sensor7);
Temperatur[8] = sensors.getTempC(Sensor8);
Temperatur[9] = sensors.getTempC(Sensor9);
Temperatur[10] = sensors.getTempC(Sensor10);
Temperatur[11] = sensors.getTempC(Sensor11);
Temperatur[12] = sensors.getTempC(Sensor12);
Temperatur[13] = sensors.getTempC(Sensor13);
Temperatur[14] = sensors.getTempC(Sensor14);
static MyMessage msg_S1(CHILD_ID_1, V_TEMP);
static MyMessage msg_S2(CHILD_ID_2, V_TEMP);
static MyMessage msg_S3(CHILD_ID_3, V_TEMP);
static MyMessage msg_S4(CHILD_ID_4, V_TEMP);
static MyMessage msg_S5(CHILD_ID_5, V_TEMP);
static MyMessage msg_S6(CHILD_ID_6, V_TEMP);
static MyMessage msg_S7(CHILD_ID_7, V_TEMP);
static MyMessage msg_S8(CHILD_ID_8, V_TEMP);
static MyMessage msg_S9(CHILD_ID_9, V_TEMP);
static MyMessage msg_S10(CHILD_ID_10, V_TEMP);
static MyMessage msg_S11(CHILD_ID_11, V_TEMP);
//static MyMessage msg_S12(CHILD_ID_12, V_TEMP);
//static MyMessage msg_S13(CHILD_ID_13, V_TEMP);
//static MyMessage msg_S14(CHILD_ID_14, V_TEMP);
send(msg_S1.set(Temperatur[1], 1));
send(msg_S2.set(Temperatur[2], 1));
send(msg_S3.set(Temperatur[3], 1));
send(msg_S4.set(Temperatur[4], 1));
send(msg_S5.set(Temperatur[5], 1));
send(msg_S6.set(Temperatur[6], 1));
send(msg_S7.set(Temperatur[7], 1));
send(msg_S8.set(Temperatur[8], 1));
send(msg_S9.set(Temperatur[9], 1));
send(msg_S10.set(Temperatur[10], 1));
send(msg_S11.set(Temperatur[11], 1));
//send(msg_S12.set(Temperatur[12], 1));
//send(msg_S13.set(Temperatur[13], 1));
//send(msg_S14.set(Temperatur[14], 1));
}