Running hassio on ubuntu, mysensors gateway with nodemcu mqtt gateway and having mysensor nodes. hassio version 0.103.3.
I had used this earlier (maybe 2-3 monts ago) and it worked fine. We had some renovation and the nodes were out of use for a long time.
The problem is that mysensor node sends all the info through gateway to HA but HA does not create the entities. I updated the mysensor libraries to 2.3.2 (currently latest) before starting. Maybe it was bad idea. But for now I have no idea what to do next. Deleting the persistence (pickle) file didnt help either. Tried restarting the homeassistant multiple times but didn’t help either.
I checked from the mosquitto broker that the messages are coming in. I could use just mqtt sensors in HA but that is not the idea with mysensors.
Added logging to home assistant and to me it seems fine again. I filtered the below to show only debug entries.
2019-12-30 20:54:12 DEBUG (MainThread) [mysensors.gateway_mqtt] Subscribing to: mysensors-out/+/+/0/+/+, qos: 0
2019-12-30 20:54:12 DEBUG (MainThread) [mysensors.gateway_mqtt] Subscribing to: mysensors-out/+/+/3/+/+, qos: 0
2019-12-30 20:55:00 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 3;255;3;0;22;177057
2019-12-30 20:55:00 DEBUG (MainThread) [mysensors.gateway_mqtt] Publishing 3;255;3;0;19;
2019-12-30 20:55:00 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 3;255;0;0;17;2.3.2
2019-12-30 20:55:00 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 255
2019-12-30 20:55:00 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 3;255;3;0;6;0
2019-12-30 20:55:00 DEBUG (MainThread) [mysensors.gateway_mqtt] Publishing 3;255;3;0;6;M
2019-12-30 20:55:00 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 3;20;0;0;34;Juha button 1
2019-12-30 20:55:00 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 20
2019-12-30 20:55:00 DEBUG (MainThread) [mysensors.gateway_mqtt] Subscribing to: mysensors-out/3/20/1/+/+, qos: 0
2019-12-30 20:55:00 DEBUG (MainThread) [mysensors.gateway_mqtt] Subscribing to: mysensors-out/3/20/2/+/+, qos: 0
2019-12-30 20:55:00 DEBUG (MainThread) [mysensors.gateway_mqtt] Subscribing to: mysensors-out/3/+/4/+/+, qos: 0
2019-12-30 20:55:00 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 3;21;0;0;34;Juha button 2
2019-12-30 20:55:00 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 21
2019-12-30 20:55:00 DEBUG (MainThread) [mysensors.gateway_mqtt] Subscribing to: mysensors-out/3/21/1/+/+, qos: 0
2019-12-30 20:55:00 DEBUG (MainThread) [mysensors.gateway_mqtt] Subscribing to: mysensors-out/3/21/2/+/+, qos: 0
2019-12-30 20:55:00 DEBUG (MainThread) [mysensors.gateway_mqtt] Subscribing to: mysensors-out/3/+/4/+/+, qos: 0
2019-12-30 20:55:01 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 3;22;0;0;34;Tiina button 1
2019-12-30 20:55:01 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 22
2019-12-30 20:55:01 DEBUG (MainThread) [mysensors.gateway_mqtt] Subscribing to: mysensors-out/3/22/1/+/+, qos: 0
2019-12-30 20:55:01 DEBUG (MainThread) [mysensors.gateway_mqtt] Subscribing to: mysensors-out/3/22/2/+/+, qos: 0
2019-12-30 20:55:01 DEBUG (MainThread) [mysensors.gateway_mqtt] Subscribing to: mysensors-out/3/+/4/+/+, qos: 0
2019-12-30 20:55:01 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 3;23;0;0;34;Tiina button 2
2019-12-30 20:55:01 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 23
2019-12-30 20:55:01 DEBUG (MainThread) [mysensors.gateway_mqtt] Subscribing to: mysensors-out/3/23/1/+/+, qos: 0
2019-12-30 20:55:01 DEBUG (MainThread) [mysensors.gateway_mqtt] Subscribing to: mysensors-out/3/23/2/+/+, qos: 0
2019-12-30 20:55:01 DEBUG (MainThread) [mysensors.gateway_mqtt] Subscribing to: mysensors-out/3/+/4/+/+, qos: 0
2019-12-30 20:55:01 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 3;255;3;0;11;Bedcontrol
2019-12-30 20:55:01 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 255
2019-12-30 20:55:01 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 3;255;3;0;12;0.1
2019-12-30 20:55:01 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 255
2019-12-30 20:55:16 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 3;23;1;0;37;1
2019-12-30 20:55:16 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 23
2019-12-30 20:55:16 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: Bedcontrol 3 23: value_type 37, value = 1
2019-12-30 20:55:16 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 3;23;1;0;37;0
2019-12-30 20:55:16 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 23
2019-12-30 20:55:16 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: Bedcontrol 3 23: value_type 37, value = 0
2019-12-30 20:55:17 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 3;23;1;0;37;1
2019-12-30 20:55:17 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 23
2019-12-30 20:55:17 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: Bedcontrol 3 23: value_type 37, value = 1
2019-12-30 20:55:17 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 3;23;1;0;37;0
2019-12-30 20:55:17 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 23
2019-12-30 20:55:17 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: Bedcontrol 3 23: value_type 37, value = 0
2019-12-30 20:56:00 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 3;255;3;0;22;237058
2019-12-30 20:56:00 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 255
2019-12-30 20:56:00 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: Bedcontrol 3 23: value_type 37, value = 0
2019-12-30 20:56:54 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 3;255;0;0;17;2.3.2
2019-12-30 20:56:54 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 255
2019-12-30 20:56:54 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 3;255;3;0;6;0
2019-12-30 20:56:54 DEBUG (MainThread) [mysensors.gateway_mqtt] Publishing 3;255;3;0;6;M
2019-12-30 20:56:54 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 3;20;0;0;34;Juha button 1
2019-12-30 20:56:55 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 3;21;0;0;34;Juha button 2
2019-12-30 20:56:55 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 3;22;0;0;34;Tiina button 1
2019-12-30 20:56:55 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 3;23;0;0;34;Tiina button 2
2019-12-30 20:56:55 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 3;255;3;0;11;Bedcontrol
2019-12-30 20:56:55 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 255
2019-12-30 20:56:55 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 3;255;3;0;12;0.1
2019-12-30 20:56:55 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 255
2019-12-30 20:56:55 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: Bedcontrol 3 23: value_type 37, value = 0
2019-12-30 20:57:07 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 3;22;1;0;37;1
2019-12-30 20:57:07 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 22
2019-12-30 20:57:07 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: Bedcontrol 3 22: value_type 37, value = 1
2019-12-30 20:57:07 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 3;22;1;0;37;0
2019-12-30 20:57:07 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 22
2019-12-30 20:57:07 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: Bedcontrol 3 22: value_type 37, value = 0
2019-12-30 20:57:52 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 3;255;3;0;22;57072
2019-12-30 20:57:52 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 255
2019-12-30 20:57:52 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: Bedcontrol 3 23: value_type 37, value = 0
2019-12-30 20:57:52 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: Bedcontrol 3 22: value_type 37, value = 0
2019-12-30 20:58:52 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 3;255;3;0;22;117073
2019-12-30 20:58:52 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 255
2019-12-30 20:58:52 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: Bedcontrol 3 23: value_type 37, value = 0
2019-12-30 20:58:52 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: Bedcontrol 3 22: value_type 37, value = 0
2019-12-30 20:59:52 DEBUG (MainThread) [mysensors.gateway_mqtt] Receiving 3;255;3;0;22;177074
2019-12-30 20:59:52 DEBUG (MainThread) [homeassistant.components.mysensors.gateway] Node update: node 3 child 255
2019-12-30 20:59:52 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: Bedcontrol 3 23: value_type 37, value = 0
2019-12-30 20:59:52 DEBUG (MainThread) [homeassistant.components.mysensors.device] Entity update: Bedcontrol 3 22: value_type 37, value = 0
This is my configuration:
mysensors:
gateways:
- device: mqtt
topic_in_prefix: 'mysensors-out'
topic_out_prefix: 'mysensors-in'
optimistic: false
persistence: false #true
retain: false
version: '2.3'
This is my arduino code. It works by sending integer 1-3 to HA so I know if the button was one, double or long press. I checked that this type should be supported (and it was working earlier).
#include "OneButton.h"
// Enable debug prints to serial monitor
//#define MY_DEBUG
// Enable and select radio type attached
#define MY_RADIO_RF24
// Define fixed numbers for the
// controller - MY_NODE_ID
// sensors - CHILD_ID_xxx
#define MY_NODE_ID 3
#define CHILD_ID_JUHA_BUTTON1 20
#define CHILD_ID_JUHA_BUTTON2 21
#define CHILD_ID_TIINA_BUTTON1 22
#define CHILD_ID_TIINA_BUTTON2 23
#include <MyConfig.h>
#include <MySensors.h>
MyMessage MSjuhaButton1(CHILD_ID_JUHA_BUTTON1, V_LEVEL);
MyMessage MSjuhaButton2(CHILD_ID_JUHA_BUTTON2, V_LEVEL);
MyMessage MStiinaButton1(CHILD_ID_TIINA_BUTTON1, V_LEVEL);
MyMessage MStiinaButton2(CHILD_ID_TIINA_BUTTON2, V_LEVEL);
// Button locations
bool buttonDefault = LOW;
const int juhaButton1Pin = 5;
const int juhaButton2Pin = 6;
const int tiinaButton1Pin = 7;
const int tiinaButton2Pin = 8;
//classes for buttons
OneButton juhaButton1(juhaButton1Pin, buttonDefault);
OneButton juhaButton2(juhaButton2Pin, buttonDefault);
OneButton tiinaButton1(tiinaButton1Pin, buttonDefault);
OneButton tiinaButton2(tiinaButton2Pin, buttonDefault);
// Heartbeat times
unsigned long heartbeat_timer = 0;
void presentation()
{
// Register all sensors to gateway (they will be created as child devices)
present(CHILD_ID_JUHA_BUTTON1, S_VIBRATION, "Juha button 1", false);
wait(200);
present(CHILD_ID_JUHA_BUTTON2, S_VIBRATION, "Juha button 2", false);
wait(200);
present(CHILD_ID_TIINA_BUTTON1, S_VIBRATION, "Tiina button 1", false);
wait(200);
present(CHILD_ID_TIINA_BUTTON2, S_VIBRATION, "Tiina button 2", false);
wait(200);
// Send the sketch version information to the gateway and Controller
sendSketchInfo("Bedcontrol", "0.1", false);
}
void setup()
{
// Attach button click functions
juhaButton1.attachClick(juhaClick1);
juhaButton1.attachDoubleClick(juhaDoubleclick1);
juhaButton1.attachLongPressStart(juhaLongPressStart1);
tiinaButton1.attachClick(tiinaClick1);
tiinaButton1.attachDoubleClick(tiinaDoubleclick1);
tiinaButton1.attachLongPressStart(tiinaLongPressStart1);
juhaButton2.attachClick(juhaClick2);
juhaButton2.attachDoubleClick(juhaDoubleclick2);
juhaButton2.attachLongPressStart(juhaLongPressStart2);
tiinaButton2.attachClick(tiinaClick2);
tiinaButton2.attachDoubleClick(tiinaDoubleclick2);
tiinaButton2.attachLongPressStart(tiinaLongPressStart2);
}
void loop()
{
juhaButton1.tick();
tiinaButton1.tick();
juhaButton2.tick();
tiinaButton2.tick();
if( heartbeat_timer + 60000 < millis() )
{
heartbeat_timer = millis();
sendHeartbeat();
}
}
// Functions for acting to button press
void juhaClick1()
{
send(MSjuhaButton1.set(1));
wait(400);
send(MSjuhaButton1.set(0));
}
void juhaClick2()
{
send(MSjuhaButton2.set(1));
wait(400);
send(MSjuhaButton2.set(0));
}
void juhaDoubleclick1()
{
send(MSjuhaButton1.set(2));
wait(400);
send(MSjuhaButton1.set(0));
}
void juhaDoubleclick2()
{
send(MSjuhaButton2.set(2));
wait(400);
send(MSjuhaButton2.set(0));
}
void juhaLongPressStart1()
{
send(MSjuhaButton1.set(3));
wait(400);
send(MSjuhaButton1.set(0));
}
void juhaLongPressStart2()
{
send(MSjuhaButton2.set(3));
wait(400);
send(MSjuhaButton2.set(0));
}
void tiinaClick1()
{
send(MStiinaButton1.set(1));
wait(400);
send(MStiinaButton1.set(0));
}
void tiinaClick2()
{
send(MStiinaButton2.set(1));
wait(400);
send(MStiinaButton2.set(0));
}
void tiinaDoubleclick1()
{
send(MStiinaButton1.set(2));
wait(400);
send(MStiinaButton1.set(0));
}
void tiinaDoubleclick2()
{
send(MStiinaButton2.set(2));
wait(400);
send(MStiinaButton2.set(0));
}
void tiinaLongPressStart1()
{
send(MStiinaButton1.set(3));
wait(400);
send(MStiinaButton1.set(0));
}
void tiinaLongPressStart2()
{
send(MStiinaButton2.set(3));
wait(400);
send(MStiinaButton2.set(0));
}
// Message received functions from the central node
void receive(const MyMessage &message)
{
if (message.type == V_LIGHT)
{
if (message.sensor == CHILD_ID_JUHA_BUTTON1)
{
if (message.getBool()== 1)
{
}
else
{
}
}
}
}