ioBroker = Home automation/Node ALL in ONE/ for noobs https +Let's encrypt/MQTT/Node Red/



  • Hello everybody,
    @michai: maybe you jump in and we make a PERFECT solution for everybody!?

    started this prject 2 weeks ago and didn't have time to post it yet. Additionaly came the issue with payload "clearing" which MOD's here resolved in about 24h !!! PERFECT!

    Ma scope was:

    1. "a" Node which i can connect what i want to and with a simple and smalest modifications, can run EVERYTHING! 🙂
    2. it should be cheap!
    3. it should be easy so even me as noob can understand that
      4.it should be a stndard protocol, which can be used with all of teh adapters
    4. it should have updates in the future
      6 can be used with node-red and ioBroker, because everything is integrated there
      7 etc..

    do's and dont's for me:

    1. do not mess with child ID's and PIN's ->Use something easy
    2. show to the server what you have (present) and show what it is!!!! Not just Child ID = 13 -> Send a discription to Server
    3. do it universal, so everybody can use it !!!
    4. Give it to the comunity to improve it !!!

    My steps:

    1. HERE THE USER SHOULD PUT HIS SENSORS IN THE TABLE
      create a table with pins, so if you change configuration you do not have to mess around with PIN's:
      { S_UNUSED,V_UNKNOWN,"RX","MY_SystemPin" },//D0 DO NOT TOUCH
      { S_UNUSED,V_UNKNOWN,"TX","MY_SystemPin" },//D1 DO NOT TOUCH
     ...
      { S_DIMMER,V_PERCENTAGE,"Test PWM","PWM" }, //D7 : PWM?         
      { S_BINARY,V_STATUS,"RELAY D8","RELAY_1S" }, //D8 : PWM?                    
      ...
      { S_DOOR,V_ARMED,"Digital Ein","Schalter" }, //D11 : PWM?     
      { S_UNUSED,V_UNKNOWN,"free pin","tbd" }, //D12 : PWM?     
      { S_DIMMER,V_PERCENTAGE,"Test PWM","PWM" }, //D13 : PWM?     
     ...
      { S_UNUSED,V_UNKNOWN,"LEDS_BLINKING_FEATURE","MY_SystemPin" }, //D16/TX2 :   =ESP8266;
     ... 
      .
    };
    

    you can put all you attached sensors with S-Types and S_Variables

    1. USER does not have to do enything!!!

    present everything (all connected or IF YOU WANT unconnected pins too).
    whole vpid presentation! so just easy and short " i think"

    void presentation()
    {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("MQTTduino by JR", "1.3");
      //all Ports
      for (int i = 0; i<iomodus_count; i++)
      { 
        MyMessage msg(i, iomodus[i].variableType);
    //    Serial.println(iomodus[i].sensorType);
    //    Serial.println(i);
        if (iomodus[i].description != "free pin") 
        {
          present(i, iomodus[i].sensorType, iomodus[i].description, false);
          //Send a et message which shows in controller where Warnings will come
          send(msg.setType(77).set("for Warnings"), false);
        }
      }
    }
    
    1. Setup (just look in samples of MYsensors and you will see if you need it or not
    void setup()
    {
    
      for (int i = 0; i<iomodus_count; i++) //search All Sensor system Ports and set them in the RIGHT way
      {
    
        while (iomodus[i].sensorVersion == "MY_SystemPin") { i++; }  //do not waste time to check MY_SystemPin's
        MyMessage msg(i, iomodus[i].variableType);
    
    //********************************Setup MAX31855*************************************** 
        if ((iomodus[i].description == "MAX31855") && (iomodus[i].sensorVersion == "CL_Ktype"))
        {
          clPin = i;
        }
        if ((iomodus[i].description == "MAX31855") && (iomodus[i].sensorVersion == "SO_Ktype"))
        {
          doPin = i;
        }
    
     //********************************Setup RELAY***************************************     
        if ((iomodus[i].sensorType == S_BINARY) && (iomodus[i].sensorVersion == "RELAY"))
        {
    
          pinMode(i, OUTPUT);
          // Set RELAY to last known state (using eeprom storage) 
          digitalWrite(i, loadState(i) ? RELAY_ON : RELAY_OFF);
    //      send(msg.set(relstate ? RELAY_ON : RELAY_OFF), false);
          send(msg.setSensor(i).set(loadState(i)==HIGH ? 1 : 0),false);
        }
        //********************************Setup FLOWmeter***************************************   
     
        //f=4.8* q( l/min) 450 Impulse/Liter,
        if ((iomodus[i].sensorType == S_WATER) && (iomodus[i].sensorVersion == "IMPULSEcount"))
        {
          if ((PULSEdivider[0] > 0) && (i == 2)) 
          {pinMode(2, INPUT_PULLUP); attachInterrupt(0, ISR_0, FALLING);}
          if ((PULSEdivider[1] > 0) && (i == 3)) 
          {pinMode(3, INPUT_PULLUP); attachInterrupt(1, ISR_1, FALLING);} 
          if ((PULSEdivider[2] > 0) && (i == 21)) 
          {pinMode(21, INPUT_PULLUP); attachInterrupt(2, ISR_2, FALLING);}
          if ((PULSEdivider[3] > 0) && (i == 20)) 
          {pinMode(20, INPUT_PULLUP); attachInterrupt(3, ISR_3, FALLING);}
          if ((PULSEdivider[4] > 0) && (i == 19)) 
          {pinMode(19, INPUT_PULLUP); attachInterrupt(4, ISR_4, FALLING);}
          if ((PULSEdivider[5] > 0) && (i == 18)) 
          {pinMode(18, INPUT_PULLUP); attachInterrupt(5, ISR_5, FALLING);}
        }
        
        //********************************Setup ONEWire***************************************
        if ((iomodus[i].sensorType == S_TEMP) && (iomodus[i].sensorVersion == "DS18B20"))
        { 
          DeviceAddress deviceAddress;
          ds18x20[i].setPin(i);
          sensor[i].setOneWire(&ds18x20[i]);
          // Startup up the OneWire library
          sensor[i].begin();
          if (sensor[i].getAddress(deviceAddress, 0)) sensor[i].setResolution(deviceAddress, 9);
    
        }
        //********************************Setup ANALOG INPUTS for READING VOLTAGE***************************************      
         if ((iomodus[i].sensorType == S_MULTIMETER) && (iomodus[i].sensorVersion == "VOLTAGE") && (i >= 54) && (i <= 69))//handling NTC Sensor
         {pinMode(55, INPUT_PULLUP);}
        
        //********************************Setup NEXT*************************************** 
       
      }
    
    }
    //*********************************************************************************************
    
    
    1. LOOP to check all connected (or if you want ALL ) pins i something happened (value changed)
        //*********************************************************************************************
        // NTC (Analog ONLY) INPUTS ON THE BOARD 
    
        if ((iomodus[i].sensorType == S_TEMP) && (iomodus[i].sensorVersion == "NTC") && (i >= 54) && (i <= 69))//handling NTC Sensor
        {
          if (millis() > next_Time[i])
          {
            next_Time[i] = next_Time[i] + 10000;  //Update Value every 10s 
            Rt = Rv / ((1024.0 / analogRead(i)) - 1.0);
            float tempNTC = (B_wert * Tn / (B_wert + (Tn * log(Rt / Rn)))) - Tn + 25.0 + Temp_offset[i];// Here Offset if needed
            
            if ((tempNTC > (last_float_value[i] + delta_ntc)) || (tempNTC < (last_float_value[i] - delta_ntc))
              || complete_loop)
            {
              //MyMessage msg(i, iomodus[i].variableType);
              Serial.println("tempNTC");
              Serial.println(i);
              Serial.println(tempNTC);
              send(msg.setSensor(i).set(tempNTC, 2), false);
    
              last_float_value[i] = tempNTC;
    
            }
          }
        }
    

    or next example

    //*********************************************************************************************
        // ONEWire with DALLAS
          if ((iomodus[i].sensorType == S_TEMP) && (iomodus[i].sensorVersion == "DS18B20"))
          { if (millis() > next_Time[i])
            {next_Time[i] = next_Time[i] +10000;  //onewire updates every 10s (10s is MINIMUM)
            sensor[i].requestTemperatures();
          // query conversion time and sleep until conversion completed
          //  int16_t conversionTime = sensor[i].millisToWaitForConversion(sensor[i].getResolution());
          // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater)
          wait(500);
          float temperature=sensor[i].getTempCByIndex(0);
        Serial.print("Temperature for the sensor ");
        Serial.print(i);
        Serial.print(" is ");
        Serial.println(temperature);
          
          send(msg.setSensor(i).set(temperature, 2),false);
          last_float_value[i]=temperature;
            }}
    

    will post whole sketch at github if somebody wants!

    Done!



  • you know call me crazy but I have been thinking it is a bit surprising a simple windows/linux/etc GUI has not been made for mysensors. I know I have enjoyed learning to code but it would be nice at times to have a drop down

    select board type
    select devices (dht22, relay,etc)
    select pin device is on
    add option for repeater
    add option for sleep
    add option for wake every xxx minutes and take reading
    hit send



  • I'm honestly torn on making Windows/Linux programs. I certainly get the idea why you would want something like that, but I'd much rather have an HTML5 website that does that instead of an x86 program...

    Web browsers are on everything, whereas the idea of fat binaries is still a very rare one.

    My underlying works revolve in making web APIs, so I can create websites and scripts that can do "stuff" without me even hitting buttons.

    For example, I'd like to have an IoT doorbell. Simple. When it triggers, a flow interrogates if there is anybody in the house. If yes, ring the doorbell. Also, when doorbell is triggered, take a photo from the door and run it through a facial recognizer and send to me.

    ... And that's just a doorbell.



  • Hi,
    I have plans to do some of the same.
    Making some kind of default sensor-node.
    For me, i expect it to have the following attached to all my nodes:

    • Motion sensor
    • Temperature sensor
    • Relay
    • Push/door/window button

    And some other sensors individually as needed.

    I also has in mind to connect most of these to A0-A5 pins in order to have most of the 'usual' digital pins available for more sensors.

    And to set the sensor ID (not child ID) in the sketch and number my boxes with the same ID.
    Then i know which sketch is running at which sensor node.

    And as a last comment, i would create the sketch, so that a sensor only would be processed if the corresponding pin-variable was set.
    That way you could comment out the ones not attached .

    Hope you can use my input and looking forward to hear how you progress.

    Best Regards

    Rene



  • here is the last version of my node... it has everything you "need"...

    http://forum.iobroker.net/viewtopic.php?f=35&t=2084

    Will carry on, when the Dev has finished ioBroker adapter for mysesnosrs...



  • This is great! I love node-red its so easy to use even for non-programmers.

    Maxtox do you maybe know would it be possible to have esp8266 sensor nodes and a esp8266 gateway (so that the protocol would go via wifi). That would be really nice and cheap, and as a controller could be a raspberry pi.



  • [UPDATE]

    It runns PRODUCTIVE incl Heatpump, Solar, Wood stove etc..

    I devidesd INO apart, so it is easyer to read...

    ![http://up.picr.de/25928787et.jpg](image url)

    Included SERIAL1 , SERIAL2, SERIAL3 ...

    0_1466331812830_aufgeteilt.png

    0_1466331943500_serial.png

    ![http://up.picr.de/25928809tr.png](image url)

    My scope was:

    "a" Node which i can connect what i want to and with a simple and smalest modifications, can run EVERYTHING! :-)
    it should be cheap!
    it should be easy so even me as noob can understand that
    4.it should be a standard protocol, which can be used with all of teh adapters
    it should have updates in the future
    6 can be used with node-red and ioBroker, because everything is integrated there
    7 etc..
    

    do's and dont's for me:

    do not mess with child ID's and PIN's ->Use something easy
    show to the server what you have (present) and show what it is!!!! Not just Child ID = 13 -> Send a discription to Server
    do it universal, so everybody can use it !!!
    Give it to the comunity to improve it !!!
    

    My steps:

    HERE THE USER SHOULD PUT HIS SENSORS IN THE TABLE
    create a table with pins, so if you change configuration you do not have to mess around with PIN's:
    

    0_1466331883576_sensoren beschreiben.png

    ![http://up.picr.de/25928677ol.jpg](image url)

    you can put all you attached sensors with S-Types and S_Variables

    USER does not have to do enything!!!
    

    present everything (all connected or IF YOU WANT unconnected pins too).
    whole void presentation! so just easy and short "i think"

    Setup (just look in samples of MYsensors and you will see if you need it or not
    
    void setup()
    {
    	//Serial1.begin(2400);
    	//Serial2.begin(2400);
    	
    	for (int i = 0; i<iomodus_count; i++) //search All Sensor system Ports and set them in the RIGHT way
        {
    		while (iomodus[i].sensorVersion == "MY_SystemPin") { i++; }  //do not waste time to check MY_SystemPin's
    		MyMessage msg(i, iomodus[i].variableType);
    //*************************************************************************************
    //*************************************************************************************
    
    //********************************Setup RELAY***************************************
    		if (iomodus[i].sensorType == S_BINARY)
            {
    #ifdef RELAY
    			if (iomodus[i].sensorVersion == "RELAY")
    			{
    				pinMode(i, OUTPUT);
    				// Set RELAY to last known state (using eeprom storage)
    				digitalWrite(i, loadState(i) ? RELAY_ON : RELAY_OFF);
    				send(msg.setSensor(i).set(loadState(i)==HIGH ? 1 : 0),false);
    			}
    #endif // RELAY
    
    //********************************Setup BUTTON***************************************
    #ifdef BUTTON
    			if (iomodus[i].sensorVersion == "BUTTON")
    			{
    				pinMode(i, INPUT_PULLUP);
    				// Set RELAY to last known state (using eeprom storage)
    				digitalWrite(i, loadState(i) ? 1 : 0);
    				send(msg.setSensor(i).set(loadState(i)==HIGH ? 1 : 0),false);
    			}
    #endif // BUTTON
    		}
    //********************************Setup 0-10V Output***************************************
    #ifdef PWM
    		if (iomodus[i].sensorType == S_DIMMER) 
            {
    			pinMode(i, OUTPUT);
    			// Set RELAY to last known state (using eeprom storage)
    		}
    		
    		....
    

    or next example

    
    void ds18b20_temp(int i)
    {
    #ifdef DS18B20
    	if ((iomodus[i].sensorType == S_TEMP) && (iomodus[i].sensorVersion == "DS18B20"))
        { 	
    		if (millis() > next_Time[i])
            {   
    			next_Time[i] = next_Time[i] + 10000; //onewire updates every 10s (10s is MINIMUM)
    			sensor[i].requestTemperatures();
    			// query conversion time and sleep until conversion completed
    			//  int16_t conversionTime = sensor[i].millisToWaitForConversion(sensor[i].getResolution());
    			// sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater)
    			wait(1000);
        
    			for (int j = 1; j <= dsSensor_count; j++)
    			{
    				if (dsSensor[j].dsonPinNr ==  i)
    				{
    					unsigned int dsPin=(iomodus[i].Int_to_HLP + j);
    					float tempC = sensor[i].getTempC(dsSensor[j].dsAdress);
    					if (tempC == -127.00) 
    					{
    /*            			send(msg.setType(77).set("Error getting temperature"), false);
    						Serial.println("Error getting temperature on Pin");
    						Serial.print(i);
    						Serial.println("MySensors Pin Nr");
    						Serial.print(dsPin);
    						Serial.println("Probe Nr.");
    						Serial.print(j);
    */
    					} 
    					else
    					{
    						MyMessage msg(i, iomodus[i].variableType);
    						send(msg.setSensor(dsPin).set(tempC, 2), false);
    						last_dsTemp[j] = tempC;
        /*        			        Serial.println("C: ");
    						Serial.print(tempC);
    						Serial.println(" F: ");
    						Serial.print(DallasTemperature::toFahrenheit(tempC));
        */        		}
    	//					dsPin=0;
                  
    				}
                        
    			}
            }
    	}
    #endif
    }
    

    !
    Done!
    Libraries here(modified 16.06.2016):

    0_1466331530661_MySensors.zip

    All sketches:
    0_1466331582101_PRODUKTIV_V1.zip



  • and here a video how to use MySensors with ioBroker to CONTROL and get the Information from EVERYWHERE:

    https://www.youtube.com/watch?v=V3cpQ6ZSp2A



  • couple screenshots from the WEB interface ioBroker.web

    0_1466332638261_2016-06-19 12_35_31-ioBroker - AUTOMATION OF EVERYTHING - Arduino, FHEM, Homatic, Raspi - YouTube.png

    0_1466332645272_2016-06-19 12_36_17-ioBroker - AUTOMATION OF EVERYTHING - Arduino, FHEM, Homatic, Raspi - YouTube.png



  • and screenshots from EDIT page of iobroker.flot:

    0_1466343853815_flot edit.png

    and picture of the Page when you click "OPEN":

    0_1466343861824_flot.png

    or if you choose AREA you'll see:

    0_1466344029414_area.png



  • *you know call me crazy but I have been thinking it is a bit surprising a simple windows/linux/etc GUI has not been made for mysensors. I know I have enjoyed learning to code but it would be nice at times to have a drop down

    select board type
    select devices (dht22, relay,etc)
    select pin device is on
    add option for repeater
    add option for sleep
    add option for wake every xxx minutes and take reading
    hit send*

    Node-RED



  • Now i made a video to explain how to use TELEGRAM with iobroker and mysensors

    look here

    https://www.youtube.com/watch?v=iVUI-sJKU_c



  • Hello colleagues,

    i did not forget you ... just a new video showing how to get Let's encrypt certificate in "seconds" without coding etc.. just pressing couple buttons.

    Its possible with ioBroker, look here:

    https://www.youtube.com/watch?v=H9InPtesDOU


Log in to reply
 

Suggested Topics

  • 8
  • 3
  • 1
  • 1
  • 2
  • 7

20
Online

11.4k
Users

11.1k
Topics

112.7k
Posts