Home Assistant - How to recognize MySensors nodes
-
@drock1985
It looks like we're trying to do similar things with HA and MYS... I've been working on a rotary encoder switch for colored lights (eg Limitlessled/HUE etc...) and had been trying to program it through MQTT. However, I just now noticed the LEDDIMMERwithROTARYENCODER sketch in the MySensors examples so I thought I might try using MYS instead of MQTT. Of course that leads right back to the lack of support for MYS Switches in HASS... Perhaps there's a solution for both of our problems if we use an MQTT Gateway instead? I've worked with MQTT and NodeRED before and it was pretty straight forward, but then again I've been having a much harder time understanding the way its implemented in HASS... So I might need to work with it some more before I can be of any help testing the MQTT MYS Gateway with HA...Hi!
I also want to try the MQTT gateway together with HA. MQTT support is well supported in HA, and looking at the MQTT protocol in mysensors dev branch it looks promising. I have just got some ethernet modules and more nanos, so as soon as I find some time, I'll get started. We can post our progress somewhere here whoever gets it going first.
-
Sounds like an interesting idea to me. I have never used a MQTT gateway before, so i'm going in a little blind. I think I have the server so far (mosquitto) running on the same RPI as my HA install; so now looking into the next step.
One thing though, would this replace my current serial gateway, or be an addition to it?
-
I've been trying to get MQTT working using the Dev branch here (http://forum.mysensors.org/topic/2352/guide-setting-up-and-testing-mqtt-client-gateway/) and have my configuration.yaml file looking like this for my W5100MQTT broker:
#MySensors MQTT Test mqtt 1: broker: 192.168.86.198 port: 1883 # client_id: home-assistant-1 keepalive: 60 # username: USERNAME # password: PASSWORDThe Serial output from Arduino shows that I connected successfully
0;0;3;0;9;Starting gateway (RNNGA-, 1.6.0-beta) 0;0;3;0;9;Radio init successful. IP: 192.168.86.112 0;0;3;0;9;Attempting MQTT connection... 0;0;3;0;9;MQTT connected 0;0;3;0;9;Init complete, id=0, parent=0, distance=0But, Home-Assistant isn't registering the broker, and I have this error in the Dev section:
15-12-15 15:32:17 homeassistant.components.mqtt: Missing required configuration items in mqtt: broker 15-12-15 15:32:17 homeassistant.bootstrap: component mqtt failed to initializeDoes anyone have any ideas? @humblehacker @martinhjelmare @hek ?
-
I've been trying to get MQTT working using the Dev branch here (http://forum.mysensors.org/topic/2352/guide-setting-up-and-testing-mqtt-client-gateway/) and have my configuration.yaml file looking like this for my W5100MQTT broker:
#MySensors MQTT Test mqtt 1: broker: 192.168.86.198 port: 1883 # client_id: home-assistant-1 keepalive: 60 # username: USERNAME # password: PASSWORDThe Serial output from Arduino shows that I connected successfully
0;0;3;0;9;Starting gateway (RNNGA-, 1.6.0-beta) 0;0;3;0;9;Radio init successful. IP: 192.168.86.112 0;0;3;0;9;Attempting MQTT connection... 0;0;3;0;9;MQTT connected 0;0;3;0;9;Init complete, id=0, parent=0, distance=0But, Home-Assistant isn't registering the broker, and I have this error in the Dev section:
15-12-15 15:32:17 homeassistant.components.mqtt: Missing required configuration items in mqtt: broker 15-12-15 15:32:17 homeassistant.bootstrap: component mqtt failed to initializeDoes anyone have any ideas? @humblehacker @martinhjelmare @hek ?
What do you set MY_IP_GATEWAY_ADDRESS to on the arduino side?
-
@drock1985 said:
Would it be possible to get a Home-Assistant dedicated sub-forum please?
You got it.
http://forum.mysensors.org/category/28/home-assistant -
Thanks @hek very appreciated.
EDIT: Sort of ran into an issue with the Dev MQTTW5100Gateway sketch.... Thought the output I was getting above was good, but in reality the Arduino IDE wasn't giving an error. I decided to run the gateway in my RPI and view the data through SSH via screen. It initializes and shows the same data as the Arduino IDE, but then seconds later it dies and gives an error about screen terminating. Happens every time.
Going to try the ESP8266MQTTGateway: I'm got a hunch.
-
I've been trying to get MQTT working using the Dev branch here (http://forum.mysensors.org/topic/2352/guide-setting-up-and-testing-mqtt-client-gateway/) and have my configuration.yaml file looking like this for my W5100MQTT broker:
#MySensors MQTT Test mqtt 1: broker: 192.168.86.198 port: 1883 # client_id: home-assistant-1 keepalive: 60 # username: USERNAME # password: PASSWORDThe Serial output from Arduino shows that I connected successfully
0;0;3;0;9;Starting gateway (RNNGA-, 1.6.0-beta) 0;0;3;0;9;Radio init successful. IP: 192.168.86.112 0;0;3;0;9;Attempting MQTT connection... 0;0;3;0;9;MQTT connected 0;0;3;0;9;Init complete, id=0, parent=0, distance=0But, Home-Assistant isn't registering the broker, and I have this error in the Dev section:
15-12-15 15:32:17 homeassistant.components.mqtt: Missing required configuration items in mqtt: broker 15-12-15 15:32:17 homeassistant.bootstrap: component mqtt failed to initializeDoes anyone have any ideas? @humblehacker @martinhjelmare @hek ?
@drock1985 said:
I've been trying to get MQTT working using the Dev branch here (http://forum.mysensors.org/topic/2352/guide-setting-up-and-testing-mqtt-client-gateway/) and have my configuration.yaml file looking like this for my W5100MQTT broker:
#MySensors MQTT Test mqtt 1: broker: 192.168.86.198 port: 1883 # client_id: home-assistant-1 keepalive: 60 # username: USERNAME # password: PASSWORDDoes anyone have any ideas? @humblehacker @martinhjelmare @hek ?
Does the IP address you defined in the config.yaml point to your Mosquitto Broker or the Arduino-Ethernet Shield? If it points to the Arduino afaik the point of the MQTTCLIENT Gateway is that it can be run as a client if you've already got a Mosquitto broker. Otherwise you would either need to remove mosquitto or forward it to a different port than the default 1883. If this was the case then HASS would be looking for a broker where none exists which is why it is missing configuration items...
-
For the time being, I'm thinking of taking a different approach with my toggle switch... I'm thinking of simply defining the button output as a binary sensor which can then toggle between two predefined scenes. At least in my case, input only needs to go in one direction so there's no need to receive any data from the controller....
-
For the time being, I'm thinking of taking a different approach with my toggle switch... I'm thinking of simply defining the button output as a binary sensor which can then toggle between two predefined scenes. At least in my case, input only needs to go in one direction so there's no need to receive any data from the controller....
FYI, my fifo_queue pull request has been merged with dev branch at pymysensors, so I'm hoping to be able to implement switch support for the mysensors component in homeassistant very soon.
-
FYI, my fifo_queue pull request has been merged with dev branch at pymysensors, so I'm hoping to be able to implement switch support for the mysensors component in homeassistant very soon.
@martinhjelmare said:
FYI, my fifo_queue pull request has been merged with dev branch at pymysensors, so I'm hoping to be able to implement switch support for the mysensors component in homeassistant very soon.
Thats great news! That should be a huge help with my plans for building an RGB Lighting controller based on the rotary_led_dimmer sketch! If I can ever figure out how to implement a simple toggle switch first...
-
@drock1985 said:
I've been trying to get MQTT working using the Dev branch here (http://forum.mysensors.org/topic/2352/guide-setting-up-and-testing-mqtt-client-gateway/) and have my configuration.yaml file looking like this for my W5100MQTT broker:
#MySensors MQTT Test mqtt 1: broker: 192.168.86.198 port: 1883 # client_id: home-assistant-1 keepalive: 60 # username: USERNAME # password: PASSWORDDoes anyone have any ideas? @humblehacker @martinhjelmare @hek ?
Does the IP address you defined in the config.yaml point to your Mosquitto Broker or the Arduino-Ethernet Shield? If it points to the Arduino afaik the point of the MQTTCLIENT Gateway is that it can be run as a client if you've already got a Mosquitto broker. Otherwise you would either need to remove mosquitto or forward it to a different port than the default 1883. If this was the case then HASS would be looking for a broker where none exists which is why it is missing configuration items...
@humblehacker said:
k
@humblehacker said:
@drock1985 said:
I've been trying to get MQTT working using the Dev branch here (http://forum.mysensors.org/topic/2352/guide-setting-up-and-testing-mqtt-client-gateway/) and have my configuration.yaml file looking like this for my W5100MQTT broker:
#MySensors MQTT Test mqtt 1: broker: 192.168.86.198 port: 1883 # client_id: home-assistant-1 keepalive: 60 # username: USERNAME # password: PASSWORDDoes anyone have any ideas? @humblehacker @martinhjelmare @hek ?
Does the IP address you defined in the config.yaml point to your Mosquitto Broker or the Arduino-Ethernet Shield? If it points to the Arduino afaik the point of the MQTTCLIENT Gateway is that it can be run as a client if you've already got a Mosquitto broker. Otherwise you would either need to remove mosquitto or forward it to a different port than the default 1883. If this was the case then HASS would be looking for a broker where none exists which is why it is missing configuration items...
The configuration.yaml file I have pointed back to the local IP address, since Mosquitto and Home-Assistant are running on the same Pi.
So, you are saying that it should really be pointed back to the MQTT Gateway then? Still confusing to me.
-
Never mind then... As long as your using Mosquitto as your broker and the MQTT CLIENT Gateway (from the development branch) rather than the default MQTT Gateway sketch from- http://www.mysensors.org/build/mqtt_gateway then none of my earlier comments should apply... Basically I was saying that the default MYSensors MQTT Gateway is set up to function as a broker and would therefore conflict with any Mosquitto server running on the same port. The MQTT CLIENT Gateway (emphasis on CLIENT) from the development branch isnt set up as a broker so it shouldnt conflict with a Mosquitto installation.
-
It's still important to be wary about which ip address you assign where, so I think it was a good point.
-
Hey @martinhjelmare , I see HA was updated today; did your commits get added?
-
Hey @martinhjelmare , I see HA was updated today; did your commits get added?
Hi!
No, I've submitted a pull request, but I need to fix some things, and maybe change some of it. But hopefully it wont take too long.
-
I have been trying to set up a switch in home assistant but I have had no luck in getting it to show up in the dashboard. I am using @martinhjelmare mysensors-component-switch branch of home assistant and the following sketch. Does anyone have any idea why this is happening? ```
/** * 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 * Example sketch showing how to control physical relays. * This example will remember relay state after power failure. * http://www.mysensors.org/build/relay */ #include <MySigningNone.h> #include <MyTransportNRF24.h> #include <MyTransportRFM69.h> #include <MyHwATMega328.h> #include <MySensor.h> #include <SPI.h> #define RELAY_1 3 // Arduino Digital I/O pin number for first relay (second on pin+1 etc) #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 // NRFRF24L01 radio driver (set low transmit power by default) MyTransportNRF24 radio(RF24_CE_PIN, RF24_CS_PIN, RF24_PA_LEVEL_GW); //MyTransportRFM69 radio; // Message signing driver (none default) //MySigningNone signer; // Select AtMega328 hardware profile MyHwATMega328 hw; // Construct MySensors library MySensor gw(radio, hw); MyMessage lightMsg(RELAY_1, S_LIGHT); void setup() { // Initialize library and add callback for incoming messages gw.begin(incomingMessage, AUTO, true); // Send the sketch version information to the gateway and Controller gw.sendSketchInfo("Relay", "1.0"); // Fetch relay status for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS;sensor++, pin++) { // Register all sensors to gw (they will be created as child devices) gw.present(sensor, S_LIGHT); // Then set relay pins in output mode pinMode(pin, OUTPUT); // Set relay to last known state (using eeprom storage) digitalWrite(pin, gw.loadState(sensor)?RELAY_ON:RELAY_OFF); } gw.send(lightMsg.set("0")); } void loop() { // Alway process incoming messages whenever possible gw.process(); } 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(message.sensor-1+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()); } }