Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95480

Mysensors - Node 10 is unknown

$
0
0

@grossmann wrote:

Hi, I have a long Jeedom experience, but once I’ve seen what HA permits, I decided to switch to HA
I’m a really newbie in HA.
I have a lot of mysensors Nodes, and all the temperatures nodes got to work : they appear in the Entities …
But, I cannot see the other ones : for example, I have a 8 relay switch, which appears nowhere, except in the logs :

2020-03-23 12:38:52 ERROR (MainThread) [mysensors.handler] Node 10 is unknown, will not add child 1
2020-03-23 12:38:52 DEBUG (MainThread) [mysensors.handler] n:0 c:255 t:3 s:9 p:154361 TSF:MSG:READ,10-10-0,s=2,c=0,t=3,pt=0,l=0,sg=0:

The sketch is this one :

#define MY_DEBUG 
#define MY_RADIO_NRF24
#define MY_REPEATER_FEATURE
#define MY_NODE_ID 10

#include <SPI.h>
#include <MySensors.h>

#define RELAY_1  3  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
#define NUMBER_OF_RELAYS 4 // Total number of attached relays
#define RELAY_ON 0  // GPIO value to write to turn on attached relay
#define RELAY_OFF 1 // GPIO value to write to turn off attached relay
#include <DallasTemperature.h>
#include <OneWire.h>
#define ONE_WIRE_BUS 7 // Pin where dallas sensor is connected
#define MAX_ATTACHED_DS18B20 1
#define TEMPERATURE_PRECISION 12

unsigned long SLEEP_TIME = 60000L*10L; // Sleep time between reads (in milliseconds)  10 MINUTES
  
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
DeviceAddress tempDeviceAddress; // We'll use this variable to store a found device address
float lastTemperature;
int numSensors=0;
unsigned long prevMillis=0;
boolean receivedConfig = false;
boolean metric = true;
MyMessage tempMsg(0,V_TEMP);



void before() { 
  // Startup up the OneWire library
  sensors.begin();
  
  for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS;sensor++, pin++) {
    // Then set relay pins in output mode
    pinMode(pin, OUTPUT);    
    digitalWrite(pin, RELAY_OFF);
  }
}

void setup() {
    // requestTemperatures() will not block current thread
  sensors.setWaitForConversion(false);
  analogReference(INTERNAL);
  if(sensors.getAddress(tempDeviceAddress, 0))   //0 car 1ère sonde DS18B20 trouvée
      {
        Serial.print("Device found: ");
        Serial.println(TEMPERATURE_PRECISION, DEC);
        sensors.setResolution(tempDeviceAddress, TEMPERATURE_PRECISION);
      } else {
        Serial.print("Found ghost device at ");
        Serial.print(1, DEC);
        Serial.print(" but could not detect address. Check power and cabling");
      }
}

void presentation()  
{   
  // Send the sketch version information to the gateway and Controller
  sendSketchInfo("VoletsNodeGrenier", "1.0");
  wait(2000);   //Nécessaire ????

    // Fetch the number of attached temperature sensors  
  numSensors = sensors.getDeviceCount();

  // Present all sensors to controller
  for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {   
     present(i, S_TEMP);
  }

  //for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS;sensor++, pin++) {
  for (int sensor=1, pin=RELAY_1; sensor<=10;sensor++, pin++) {
    // Register all sensors to gw (they will be created as child devices)
    present(sensor, S_LIGHT);
  }
}


void loop() 
{
  unsigned long currMillis=millis();
  if (currMillis-prevMillis>=SLEEP_TIME)  {
      prevMillis=currMillis; // update
      sensors.requestTemperatures();
      // Fetch and round temperature to one decimal
      float temperature = static_cast<float>(static_cast<int>(sensors.getTempCByIndex(0) * 10.)) / 10.;
      if (lastTemperature != temperature && temperature != -127.00 && temperature != 85.00) {
          send(tempMsg.setSensor(0).set(temperature,1));
          lastTemperature=temperature;
      }
  }
  
}

  


void receive(const MyMessage &message) {
  if (message.type==V_LIGHT) {
     Serial.print("Incoming change for sensor:");
     Serial.print(message.sensor);
     Serial.print(", New status: ");
     Serial.println(message.getBool());
     //Ouverture/fermeture simple - 1 seconde appui
     if (message.sensor<=4) {
        digitalWrite(message.sensor-1+RELAY_1, RELAY_ON);     
        delay(500);
        digitalWrite(message.sensor-1+RELAY_1, RELAY_OFF);
     }
     //Ouverture/fermeture longue - 5 secondes appui
     if ((message.sensor>4) and (message.sensor<=8)) {
        digitalWrite(message.sensor-5+RELAY_1, RELAY_ON);     
        delay(5000);
        digitalWrite(message.sensor-5+RELAY_1, RELAY_OFF);
     }
          //Ouverture/fermeture longue - 5 secondes appui
     //STOP Volets roulants 1 
     if (message.sensor==9) {
        digitalWrite(RELAY_1, RELAY_ON);
        digitalWrite(RELAY_1+1, RELAY_ON);     
        delay(200);
        digitalWrite(RELAY_1, RELAY_OFF);
        digitalWrite(RELAY_1+1, RELAY_OFF);
     }
     //STOP Volets roulants 2 
     if (message.sensor==10) {
        digitalWrite(RELAY_1+2, RELAY_ON);
        digitalWrite(RELAY_1+3, RELAY_ON);     
        delay(200);
        digitalWrite(RELAY_1+2, RELAY_OFF);
        digitalWrite(RELAY_1+3, RELAY_OFF);
     }

   } 
}

Here the part of my config file :

mysensors:
  gateways:
    - device: '/dev/ttyUSB0'
      nodes:
        67:
          name: 'Citerneo'
        10:
          name: 'Grenier'
        40:
          name: 'Piscine' 
        2:
          name: 'Parents'
          
  debug: true
  persistence: true
  optimistic: true

I have no switch.yaml file. I don’t know why : it is a new install. I really need help …

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 95480

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>