@BastienVH said:
Sorry, I was away from the computer for a little while.
I did reuse an old node id, that could have been the problem.
Assigned a new node ID and this is where I stand now:Firts up: the node sketch:
/** * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each * repeater and gateway builds a routing tables in EEPROM which keeps track of the * network topology allowing messages to be routed to nodes. * * Created by Henrik Ekblad <henrik.ekblad@mysensors.org> * Copyright (C) 2013-2015 Sensnology AB * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors * * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * ******************************* * * REVISION HISTORY * Version 1.0 - Henrik EKblad * * DESCRIPTION * This sketch provides an example how to implement a humidity/temperature * sensor using DHT11/DHT-22 * http://www.mysensors.org/build/humidity */ #include <SPI.h> #include <MySensor.h> #include <DHT.h> #define DIGITAL_INPUT_MOTION 3 // The digital input you attached your motion sensor. (Only 2 and 3 generates interrupt!) #define INTERRUPT DIGITAL_INPUT_MOTION-2 // Usually the interrupt = pin -2 (on uno/nano anyway) #define CHILD_ID_HUM 0 #define CHILD_ID_TEMP 1 #define CHILD_ID_MOT 2 #define HUMIDITY_SENSOR_DIGITAL_PIN 4 unsigned long SLEEP_TIME = 15000; // Sleep time between reads (in milliseconds) MySensor gw; DHT dht; float lastTemp; float lastHum; boolean metric = true; MyMessage msgHum(CHILD_ID_HUM, V_HUM); MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); MyMessage msgMot(CHILD_ID_MOT, V_TRIPPED); int node_id = 20; boolean lastTripped = false ; void setup() { gw.begin(NULL, node_id); dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); // Send the Sketch Version Information to the Gateway gw.sendSketchInfo("Humidity and motion", "1.0"); pinMode(DIGITAL_INPUT_MOTION, INPUT); // sets the motion sensor digital pin as input // Register all sensors to gw (they will be created as child devices) gw.present(CHILD_ID_HUM, S_HUM); gw.present(CHILD_ID_TEMP, S_TEMP); gw.present(CHILD_ID_MOT, S_MOTION); metric = gw.getConfig().isMetric; } void loop() { /* int wake; wake = gw.sleep(INTERRUPT, CHANGE, SLEEP_TIME); if (wake == 1) { Serial.println("wake by motion"); Serial.println("reading motion"); motion(); } else { Serial.println("wake by timer"); Serial.println("reading motion"); motion(); Serial.println("reading temp/hum"); humTemp(); } */ motion(); Serial.println("read temp / hum"); humTemp(); Serial.println("going to sleep now."); gw.sleep(INTERRUPT, CHANGE, SLEEP_TIME); //sleep a bit } void motion() { // Read digital motion value boolean tripped = digitalRead(DIGITAL_INPUT_MOTION); Serial.println(tripped); if (lastTripped != tripped) { gw.send(msgMot.set(tripped ? "1" : "0")); // Send tripped value to gw lastTripped = tripped; } } void humTemp() { gw.wait(dht.getMinimumSamplingPeriod()); float temperature = dht.getTemperature(); if (isnan(temperature)) { Serial.println("Failed reading temperature from DHT"); } else if (temperature != lastTemp) { lastTemp = temperature; if (!metric) { temperature = dht.toFahrenheit(temperature); } gw.send(msgTemp.set(temperature, 1)); Serial.print("T: "); Serial.println(temperature); } float humidity = dht.getHumidity(); if (isnan(humidity)) { Serial.println("Failed reading humidity from DHT"); } else if (humidity != lastHum) { lastHum = humidity; gw.send(msgHum.set(humidity, 1)); Serial.print("H: "); Serial.println(humidity); } }
Now, my HA config:
homeassistant: # Name of the location where Home Assistant is running name: Home # Location required to calculate the time the sun rises and sets latitude: xxxxxxxx longitude: xxxxxxxxxxxxxx # C for Celcius, F for Fahrenheit temperature_unit: C # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones time_zone: Europe/Brussels # View all events in a logbook logbook: # Checks for available updates updater: # Discover some devices automatically discovery: # Track the sun sun: # Allows you to issue voice commands from the frontend conversation: # Enables support for tracking state changes over time. history: # Enables the frontend frontend: # Show links to resources in log and frontend introduction: mysensors: gateways: - port: '/dev/MSgw' debug: true persistence: false
and the output when starting hass:
Config directory: /home/pi/.homeassistant WARNING:homeassistant.bootstrap:Colorlog package not found, console coloring disabled 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.bootstrap:Home Assistant core initialized INFO:homeassistant.loader:Loaded logbook from homeassistant.components.logbook INFO:homeassistant.loader:Loaded recorder from homeassistant.components.recorder INFO:homeassistant.loader:Loaded http from homeassistant.components.http INFO:homeassistant.loader:Loaded history from homeassistant.components.history INFO:homeassistant.loader:Loaded introduction from homeassistant.components.introduction INFO:homeassistant.loader:Loaded updater from homeassistant.components.updater INFO:homeassistant.loader:Loaded conversation from homeassistant.components.conversation INFO:homeassistant.loader:Loaded discovery from homeassistant.components.discovery INFO:homeassistant.loader:Loaded mysensors from homeassistant.components.mysensors INFO:homeassistant.loader:Loaded frontend from homeassistant.components.frontend INFO:homeassistant.loader:Loaded api from homeassistant.components.api INFO:homeassistant.loader:Loaded sun from homeassistant.components.sun INFO:homeassistant.components.introduction: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Hello, and welcome to Home Assistant! We'll hope that we can make all your dreams come true. Here are some resources to get started: - Configuring Home Assistant: https://home-assistant.io/getting-started/configuration/ - Available components: https://home-assistant.io/components/ - Troubleshooting your configuration: https://home-assistant.io/getting-started/troubleshooting-configuration/ - Getting help: https://home-assistant.io/help/ This message is generated by the introduction component. You can disable it in configuration.yaml. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=introduction> INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=recorder> INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=http> INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=logbook> INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=history> INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): pypi.python.org INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=updater> /home/pi/.homeassistant/lib/fuzzywuzzy/fuzz.py:33: UserWarning: Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning warnings.warn('Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning') INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=conversation, service=process> INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=conversation> INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=discovery> INFO:homeassistant.loader:Loaded sensor from homeassistant.components.sensor INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=sensor> INFO:homeassistant.core:Bus:Handling <Event platform_discovered[L]: discovered=, service=mysensors.sensors> INFO:homeassistant.loader:Loaded sensor.mysensors from homeassistant.components.sensor.mysensors INFO:homeassistant.loader:Loaded switch from homeassistant.components.switch 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 component_loaded[L]: component=switch> INFO:homeassistant.core:Bus:Handling <Event platform_discovered[L]: discovered=, service=mysensors.switches> INFO:homeassistant.loader:Loaded switch.mysensors from homeassistant.components.switch.mysensors INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=mysensors> INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=api> INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=frontend> INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): maps.googleapis.com INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: new_state=<state sun.sun=below_horizon; next_setting=16:19:22 25-01-2016, friendly_name=Sun, next_rising=07:29:47 25-01-2016, elevation=-33.1 @ 20:51:46 24-01-2016>, entity_id=sun.sun> INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=sun> INFO:homeassistant.core:Starting Home Assistant (16 threads) INFO:homeassistant.core:Bus:Handling <Event homeassistant_start[L]> INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=homeassistant, service=stop> INFO:homeassistant.components.http:Starting web interface at http://0.0.0.0:8123 INFO:homeassistant.core:Timer:starting INFO:mysensors.mysensors:Trying to connect to /dev/MSgw INFO:homeassistant.components.http:"GET /api/stream?api_password=no_password_set&restrict=state_changed,component_loaded,service_registered HTTP/1.1" 200 - INFO:homeassistant.components.http:"GET /api/stream?api_password=no_password_set&restrict=state_changed,component_loaded,service_registered HTTP/1.1" 200 - INFO:homeassistant.components.http:"GET /api/bootstrap HTTP/1.1" 200 - INFO:netdisco.service:Scanning INFO:homeassistant.components.http:"GET /api/bootstrap HTTP/1.1" 200 - INFO:mysensors.mysensors:/dev/MSgw is open... INFO:mysensors.mysensors:Connected to /dev/MSgw INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:gateway started, id=0, parent=0, distance=0 INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 20-20-0 s=0,c=1,t=1,pt=7,l=5,sg=0:54.0 INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): 192.168.1.70 INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): 192.168.1.70 INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): 192.168.1.1 INFO:homeassistant.components.discovery:Found new service: DLNA http://192.168.1.70:1972/DeviceDescription.xml INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 20-20-0 s=0,c=1,t=1,pt=7,l=5,sg=0:53.0 INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: new_state=<state sun.sun=below_horizon; next_setting=16:19:22 25-01-2016, friendly_name=Sun, next_rising=07:29:47 25-01-2016, elevation=-33.21 @ 20:51:46 24-01-2016>, entity_id=sun.sun, old_state=<state sun.sun=below_horizon; next_setting=16:19:22 25-01-2016, friendly_name=Sun, next_rising=07:29:47 25-01-2016, elevation=-33.1 @ 20:51:46 24-01-2016>> INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 20-20-0 s=0,c=1,t=1,pt=7,l=5,sg=0:54.0 INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 20-20-0 s=0,c=1,t=1,pt=7,l=5,sg=0:53.0 INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 20-20-0 s=0,c=1,t=1,pt=7,l=5,sg=0:54.0 INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 20-20-0 s=0,c=1,t=1,pt=7,l=5,sg=0:53.0 INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: new_state=<state sun.sun=below_horizon; next_setting=16:19:22 25-01-2016, friendly_name=Sun, next_rising=07:29:47 25-01-2016, elevation=-33.36 @ 20:51:46 24-01-2016>, entity_id=sun.sun, old_state=<state sun.sun=below_horizon; next_setting=16:19:22 25-01-2016, friendly_name=Sun, next_rising=07:29:47 25-01-2016, elevation=-33.21 @ 20:51:46 24-01-2016>> INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 20-20-0 s=0,c=1,t=1,pt=7,l=5,sg=0:54.0 INFO:homeassistant.components.http:"GET /states HTTP/1.1" 200 - INFO:homeassistant.components.http:"GET /static/frontend-1003c31441ec44b3db84b49980f736a7.html HTTP/1.1" 200 - INFO:homeassistant.components.http:"GET /static/favicon-192x192.png HTTP/1.1" 200 - INFO:homeassistant.components.http:"GET /static/favicon.ico HTTP/1.1" 200 - INFO:homeassistant.components.http:"GET /api/bootstrap HTTP/1.1" 200 - INFO:homeassistant.components.http:"GET /api/stream?api_password=no_password_set&restrict=state_changed,component_loaded,service_registered HTTP/1.1" 200 -
I don't get errors anymore, but nothing shows up in the web interface.
I think the messages aren't being interpreted?
You have to reboot your individual sensors so HA can see their Presentation message. Your output seems to be good for the gateway itself, but the gateway is not an actual "item" in HA, when it detects the sensors though, you should see their status.