Navigation

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

    sSpeaker

    @sSpeaker

    0
    Reputation
    4
    Posts
    450
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    sSpeaker Follow

    Best posts made by sSpeaker

    This user hasn't posted anything yet.

    Latest posts made by sSpeaker

    • RE: Can't add nodes to HA

      @martinhjelmare said:

      What version of home assistant are you running?

      $ hass --version
      0.28.2
      

      Not really sure why there are no presentation messages on GW side. According to the log it was sent successfully.

      It's possible to add sensors manually by editing the JSON persistence file.

      Can you share an example of this file.

      posted in Home Assistant
      sSpeaker
      sSpeaker
    • RE: Can't add nodes to HA

      @martinhjelmare said:

      Fixed code with gw.wait(50). There was an error on sending third child before that:

      ...
      send: 1-1-0-0 s=3,c=0,t=1,pt=0,l=0,sg=0,st=fail:
      ...
      

      Now sketch looks like that:

      ...
      
        gw.begin(NULL, NodeID, false);
        gw.wait(50);
        gw.sendSketchInfo("Light Lux Sensor", "2.1");
        gw.wait(50);
        gw.present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
        gw.wait(50);
        gw.present(CHILD_ID_HUM, S_HUM);
        gw.wait(50);
        gw.present(CHILD_ID_TEMP, S_TEMP);
        gw.wait(50);
        gw.present(CHILD_ID_MOTION, S_MOTION);
      ...
      

      Sensor log:

      send: 1-1-0-0 s=255,c=3,t=15,pt=2,l=2,sg=0,st=ok:1
      read: 0-0-1 s=255,c=3,t=15,pt=2,l=2,sg=0:1
      send: 1-1-0-0 s=255,c=3,t=16,pt=0,l=0,sg=0,st=ok:
      read: 0-0-1 s=255,c=3,t=17,pt=6,l=25,sg=0:01C5B0DC963CB71F2DCD27C8B0F6D158F42093428EB9CC8D57
      send: 1-1-0-0 s=255,c=0,t=17,pt=0,l=5,sg=1,st=ok:1.5.4
      send: 1-1-0-0 s=255,c=3,t=16,pt=0,l=0,sg=0,st=ok:
      read: 0-0-1 s=255,c=3,t=17,pt=6,l=25,sg=0:017372F9A88F43BC6507E63AF0E71A395A1D40BA4DE874C687
      send: 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,sg=1,st=ok:0
      sensor started, id=1, parent=0, distance=1
      send: 1-1-0-0 s=255,c=3,t=16,pt=0,l=0,sg=0,st=ok:
      read: 0-0-1 s=255,c=3,t=17,pt=6,l=25,sg=0:019A79B90F8BC63410C3F580DA25F2F468EFA1419E3B4E5FFE
      send: 1-1-0-0 s=255,c=3,t=11,pt=0,l=16,sg=1,st=ok:Light Lux Sensor
      send: 1-1-0-0 s=255,c=3,t=16,pt=0,l=0,sg=0,st=ok:
      read: 0-0-1 s=255,c=3,t=17,pt=6,l=25,sg=0:019A79B90F8BC63410C3F580DA25F2F468EFA1419E3B4E5FFE
      send: 1-1-0-0 s=255,c=3,t=12,pt=0,l=3,sg=1,st=ok:2.1
      send: 1-1-0-0 s=0,c=0,t=16,pt=0,l=0,sg=0,st=ok:
      send: 1-1-0-0 s=1,c=0,t=7,pt=0,l=0,sg=0,st=ok:
      send: 1-1-0-0 s=2,c=0,t=6,pt=0,l=0,sg=0,st=ok:
      send: 1-1-0-0 s=3,c=0,t=1,pt=0,l=0,sg=0,st=ok:
      Battery Voltage: 4077.00 mV; percentage: 89 %
      send: 1-1-0-0 s=255,c=3,t=16,pt=0,l=0,sg=0,st=ok:
      read: 0-0-1 s=255,c=3,t=17,pt=6,l=25,sg=0:01857D3E43A059F8EBDBA3F632014EB2B1CE62B3F58C017BE0
      send: 1-1-0-0 s=255,c=3,t=0,pt=1,l=1,sg=1,st=ok:89
      Motion detected: 1
      send: 1-1-0-0 s=3,c=3,t=16,pt=0,l=0,sg=0,st=ok:
      read: 0-0-1 s=255,c=3,t=17,pt=6,l=25,sg=0:017372F9A88F43BC6507E63AF0E71A395A1D40BA4DE874C687
      send: 1-1-0-0 s=3,c=1,t=16,pt=2,l=2,sg=1,st=ok:1
      Light: 3 lx
      send: 1-1-0-0 s=0,c=3,t=16,pt=0,l=0,sg=0,st=ok:
      read: 0-0-1 s=255,c=3,t=17,pt=6,l=25,sg=0:01857D3E43A059F8EBDBA3F632014EB2B1CE62B3F58C017BE0
      send: 1-1-0-0 s=0,c=1,t=23,pt=3,l=2,sg=1,st=ok:3
      Wait fro DHT22: 288
      DHT22, 	OK,	50.3,	24.6
      send: 1-1-0-0 s=2,c=3,t=16,pt=0,l=0,sg=0,st=ok:
      read: 0-0-1 s=255,c=3,t=17,pt=6,l=25,sg=0:011D852C06DD95F9234FD0E592B9A2DDA3429BCA9F77526474
      send: 1-1-0-0 s=2,c=1,t=0,pt=7,l=5,sg=1,st=ok:24.6
      send: 1-1-0-0 s=1,c=3,t=16,pt=0,l=0,sg=0,st=ok:
      read: 0-0-1 s=255,c=3,t=17,pt=6,l=25,sg=0:013CD41180660904233472CD7B7B8A48DC6CAB595096EC18FC
      send: 1-1-0-0 s=1,c=1,t=1,pt=7,l=5,sg=1,st=ok:50.3
      

      Gateway:

      1;255;3;0;6;0
      1;255;3;0;11;Light Lux Sensor
      1;255;3;0;12;2.1
      1;0;0;0;16;
      1;1;0;0;7;
      1;2;0;0;6;
      1;3;0;0;1;
      1;255;3;0;0;89
      1;3;1;0;16;1
      1;0;1;0;23;3
      1;2;1;0;0;24.6
      1;1;1;0;1;50.3
      

      Log of HA is the same:

      WARNING:mysensors.mysensors:Node 1 is unknown
      WARNING:mysensors.mysensors:Node 1 is unknown
      WARNING:mysensors.mysensors:Node 1 is unknown
      ERROR:mysensors.mysensors:Node 1 is unknown, will not add child 0.
      WARNING:mysensors.mysensors:Node 1 is unknown
      ERROR:mysensors.mysensors:Node 1 is unknown, will not add child 1.
      WARNING:mysensors.mysensors:Node 1 is unknown
      ERROR:mysensors.mysensors:Node 1 is unknown, will not add child 2.
      WARNING:mysensors.mysensors:Node 1 is unknown
      ERROR:mysensors.mysensors:Node 1 is unknown, will not add child 3.
      WARNING:mysensors.mysensors:Node 1 is unknown
      WARNING:mysensors.mysensors:Node 1 is unknown
      WARNING:mysensors.mysensors:Node 1 is unknown
      

      I added logger with debug. Also "debug: true" in mysensors section. Also --debug to hass command line. But there are no debug messages.
      Config:

      homeassistant:
        name: Home
        elevation: 185
        unit_system: metric
        time_zone: Europe/Kiev
      
      logger:
        default: debug
        logs:
          mysensors.mysensors: debug
      
      frontend:
      
      http:
      
      history:
      
      logbook:
      
      mysensors:
        gateways:
          - device: '/dev/ttyUSB0'
            persistence_file: '/home/homeassistant/.homeassistant/mysensors.json'
            baud_rate: 115200
        debug: true
        optimistic: true
        persistence: true
        version: 1.5
      
      posted in Home Assistant
      sSpeaker
      sSpeaker
    • Can't add nodes to HA

      I have about 15 nodes and they works well with openhab. But I can't add them to HA.

      configuration.yaml

      homeassistant:
        name: Home
        elevation: 185
        unit_system: metric
        time_zone: Europe/Kiev
      
      frontend:
      
      http:
      
      mysensors:
        gateways:
          - device: '/dev/ttyUSB0'
            persistence_file: '/home/homeassistant/mysensors.json'
            baud_rate: 115200
        debug: true
        optimistic: true
        persistence: true
        version: 1.5
      
      logger:
        default: debug
      

      example of sketch:

      #include <SPI.h>
      #include <MySensor.h>
      #include <MySigningAtsha204Soft.h>  
      #include <BH1750.h>
      #include <Wire.h>
      #include <dht.h>
      
      #define NodeID 1
      
      #define DHT22_VCC 7
      #define DHT22_PIN 6
      #define LIGHT_VCC 8
      #define MOTION_PIN 3
      #define LED_PIN 4
      
      // Declare interrupt pin
      #define INTERRUPT MOTION_PIN-2
      
      #define CHILD_ID_LIGHT 0
      #define CHILD_ID_HUM 1
      #define CHILD_ID_TEMP 2
      #define CHILD_ID_MOTION 3 
      
      unsigned long SLEEP_TIME = 60000; // Sleep time between reads (in milliseconds)
      
      BH1750 lightSensor;
      dht DHT;
      
      MyTransportNRF24 radio;
      MyHwATMega328 hw;
      
      //uint8_t soft_serial[SHA204_SERIAL_SZ] = {0x027,0x03,0xa1,0xaa,0x06,0x11,0x25,0xa3,0xa1};
      
      MySigningAtsha204Soft signer; //(true, 0, NULL, soft_serial);
      
      MySensor gw(radio, hw, signer);
      
      MyMessage msgLight(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      MyMessage msgMot(CHILD_ID_MOTION, V_TRIPPED);
      
      // MyMessage msg(CHILD_ID_LIGHT, V_LEVEL);  
      
      boolean interrupt = false;
      
      void blink()
      {
        digitalWrite(LED_PIN, HIGH);
        gw.wait(1000);
        digitalWrite(LED_PIN, LOW);
      }
      
      long readVcc() {
        // Read 1.1V reference against AVcc
        // set the reference to Vcc and the measurement to the internal 1.1V reference
        #if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
          ADMUX = _BV(REFS0) | _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
        #elif defined (__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__)
          ADMUX = _BV(MUX5) | _BV(MUX0);
        #elif defined (__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
          ADMUX = _BV(MUX3) | _BV(MUX2);
        #else
          ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
        #endif  
       
        delay(2); // Wait for Vref to settle
        ADCSRA |= _BV(ADSC); // Start conversion
        while (bit_is_set(ADCSRA,ADSC)); // measuring
       
        uint8_t low  = ADCL; // must read ADCL first - it then locks ADCH  
        uint8_t high = ADCH; // unlocks both
       
        long result = (high<<8) | low; 
        
        result = 1125300L / result; // Calculate Vcc (in mV); 1125300 = 1.1*1023*1000
        return result; // Vcc in millivolts
      }
      
      
      void setup()  
      { 
        pinMode(DHT22_VCC, OUTPUT);
        pinMode(MOTION_PIN, INPUT);
        pinMode(LED_PIN, OUTPUT);
        digitalWrite(LED_PIN, LOW);
      
        analogReference(INTERNAL);
      
        gw.begin(NULL, NodeID, false);
        gw.sendSketchInfo("Light Lux Sensor", "2.1");
        
        // Register all sensors to gateway (they will be created as child devices)
        gw.present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
        gw.present(CHILD_ID_HUM, S_HUM);
        gw.present(CHILD_ID_TEMP, S_TEMP);
        gw.present(CHILD_ID_MOTION, S_MOTION);
      
        lightSensor.begin(BH1750_ONE_TIME_LOW_RES_MODE);
      }
      
      void loop()
      { 
        digitalWrite(DHT22_VCC, HIGH); // Turn on DHT22 here to save time.
        unsigned long dht_time = millis();
        
        float batteryV  = readVcc();
        int batteryPcnt = ( ( batteryV - 3000 ) / 1200 ) * 100;
        Serial.print("Battery Voltage: ");
        Serial.print(batteryV);
        Serial.print(" mV; ");
        Serial.print("percentage: ");
        Serial.print(batteryPcnt);
        Serial.println(" %");
        gw.sendBatteryLevel(batteryPcnt);
      
        // Motion
        int tripped;
        if (interrupt) {
          //blink();
          tripped = 1;
        } else {
          if (digitalRead(MOTION_PIN) == HIGH) {
            //blink();
            tripped = 1; 
          } else {
            tripped = 0;
          }
        }
        Serial.print("Motion detected: ");
        Serial.println(tripped);
        
        gw.send(msgMot.set(tripped));  // Send tripped value to gw 
      
        //Light
        lightSensor.configure(BH1750_ONE_TIME_LOW_RES_MODE);
        uint16_t lux = lightSensor.readLightLevel();// Get Lux value
        
        Serial.print("Light: ");
        Serial.print(lux);
        Serial.println(" lx");
      
        gw.send(msgLight.set(lux));
        
        // Temp & Hum
        if ((millis() - dht_time) < 1000 ) {
          Serial.print("Wait fro DHT22: ");
          Serial.println(1000 - (millis() - dht_time));
          gw.wait(1000 - (millis() - dht_time));
        }
        Serial.print("DHT22, \t");
        int chk = DHT.read22(DHT22_PIN);
      
        digitalWrite(DHT22_VCC, LOW);
        switch (chk)
        {
          case DHTLIB_OK:
          Serial.print("OK,\t"); 
          break;
          case DHTLIB_ERROR_CHECKSUM: 
          Serial.println("Checksum error,\t"); 
          break;
          case DHTLIB_ERROR_TIMEOUT: 
          Serial.println("Time out error,\t"); 
          break;
          default: 
          Serial.println("Unknown error,\t"); 
          break;
        }
        // DISPLAY DATA
        if (chk == DHTLIB_OK ) {
          float temperature = DHT.temperature;
          float humidity = DHT.humidity;
          
          Serial.print(DHT.humidity, 1);
          Serial.print(",\t");
          Serial.println(DHT.temperature, 1);
      
          gw.send(msgTemp.set(temperature, 1)); 
          gw.send(msgHum.set(humidity, 1));
        }
        //We don't need to send motion trigger every minute.
        if (interrupt) {
          interrupt = false;
          gw.sleep(SLEEP_TIME);
        } else {
          interrupt = gw.sleep(INTERRUPT,RISING, SLEEP_TIME);
        }
      }
      

      I'm getting next output in the HA log after restarting the node :

      INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=homeassistant, service=turn_off>
      INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=homeassistant, service=turn_on>
      INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=homeassistant, service=toggle>
      INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=homeassistant, service=reload_core_config>
      INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=persistent_notification, service=create>
      INFO:homeassistant.bootstrap:Home Assistant core initialized
      INFO:homeassistant.loader:Loaded mysensors from homeassistant.components.mysensors
      INFO:homeassistant.loader:Loaded logger from homeassistant.components.logger
      INFO:homeassistant.loader:Loaded http from homeassistant.components.http
      INFO:homeassistant.loader:Loaded frontend from homeassistant.components.frontend
      INFO:homeassistant.loader:Loaded api from homeassistant.components.api
      INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=logger>
      WARNING:mysensors.mysensors:File does not exist or is not readable: /home/homeassistant/mysensors.json
      WARNING:mysensors.mysensors:Trying backup file: /home/homeassistant/mysensors.json.bak
      WARNING:mysensors.mysensors:File does not exist or is not readable: /home/homeassistant/mysensors.json.bak
      WARNING:mysensors.mysensors:Failed to load sensors from file: /home/homeassistant/mysensors.json
      INFO:homeassistant.loader:Loaded sensor from homeassistant.components.sensor
      INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=mysensors>
      INFO:homeassistant.loader:Loaded switch from homeassistant.components.switch
      INFO:homeassistant.loader:Loaded light from homeassistant.components.light
      INFO:homeassistant.loader:Loaded binary_sensor from homeassistant.components.binary_sensor
      INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=http>
      INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=api>
      INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=frontend>
      INFO:homeassistant.core:Starting Home Assistant (7 threads)
      INFO:homeassistant.core:Bus:Handling <Event homeassistant_start[L]>
      INFO:homeassistant.core:Timer:starting
      INFO:mysensors.mysensors:Trying to connect to /dev/ttyUSB0
      INFO:mysensors.mysensors:/dev/ttyUSB0 is open...
      INFO:mysensors.mysensors:Connected to /dev/ttyUSB0
      INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=light, service=turn_on>
      INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=light, service=turn_off>
      INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=light, service=toggle>
      INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=light>
      INFO:homeassistant.core:Bus:Handling <Event platform_discovered[L]: discovered=, service=load_platform.light, platform=mysensors>
      INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=binary_sensor>
      INFO:homeassistant.core:Bus:Handling <Event platform_discovered[L]: discovered=, service=load_platform.binary_sensor, platform=mysensors>
      INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=sensor>
      INFO:homeassistant.core:Bus:Handling <Event platform_discovered[L]: discovered=, service=load_platform.sensor, platform=mysensors>
      INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=switch, service=turn_off>
      INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=switch, service=turn_on>
      INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=switch, service=toggle>
      INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=switch>
      INFO:homeassistant.core:Bus:Handling <Event platform_discovered[L]: discovered=, service=load_platform.switch, platform=mysensors>
      INFO:homeassistant.loader:Loaded switch.mysensors from homeassistant.components.switch.mysensors
      INFO:homeassistant.loader:Loaded binary_sensor.mysensors from homeassistant.components.binary_sensor.mysensors
      INFO:homeassistant.loader:Loaded light.mysensors from homeassistant.components.light.mysensors
      INFO:homeassistant.loader:Loaded sensor.mysensors from homeassistant.components.sensor.mysensors
      INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=switch, service=mysensors_send_ir_code>
      INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=homeassistant, service=stop>
      INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=homeassistant, service=restart>
      INFO:homeassistant.components.http:Serving /api/stream to 192.168.0.14 (auth: True)
      DEBUG:homeassistant.components.api:STREAM 1991040496 ATTACHED
      DEBUG:homeassistant.components.api:STREAM 1991040496 WRITING data: ping
      INFO:homeassistant.components.http:Serving /api/bootstrap to 192.168.0.14 (auth: True)
      WARNING:mysensors.mysensors:Node 1 is unknown
      WARNING:mysensors.mysensors:Node 1 is unknown
      WARNING:mysensors.mysensors:Node 1 is unknown
      ERROR:mysensors.mysensors:Node 1 is unknown, will not add child 0.
      WARNING:mysensors.mysensors:Node 1 is unknown
      ERROR:mysensors.mysensors:Node 1 is unknown, will not add child 1.
      WARNING:mysensors.mysensors:Node 1 is unknown
      ERROR:mysensors.mysensors:Node 1 is unknown, will not add child 2.
      WARNING:mysensors.mysensors:Node 1 is unknown
      WARNING:mysensors.mysensors:Node 1 is unknown
      WARNING:mysensors.mysensors:Node 1 is unknown
      WARNING:mysensors.mysensors:Node 1 is unknown
      WARNING:mysensors.mysensors:Node 1 is unknown
      

      GW and nodes are on 1.5.

      Do I need to fix something in the presentation procedure? Is it possible to add nodes manually?

      posted in Home Assistant
      sSpeaker
      sSpeaker
    • RE: openHAB binding

      Hi,

      I'm trying to control curtain with UP/DOWN/STOP commands, but it does not work.

      2016-05-03 05:00:45.446 [INFO ] [.b.m.internal.MySensorsBinding] - New MySensor sensor found (Window covers or shades): node-id=30, sensor-id=0 with type S_COVER
       * Example item: 30;0;V_UP                 - Window covering. Up.
       * Example item: 30;0;V_DOWN               - Window covering. Down.
       * Example item: 30;0;V_STOP               - Window covering. Stop.
       * Example item: 30;0;V_PERCENTAGE         - Percentage value. 0-100 (%)
      
      2016-05-03 11:17:58.351 [DEBUG] [.b.m.internal.MySensorsBinding] - internalReceiveCommand(BedroomCurtain,UP) is called!
      2016-05-03 11:17:58.354 [DEBUG] [.b.m.internal.MySensorsBinding] - Command "class org.openhab.core.library.types.UpDownType" is not a valid Command tyoe: [class org.openhab.core.library.types.PercentType]
      

      Item:

      Rollershutter	BedroomCurtain	"Bedroom Curtain"	<"rollershutter">	(Bedroom)	{mysensors="30;0;V_PERCENTAGE"}
      

      Sitemap:

      Switch	item=BedroomCurtain mappings=[UP="Up", STOP="Stop", DOWN="Down"]
      
      posted in OpenHAB
      sSpeaker
      sSpeaker