mycontroller-org / mycontroller-v1-legacy

The Open Source Controller
http://www.MyController.org
Apache License 2.0
147 stars 90 forks source link

MyController Is Unable To Parse MySensors Messages #357

Closed mzcs closed 7 years ago

mzcs commented 7 years ago

Hi There Again :)

Assistance On This Issue, Too, Will Be Highly Appreciated :)

I've Found That MyController Is Unable To Parse MySensors Messages, Or That At Least Is The Sole Error That Appears In The Log-File : mycontroller.log.mysensors_prot_bug

*

My Hardware Configuration -

[ Raspberry Pi 3 v1.2: Also As a WiFi AP ] <-WiFi-> [ 1x ESP8266-Based NodeMcu v1.0: GW + Sensors (Light:TSL2561, Temp:LM75A) ]

*

My Software Configuration (for RPi) -

Gentoo Linux ( Kernel v4.9.8, Raspberry Pi Foundation Branch ) Mosquitto MQTT-Broker - v1.4.10 MySQL DB - v5.6.35 Oracle JDK - v1.8.0_121 MyController - git 'development' branch, rev# 72d4c48

*

My Software Configuration (for ESP8266) -

Arduino IDE v1.6.13 (Linux x86_64) ESP8266 Arduino-Port - git 'master' branch, rev# e9dea9af999c324c55fe2f4ecfb16fa2f9e867c5 MySensors Arduino-Library - v2.1.1 (Transport = MQTT)

*

MyController Configuration :


mcc.resources.location=../conf/resources/

mcc.db.backup.include=true

mcc.db.type=MYSQL
mcc.db.url=jdbc:mysql://127.0.0.1:3306/MyController
mcc.db.username=<...>
mcc.db.password=<...>

mcc.web.bind.address=0.0.0.0
mcc.web.enable.https=true
mcc.web.http.port=8443
mcc.web.file.location=../www/
mcc.web.ssl.keystore.file=../conf/keystore.jks
mcc.web.ssl.keystore.password=mycontroller
mcc.web.ssl.keystore.type=JKS

mcc.persistent.stores.location=../conf/persistent_stores/
mcc.clear.message.queue.on.start=false
mcc.clear.smart.sleep.msg.queue.on.start=false

mcc.mdns.service.enable=false

*

MyController - Gateway/Node/Sensors Configuration + System Stats (from Web UI) :

screenshot_20170209_015211

screenshot_20170209_015247

screenshot_20170209_004325

screenshot_20170209_004434

screenshot_20170209_010118

screenshot_20170209_010149

screenshot_20170209_010214

*

Arduino 'Sketch' (Relevant Parts) :

struct My_Config_t
{
String WLAN_STA_SSID = "";
String WLAN_STA_PASSWD = "";
String MQTT_Broker_FQDN = "";
IPAddress MQTT_Broker_IP;
uint16_t MQTT_Broker_Port = 0;
} My_Config;

#define MY_GATEWAY_FEATURE
#define MY_GATEWAY_ESP8266
#define MY_GATEWAY_MQTT_CLIENT
#define MY_MQTT_CLIENT_ID  (String("mysensors-gw-esp_") + String(ESP.getChipId(), HEX)).c_str()
#define MY_MQTT_PUBLISH_TOPIC_PREFIX (String("root1/") + (String("mysensors-gw/esp_") + String(ESP.getChipId(), HEX)) + String("/out")).c_str()
#define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX (String("root1/") + (String("mysensors-gw/esp_") + String(ESP.getChipId(), HEX)) + String("/in")).c_str()
#define MY_CONTROLLER_URL_ADDRESS ((My_Config.MQTT_Broker_FQDN).c_str())
#define MY_PORT (My_Config.MQTT_Broker_Port)
#define MY_GATEWAY_MAX_CLIENTS 1

#if !defined(MY_SERIALDEVICE)
#define MY_SERIALDEVICE Serial
#endif

uint8_t MYS_childSensorId1 = 0;
uint8_t MYS_childSensorId2 = 1;
uint8_t MYS_childSensorId3 = 2;

MyMessage MYS_dimmerMsg(MYS_childSensorId1, V_PERCENTAGE);
MyMessage MYS_statusMsg(MYS_childSensorId1, V_STATUS);
MyMessage MYS_lightMsg(MYS_childSensorId2, V_LEVEL);
MyMessage MYS_tempMsg(MYS_childSensorId3, V_TEMP);

void setup()
{
MY_SERIALDEVICE.println("setup() : Hello !");

requestTime(); // requests time from controller (mySensors NTP-ish)

request( MYS_childSensorId1, V_PERCENTAGE ); // request the formerly-set light-level from the controller
}

void presentation()
{
    MY_SERIALDEVICE.println("presentation() : Hello !");

    sendSketchInfo("Capstone_2016", "1.0");

    present( MYS_childSensorId1, S_DIMMER, (String("Dimmer_Light_1")).c_str(), true );
    present( MYS_childSensorId2, S_LIGHT_LEVEL, (String("Sensor_Light_1")).c_str(), true );
    present( MYS_childSensorId3, S_TEMP, (String("Sensor_Temperature_1")).c_str(), true );
}

void loop()
{
    send(MYS_lightMsg.set(some_variable_to_hold_light_lux, 3));
    send(MYS_tempMsg.set(some_variable_to_hold_temp_deg_c, 3));

    wait(3000); // Wait for a specified amount of time to pass. Keeps process()ing. This does not power-down the radio nor the Arduino. Because this calls process() in a loop, it is a good way to wait in your loop() on a node that listens to messages.
}

void receive(const MyMessage &message)
{
/* <...> */
}

void receiveTime(unsigned long time)
{
/* <...> */
}

jkandasa commented 7 years ago

@mzcs Thank you! Fix available in latest SNAPSHOT version.

mzcs commented 7 years ago

Thank You, Dear Mr. Kandasamy ! :)

jkandasa commented 7 years ago

@mzcs Does this fix addresses your issue?

mzcs commented 7 years ago

It Did & Thanks Again ! :)