pablozg / freeds

Derivador de energía solar excedente
GNU General Public License v3.0
98 stars 34 forks source link

MQTT issue #100

Closed geo99918 closed 2 months ago

geo99918 commented 6 months ago

Hi all,

I'm trying to control the FreeDS from MQTT but the code for topic subscription seems to be incomplete in the version I have on the board: "1.1.0018 Beta Build: 29072023 Web: 1.1.3" , not sure this is in sync with the public source code.

this is what I can observe on the mosquitto server:

1703681883: Received SUBSCRIBE from freeds_48e729a384c8
1703681883:     freeds_84C8/cmnd (QoS 0)
1703681883: freeds_48e729a384c8 0 freeds_84C8/cmnd  // <- here the subscription is incomplete or different
1703681883: Sending SUBACK to freeds_48e729a384c8

the FreeDS is subscribing for the "freeds_84C8/cmnd" topic, but in the source code I can see the following:

  static char topics[][12] = **{"pwm","pwmman","pwmmanvalue","screen","pwmfrec","brightness","pwmvalue"};**

  int nTopics = sizeof(topics) / sizeof(topics[0]);
  for (int i = 0; i < nTopics; i++)
  {
    sprintf(tmpTopic, "%s/cmnd/%s", config.hostServer, topics[i]); // <- here we're subcsribing to multiple topics of format <freeds>/cmnd/pwm pwmman ...
    mqttClient.subscribe(tmpTopic, 0);
    INFOV("Suscribing to topic %s\n",tmpTopic);
  }

and if I publish on the expected topic as in the source code it does not get sent to the FreeDS as it's not something that it subscribes to

1703704595: New connection from 127.0.0.1:46916 on port 1883.
1703704595: New client connected from 127.0.0.1:46916 as auto-597E9E4F-488E-D8A7-AD7D-F583CB6FF6BE (p2, c1, k60).
1703704595: No will message specified.
1703704595: Sending CONNACK to auto-597E9E4F-488E-D8A7-AD7D-F583CB6FF6BE (0, 0)
1703704595: Received PUBLISH from auto-597E9E4F-488E-D8A7-AD7D-F583CB6FF6BE (d0, q0, r0, m0, 'freeds_84C8/cmnd/pwmman', ... (1 bytes))  //<- here published to topic as observed in the source code.
// no sending to freeds
1703704595: Received DISCONNECT from auto-597E9E4F-488E-D8A7-AD7D-F583CB6FF6BE
1703704595: Client auto-597E9E4F-488E-D8A7-AD7D-F583CB6FF6BE disconnected.

on the other side, I tried to make the INFOV function dump some information on the weblog by using "weblog 1" in the web console but nothing happens ....

also tried to build from source (Release 1.1.0018 Beta), uploaded to new board but I get a nasty esp32 crash dump when logging in

Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC      : 0x400d43fc  PS      : 0x00060730  A0      : 0x800fa478  A1      : 0x3ffe8120
A2      : 0x00000000  A3      : 0x3ffcf3e4  A4      : 0x3ffde290  A5      : 0x3ffe8090
A6      : 0x00000000  A7      : 0x3ffe4380  A8      : 0x800d43f9  A9      : 0x3ffe8100
A10     : 0x3ffe8130  A11     : 0x3f400d72  A12     : 0xa07a8b5a  A13     : 0x3ffcf3e4
A14     : 0x00000000  A15     : 0x3ffe813c  SAR     : 0x00000017  EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000  LBEG    : 0x400014fd  LEND    : 0x4000150d  LCOUNT  : 0xfffffffa

ELF file SHA256: 0000000000000000

Backtrace: 0x400d43fc:0x3ffe8120 0x400fa475:0x3ffe8170 0x400f80f1:0x3ffe81b0 0x400f81b9:0x3ffe81f0 0x400f840d:0x3ffe8240 0x400eb055:0x3ffe8260 0x400eb135:0x3ffe82a0 0x400eb839:0x3ffe82c0 0x4008a736:0x3ffe82f0

anyone can give a hint here ?

Thank you, Geo

pablozg commented 6 months ago

Actualmente el codigo de las betas es totalmente nuevo y por diversos motivos no es público, pero si libre de uso, para controlar por mqtt tienes que enviar un json con el comando y la carga, puedes consultarlo en la página 30 del manual:

https://docs.google.com/document/d/1-XLCqHEbpqEPi4geI4CbANmGxodExC__zDvND89xjIU/edit?usp=sharing

Saludos.