Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. mikee
    3. Posts
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Posts made by mikee

    • RE: Irrigation Controller ... how to achieve controll from smartphone?

      For the best use of the project you have been looking at, and if you are considering building a controller, surely the vera is the right choice.
      There are some limitations with other controllers, but if you read that topic you know that issues already šŸ™‚

      posted in Development
      mikee
      mikee
    • RE: Irrigation Controller (up to 16 valves with Shift Registers)

      Hi @dbemowsk , Thanks for your reply. I had to reinstall Arduino IDE and all Libraries from my PC. I was fighting with ā€ž'POSITIVE' was not declared in this scopeā€œ error, and installed over 6 Libraries for LCD. I got finally working the sketch for Vera from Mysensors/build, at least .
      Unfortunately I’m not able to modify Sketch witch are guys using with Domoticz in this Topic.
      Is there a way to get missing variables into Irrigation controller from domoticz or at least to set them manually in sketch? For me is enough one watering time for all valves.

      posted in My Project
      mikee
      mikee
    • RE: Irrigation Controller (up to 16 valves with Shift Registers)

      Hi guys, I’m trying 2 days to compile this sketch for Domoticz. Still getting errors ones from library then from code...
      Can someone share with me his working code for Domoticz in 2.0 version? Thanks a lot

      posted in My Project
      mikee
      mikee
    • RE: Cannot run MySensors on RPI 3

      I had same problem (but on serial GW). It started after I removed IRQ connector. I was able to add devices (using Domoticz as controller) , bust after few hours it stops to work.

      posted in Troubleshooting
      mikee
      mikee
    • RE: Are folks here happy with Domoticz?

      Im on Domoticz since 2015. Running with Mysensors, Rflink(433MHz sensors), HA-Bridge (Amazon Echo), Broadlink (IR, 433MHz). Iwas looking at HA months ago - UI looks better, but then I installed Dashticz and my only problem was solved šŸ™‚

      posted in Domoticz
      mikee
      mikee
    • RE: Gasmeter accuracy

      Oh thanks everybody, I'll try it today.

      posted in Hardware
      mikee
      mikee
    • RE: Gasmeter accuracy

      No debounce function in sketch. Im just looking for some examples. Is the best (only) way to do it trough debounce.h library?
      Thanks gohan

      posted in Hardware
      mikee
      mikee
    • Gasmeter accuracy

      Hi Guys,
      I have a MS gas meter based on Water meter sketch measuring on BK-G4T gas meter. I am using Mader reed switch. During winter my readings were corresponding with analog scale on gas meter (I had 6-12m3/day - heating, Hot water and cooking). But now in summer (Cooking, hot water) I am getting 0,5 - 4m3/day but real consumption is only ca.0,3-0,5 m3 a day. Has anyone idea how to correct this or what causes the problem ? Is the magnet (on analog gas meter scale) stuck in some position causing it?
      Thanks

      posted in Hardware
      mikee
      mikee
    • Home ventilation filter status - Pressure sensor MPX2010DP

      Hi Guys,
      Is there any way to integrate difference pressure sensor MPX2010DP into mysensors? Did somebody played already with this sensor?
      Or is there some better way - sensor to measure filter pollution in ventilation system, integrable into mysensors ?

      http://www.ebay.com/itm/MPX2010DP-Pressure-Sensor-ORIGINAL-Brand-New-Freescale-/191895335550?hash=item2cadda727e:g:VkcAAOSwOVpXXjbT

      posted in My Project
      mikee
      mikee
    • RE: [newbie] Using nRF24L0 (2,4Ghz) or RFM69 (433Mhz)?

      +1 for RFM(433Mhz)
      I“m already running NRF and keeping it (have build many nodes on it). But, for example I have a garage (steel structure with sheet-metal paneling) and its ca.6 meters from NRF gateway - no signal! Same distance RFlink (433Mhz) works just fine.

      posted in General Discussion
      mikee
      mikee
    • RE: wireless door / window sensor

      Most of these cheap sensors are based on PT2622 chip or similar. RF link works fine with them.

      posted in Hardware
      mikee
      mikee
    • RE: Analog power meter reading TCRT 5000

      Thanks Guys!
      I have edit the sketch and modified the sensor. Records made during night are finally closer to real situation. I need to correct pulse count.
      @karlheinz2000 - are you using digital or analog output as on FHEM forum? (Danke, fuer Deine Anweisung)

      posted in My Project
      mikee
      mikee
    • RE: Analog power meter reading TCRT 5000

      Yes I“m using example sketch. So my interval could be up to the fastest theoretical revolution ?

      posted in My Project
      mikee
      mikee
    • Analog power meter reading TCRT 5000

      Hi Guys,
      Does somebody have working pulse meter with TCRT5000 on analog power meter (Aluminum rotating wheel). I“m fighting with it right now and I need some help. Do I need to modify the sketch? I“ve adjusted pulse count according to power meter specs. The sensor is on all the time (while white / Al part of wheel) and turns off during the black part of wheel. During on time sends the sensor loooot of impulses, so I had my consumption up to 300 kWh a day and usage up to 100kW. Had someone same issue? Thanks a lot

      posted in My Project
      mikee
      mikee
    • RE: Another beginner project

      Exactly, different GWs, different Frequency and protocols.

      posted in My Project
      mikee
      mikee
    • RE: Another beginner project

      I've gone same route as you are starting. After all I'm at Domoticz + MS gateway + RFlink. Works beautifully.

      posted in My Project
      mikee
      mikee
    • RE: livolo Glass Panel Touch Light Wall Switch + arduino 433Mhz

      Hi, check domoticz forum, there are some infos too.

      posted in My Project
      mikee
      mikee
    • RE: RFID Garage door opener

      Great Job @BartE , Homer must be proud šŸ˜Ž

      posted in My Project
      mikee
      mikee
    • RE: Auto beamerscreen with Arduno

      I“v done this for my friend while ago, only he had motorized screen already installed. But building screen is no problem as well. Use some tube motor - has build in end stops, and they are easy to adjust.
      Automation part depends on your projector - if you have trigger or no (newer does). You can use trigger signal to control screen without arduino trough relay. Check trigger current and better divide both circuits.
      More complex, but more fun is to use arduino + relay board. I did it this way, and added control of cabinet door (in which is projector located ). Arduino is also controlling temperature of Projector, and protect it from overheating in cabinet.

      posted in Hardware
      mikee
      mikee
    • RE: RPI2 Pimatic MySensors getting started

      PRI - Controller to manage sensors, store data... - need to install some software
      +
      Arduino with gateway sketch (GW) - best to use nano - has uUSB
      +
      NRF - conected to arduino
      .
      .
      .
      .
      Arduino (based on purpose - mini, uno, mega) with senor sketch
      +
      NRF conected to arduino

      posted in Troubleshooting
      mikee
      mikee
    • RE: Parking Sensor

      Really cool project, IĀ“m ordering today šŸ™‚

      posted in My Project
      mikee
      mikee
    • RE: Supernoob question :)

      I have seen some installation tutorial in Domoticz wiki, for sure on Synology, not sure if on Qnap - check that.

      posted in Controllers
      mikee
      mikee
    • RE: Scene Controller problem

      I had same problem with mega (clone) - tried to program relay and temp node on mega - all over "check wire", and when i switched to uno did compile.

      posted in Troubleshooting
      mikee
      mikee
    • RE: Alternative to RFXcom (433 MHz) ?

      Halo @Stuntteam ,
      I red all from nemcon site, and couldn't wait to start with it. I do have a Mega at home and I do have plenty of RX/TX lying around. Unfortunately its cheap Chinese stuff and I spent few hours trying to receive some working signal 😁 Today I ordered exactly same RX as mentioned in nodo e shop. I'm really excited, you did great job.
      Question: I was looking on PCB in eshop, and I was wondering about the NRF (you just explained it ), and i saw just receiver - no transmitter. I'm I right, or is it there?
      Thanks for your work guys!!!

      posted in Hardware
      mikee
      mikee
    • RE: New house - help me getting started!

      First of all choose if you want to go wire or wireless.
      But even by wireless (433, 868, z-wave, enocean, zigbee, 2,4Ghz...) you might need power lines for motors, actuators, pumps, blinds...
      First of all write down what all you want to control, and based on this list try find the best system. I would go with wired system on beginning, and add wireless stuff for unreachable or outside controlled parts.

      posted in General Discussion
      mikee
      mikee
    • Alternative to RFXcom (433 MHz) ?

      Hi, Dutch guys, does somebody have experience with this?
      http://www.nodo-shop.nl/nl/home/118-rflink-bouwpakket.html
      Cant read it, and German description is not completely.
      Thx

      posted in Hardware
      mikee
      mikee
    • RE: Temp and Relay node

      Hi @AWI , I have 5 DS 18b20s , i chose CHILD ID 6 because of that , so I“m gonna lower max . temp sensor No.
      Witch line in sketch is duplicity of relay presentation (sorry for dumb questions),
      Thanks so much

      posted in Domoticz
      mikee
      mikee
    • RE: Temp and Relay node

      HI, @AWI I tried

      gw.begin(incomingMessage, AUTO, false);
      

      and then

      gw.begin(incomingMessage, NODE_ID);
      

      After I changed #define RELAY_CHILD 0 to 6 and once (one of many tries) I turned it on, but couldn’t turn it off. In serial monitor of node is no command to switch visible.

      #include <MySensor.h>  
      #include <SPI.h>
      #include <DallasTemperature.h>
      #include <OneWire.h>
      #define NODE_ID 19
      #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected 
      #define MAX_ATTACHED_DS18B20 16
      //Relay 
      #define RELAY_PIN  5  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
      #define RELAY_CHILD 0
      #define NUMBER_OF_RELAYS 1 // Total number of attached relays
      #define RELAY_ON 1  // GPIO value to write to turn on attached relay
      #define RELAY_OFF 0 // GPIO value to write to turn off attached relay
      
      //unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
      OneWire oneWire(ONE_WIRE_BUS);
      DallasTemperature sensors(&oneWire);
      MySensor gw;
      float lastTemperature[MAX_ATTACHED_DS18B20];
      int numSensors=0;
      boolean receivedConfig = false;
      boolean metric = true; 
      // Initialize temperature message
      MyMessage msgT(0,V_TEMP);
      MyMessage msg(RELAY_CHILD,V_LIGHT);
      
      
      void setup()  
      { 
        // Startup OneWire 
        sensors.begin();
        // requestTemperatures() will not block current thread
        sensors.setWaitForConversion(false);
      
        // Startup and initialize MySensors library. Set callback for incoming messages. 
        gw.begin(incomingMessage, AUTO, false); 
      
        // Send the sketch version information to the gateway and Controller
        gw.sendSketchInfo("Temperature Sensor w relay", "1.0");
      
        // 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++) {   
           gw.present(i, S_TEMP);
           gw.present(RELAY_CHILD, S_LIGHT);
            digitalWrite(RELAY_PIN, RELAY_OFF);
            pinMode(RELAY_PIN, OUTPUT);
        }
      }
      void loop()     
      {     
        // Process incoming messages (like config from server)
        gw.process(); 
      
        // Fetch temperatures from Dallas sensors
        sensors.requestTemperatures();
      
        // query conversion time and sleep until conversion completed
        int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution());
        // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater)
        gw.sleep(conversionTime);
      
        // Read temperatures and send them to controller 
        for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
       
          // Fetch and round temperature to one decimal
          float temperature = static_cast<float>(static_cast<int>((gw.getConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
       
          // Only send data if temperature has changed and no error
          if (lastTemperature[i] != temperature && temperature != -127.00) {
       
            // Send in the new temperature
            gw.send(msgT.setSensor(i).set(temperature,1));
            lastTemperature[i]=temperature;
          }
        }
      }
        void incomingMessage(const MyMessage &message) {
        // We only expect one type of message from controller. But we better check anyway.
        if (message.type==V_LIGHT) {
           // Change relay state
           digitalWrite(RELAY_PIN, message.getBool()?RELAY_ON:RELAY_OFF);
           // Store state in eeprom
      //     gw.saveState(message.sensor, message.getBool());
      //     // Write some debug info
           Serial.print("Incoming change for sensor:");
           Serial.print(message.sensor);
           Serial.print(", New status: ");
           Serial.println(message.getBool());
         }   
        //gw.sleep(SLEEP_TIME);
      }
      #include <MySensor.h>  
      #include <SPI.h>
      #include <DallasTemperature.h>
      #include <OneWire.h>
      
      #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected 
      #define MAX_ATTACHED_DS18B20 16
      //Relay 
      #define RELAY_PIN  5  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
      #define RELAY_CHILD 0
      #define NUMBER_OF_RELAYS 1 // Total number of attached relays
      #define RELAY_ON 1  // GPIO value to write to turn on attached relay
      #define RELAY_OFF 0 // GPIO value to write to turn off attached relay
      
      //unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
      OneWire oneWire(ONE_WIRE_BUS);
      DallasTemperature sensors(&oneWire);
      MySensor gw;
      float lastTemperature[MAX_ATTACHED_DS18B20];
      int numSensors=0;
      boolean receivedConfig = false;
      boolean metric = true; 
      // Initialize temperature message
      MyMessage msgT(0,V_TEMP);
      MyMessage msg(RELAY_CHILD,V_LIGHT);
      
      
      void setup()  
      { 
        // Startup OneWire 
        sensors.begin();
        // requestTemperatures() will not block current thread
        sensors.setWaitForConversion(false);
      
        // Startup and initialize MySensors library. Set callback for incoming messages. 
        gw.begin(incomingMessage, AUTO, false); 
      
        // Send the sketch version information to the gateway and Controller
        gw.sendSketchInfo("Temperature Sensor w relay", "1.0");
      
        // 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++) {   
           gw.present(i, S_TEMP);
           gw.present(RELAY_CHILD, S_LIGHT);
            digitalWrite(RELAY_PIN, RELAY_OFF);
            pinMode(RELAY_PIN, OUTPUT);
        }
      }
      void loop()     
      {     
        // Process incoming messages (like config from server)
        gw.process(); 
      
        // Fetch temperatures from Dallas sensors
        sensors.requestTemperatures();
      
        // query conversion time and sleep until conversion completed
        int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution());
        // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater)
        gw.sleep(conversionTime);
      
        // Read temperatures and send them to controller 
        for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
       
          // Fetch and round temperature to one decimal
          float temperature = static_cast<float>(static_cast<int>((gw.getConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
       
          // Only send data if temperature has changed and no error
          if (lastTemperature[i] != temperature && temperature != -127.00) {
       
            // Send in the new temperature
            gw.send(msgT.setSensor(i).set(temperature,1));
            lastTemperature[i]=temperature;
          }
        }
      }
        void incomingMessage(const MyMessage &message) {
        // We only expect one type of message from controller. But we better check anyway.
        if (message.type==V_LIGHT) {
           // Change relay state
           digitalWrite(RELAY_PIN, message.getBool()?RELAY_ON:RELAY_OFF);
           // Store state in eeprom
      //     gw.saveState(message.sensor, message.getBool());
      //     // Write some debug info
           Serial.print("Incoming change for sensor:");
           Serial.print(message.sensor);
           Serial.print(", New status: ");
           Serial.println(message.getBool());
         }   
        //gw.sleep(SLEEP_TIME);
      }
      

      Is something wrong with identification of relay? Temperatures are working just fine.

      posted in Domoticz
      mikee
      mikee
    • RE: Temp and Relay node

      Hi Guys,
      So after few day IĀ“m back again šŸ˜‘ . I started with @Moshe Livne test – worked just fine - thanks. I found more relay examples and the one from @petewill http://forum.mysensors.org/topic/775/8-lamp-outlet-smart-plug-module worked!!! Now IĀ“m trying to merge new Dallas sketch – mentioned by robosensor with petewill s 8$ outlet:

      #include <MySensor.h>  
      #include <SPI.h>
      #include <DallasTemperature.h>
      #include <OneWire.h>
      
      #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected 
      #define MAX_ATTACHED_DS18B20 16
      //Relay 
      #define RELAY_PIN  5  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
      #define RELAY_CHILD 0
      #define NUMBER_OF_RELAYS 1 // Total number of attached relays
      #define RELAY_ON 1  // GPIO value to write to turn on attached relay
      #define RELAY_OFF 0 // GPIO value to write to turn off attached relay
      
      //unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
      OneWire oneWire(ONE_WIRE_BUS);
      DallasTemperature sensors(&oneWire);
      MySensor gw;
      float lastTemperature[MAX_ATTACHED_DS18B20];
      int numSensors=0;
      boolean receivedConfig = false;
      boolean metric = true; 
      // Initialize temperature message
      MyMessage msgT(0,V_TEMP);
      MyMessage msg(RELAY_CHILD,V_LIGHT);
      
      
      void setup()  
      { 
        // Startup OneWire 
        sensors.begin();
        // requestTemperatures() will not block current thread
        sensors.setWaitForConversion(false);
      
        // Startup and initialize MySensors library. Set callback for incoming messages. 
        gw.begin(); 
      
        // Send the sketch version information to the gateway and Controller
        gw.sendSketchInfo("Temperature Sensor w relay", "1.0");
      
        // 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++) {   
           gw.present(i, S_TEMP);
           gw.present(RELAY_CHILD, S_LIGHT);
            digitalWrite(RELAY_PIN, RELAY_OFF);
            pinMode(RELAY_PIN, OUTPUT);
        }
      }
      
      
      void loop()     
      {     
        // Process incoming messages (like config from server)
        gw.process(); 
      
        // Fetch temperatures from Dallas sensors
        sensors.requestTemperatures();
      
        // query conversion time and sleep until conversion completed
        int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution());
        // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater)
        gw.sleep(conversionTime);
      
        // Read temperatures and send them to controller 
        for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
       
          // Fetch and round temperature to one decimal
          float temperature = static_cast<float>(static_cast<int>((gw.getConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
       
          // Only send data if temperature has changed and no error
          if (lastTemperature[i] != temperature && temperature != -127.00) {
       
            // Send in the new temperature
            gw.send(msgT.setSensor(i).set(temperature,1));
            lastTemperature[i]=temperature;
          }
        }
        }
        
        void incomingMessage(const MyMessage &message) {
        // We only expect one type of message from controller. But we better check anyway.
        if (message.type==V_LIGHT) {
           // Change relay state
           digitalWrite(RELAY_PIN, message.getBool()?RELAY_ON:RELAY_OFF);
           // Store state in eeprom
      //     gw.saveState(message.sensor, message.getBool());
      //     // Write some debug info
           Serial.print("Incoming change for sensor:");
           Serial.print(message.sensor);
           Serial.print(", New status: ");
           Serial.println(message.getBool());
         } 
      
        
        
      
        
        //gw.sleep(SLEEP_TIME);
      }
      

      It compiles, temperatures are working but relay is not working, can someone help me, pls.

      @sundberg84 next day after I switch to latest Domoticz beta system started to freeze again. I“ts only after relay switch command pushed by user or even by timer (when I checked the logs of the switch all times are loged 5-7 minutes later than the switch time). Is there any tutorial or does exist system how to switch my Domoticz to your version (2606), without installing all Domoticz manually? I was able to run SD versions only and 2606 is zip file.
      Thanks for your time Guys

      posted in Domoticz
      mikee
      mikee
    • RE: Temp and Relay node

      Thanks @robosensor , I“ll try it.
      @Moshe Livne, Sure they can - on coil (at least mine is built so), but board must have jumpers to separate it . Input must be 5V- of course transistor would burn. I'll try your suggestions, thanks

      posted in Domoticz
      mikee
      mikee
    • RE: Temp and Relay node

      Exactly - I tried other sketch yesterday, that worked same way - LED turned on, but contacts stayed off. I will try to power the relay board separately with raw voltage from Arduino (9V)

      posted in Domoticz
      mikee
      mikee
    • RE: Temp and Relay node

      Hi Moshe,
      I“ll try this after I come home, thanks

      posted in Domoticz
      mikee
      mikee
    • RE: Temp and Relay node

      When I“m uploading sketch both two relays start to light and during upload switch off and when uploaded turn on.

      posted in Domoticz
      mikee
      mikee
    • RE: Temp and Relay node

      Hi sundberg84 , Thanks for your advice. I was only able to upgrade to beta 2650 (my programing skills are very poor – I followed steps in Domoticz wiki). Domoticz environment is working OK now, I can switch and icons are changing properly. Relays are still death. I replaced definition of 1/0 for relay write in arduino code so relay LED begun light. In serial monitor of node I can nicely see ā€œincoming change for sensorā€ and ā€œnew statusā€ by every command from domoticz for each relay, but there is no switching at all.

      posted in Domoticz
      mikee
      mikee
    • Temp and Relay node

      Hi Everybody,
      First of all Thanks to all of you people and Mysensor Team for creating this and sharing it to all of us.
      I’m one of ā€žninjasphereā€œ backers, and after this project crashed, I started searching some DIY possibilities and I found this. I’m running Domoticz (ver.2563) in RPi2 and serial nano GW (on 1.4 code and libraries). I successfully created Temp/Hum and multiple Temp sensors but I got stuck on Temp/Relay node. Temperatures are working just fine (5pcs. DS 18B20) but the Relay won’t work. Temp sensors are on Pin3, Relays on 5 and 6. I’m using sketch I found here on forum:

       // Example sketch showing how to send in OneWire temperature readings
          // Example sketch showing how to control physical relays.
          // This example will remember relay state even after power failure.
          
          #include <MySensor.h>
          #include <SPI.h>
          #include <DallasTemperature.h>
          #include <OneWire.h>
          
          #define ONE_WIRE_BUS 3 // Pin where dallas sensor is connected 
          #define MAX_ATTACHED_DS18B20 16
          
          #define RELAY_1  5  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
          #define NUMBER_OF_RELAYS 2 // Total number of attached relays
          #define RELAY_ON 1  // GPIO value to write to turn on attached relay
          #define RELAY_OFF 0 // GPIO value to write to turn off attached relay
          #define NUMBER_OF_TEMP_SENSORS 5
          
          unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds) 30000 orig
          OneWire oneWire(ONE_WIRE_BUS);
          DallasTemperature sensors(&oneWire);
          MySensor gw;
          float lastTemperature[MAX_ATTACHED_DS18B20];
          //int numSensors = 0;
          boolean receivedConfig = false;
          boolean metric = true;
          // Initialize temperature message
          MyMessage msg(0, V_TEMP);
          //int offsetforrelays = 5;
          void setup()
          {
            // Startup OneWire
            sensors.begin();
            gw.begin(incomingMessage, AUTO, true);        // Startup and initialize MySensors library. Set callback for incoming messages.
            gw.sendSketchInfo("Temp and Relays", "1.0");   // Send the sketch version information to the gateway and Controller
          
            for (int i = 0; i < NUMBER_OF_TEMP_SENSORS ; i++)
            {
              gw.present(i, V_TEMP); // creates 0, 1 and 2
            }
            for (int sensor = 1, pin = RELAY_1 ; sensor <= NUMBER_OF_RELAYS ; sensor++ , pin++)
              //   loop from sensor1/pin4 to sensor2/pin5 (numofrelays=2)
            {
              gw.present(NUMBER_OF_TEMP_SENSORS + sensor, S_LIGHT); // should create 3 and 4
              pinMode(pin, OUTPUT);
              digitalWrite(pin, gw.loadState(sensor) ? RELAY_ON : RELAY_OFF);
            }
          }
          
           void loop()
          {
            // Process incoming messages (like config from server)
            gw.process();
          
            // Fetch temperatures from Dallas sensors
            sensors.requestTemperatures();
          
            // Read temperatures and send them to controller
            for (int i = 0; i < NUMBER_OF_TEMP_SENSORS && i < MAX_ATTACHED_DS18B20; i++) {
          
              // Fetch and round temperature to one decimal
              float temperature = static_cast<float>(static_cast<int>((gw.getConfig().isMetric ? sensors.getTempCByIndex(i) : sensors.getTempFByIndex(i)) * 10.)) / 10.;
          
              // Only send data if temperature has changed more then 1 degC and no error
              if (int(lastTemperature[i]) != int(temperature) && temperature != -127.00) { //added integer
          
                // Send in the new temperature
                gw.send(msg.setSensor(i).set(temperature, 1));
                lastTemperature[i] = temperature;
              }
            }
            //gw.sleep(SLEEP_TIME); //no sleep for relays!!!!
          }
          
          void incomingMessage(const MyMessage &message) {
            // We only expect one type of message from controller. But we better check anyway.
            if (message.type == V_LIGHT) {
              // Change relay state
              Serial.print("Incoming change for sensor:");
              Serial.println(message.sensor);
              digitalWrite(message.sensor - 4 + RELAY_1, message.getBool() ? RELAY_ON : RELAY_OFF);
              // Store state in eeprom
              gw.saveState(message.sensor, message.getBool());
              // Write some debug info
              Serial.print("Incoming change for sensor:");
              Serial.print(message.sensor);
              Serial.print(", New status: ");
              Serial.println(message.getBool());
            }
          }
      

      When I push switch in Domoticz it just freeze up, and I have to unplug RPI and restart it. Do I need some special adjustment in Domoticz for button?
      Does anybody have working relay/temp sketch on Domoticz, or can anybody give me some advice?
      Thanks guys

      posted in Domoticz
      mikee
      mikee