GithubHelp home page GithubHelp logo

martin-ger / esp_mqtt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tuanpmt/esp_mqtt

292.0 292.0 68.0 4.96 MB

MQTT Broker/Bridge on the ESP8266

License: MIT License

Makefile 2.75% C 96.62% Parrot 0.64%
arduino esp8266 mqtt-bridge mqtt-broker

esp_mqtt's People

Contributors

axellin avatar eadf avatar eliabieri avatar frolswe avatar jensh avatar lorenzph avatar martin-ger avatar someburner avatar sreeisalso avatar st0ff3r avatar stefanbruens avatar tosa27 avatar tuanpmt avatar vowstar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esp_mqtt's Issues

error in make

................
/home/kim/opt/esp-open-sdk/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.5/../../../../xtensa-lx106-elf/bin/ld: build/app.out section .text' will not fit in region iram1_0_seg'
collect2: error: ld returned 1 exit status
Makefile:122: recipe for target 'build/app.out' failed
make: *** [build/app.out] Error 1

I got a error with newly updated data during make. How can I fix it?

Compiling for Arduino

I cannot seem to follow your instructions on the README to understand where mqtt_server.h is supposed to go. I keep getting file not found when compiling. When I've linked directly to that file, I get a 'cannot find user_interface.h. Everything else seems to be in the correct directories.

Can you break this down a little easier for someone like me? Thank you.

Using ESP as AP and local MQTT broker

I'm looking to use the ESP as an Access Point and run an MQTT broker on the ESP on a network hosted by the ESP. I can see how to set a host as an external MQTT provider, saying running on my home computer, but how do I set the client on the ESP, as local. And what is the IP to access this through something like Node-Red. I'm trying 192.168.4.1:1883 but no luck.

Help gratefully received.

problems with flash vars (@1..8)

Hi, how are you?
After some time dedicated to HW, back to using your wonderful esp_mqtt.

Doing a watering timer, I have some problems with flash variables: when I write a value shorter than the stored one, i get the 2 values mixed, like an overvrite.
Workaround: i add a space to numeric value
fragment (inside an 'on topic'):
setvar $tmp = (json_parse("value",$this_data) * 60000) // value = 1... 180. min: @2 60000... 10800000 ms for timer.
setvar @2 = $tmp // this not works
setvar @2 = $tmp | " " // this works for me (?)
println "Set howlong " | $tmp | " (" | @2 | ")" // only for test

Second problem:
The NTP client implementation do not uses Daylight saving time. So to get the rigth time, I change the TZ.
But this can be done only with a 'config', so not at run time inside an 'on topic'
So it is necessary the use of telnet to port 7777 to change TZ for DST.

Error with Static IP on STA

Hi Martin
I have tested the new firmware.
I have set a static IP address for the ESP in the uplink network (e.g. 192.168.1.250), saved and rebooted the ESP.
After this action, the other ESPs, the PC, a Mob have stopped to connect to the AP.
There was the connection but the DHCP service on the ESP_MQTT has stopped to work on the AP side.
FYI in the former esp_uMQTT_broker there wasn't this issue.

As a temporary solution I have reset the use of DHCP with a dynamic IP address for the ESP in the uplink network.
Now I can again connect the other devises to the AP using DHCP

Interrupts

Sorry, i have more problems.
The script.sonoff works well.
But if I add the fallowing code to enable a switch on GPIO 14

% The remote switch
on gpio_interrupt 14 nopullup
do
  println "New state GPIO 14: " | $this_gpio

The GPIO 0 (on board button) ceases to work.
But GPIO 14 works.
Strange.
Some limit on Interrupt use?
Best regards.
Marco

Sonoff: using GPIO1 and GPIO3

One more question:
there is in sp_mqtt a configuration that leaves the GPIO1 (tx) and GPIO3 (rx) totally free ? So they can be used as generic I/O by the user on script?
With Sonoff you do not have many pins available :)

Thanks, regards
Marco

Numeric Comparisons

Martin,
First I want to say thank you thank you for such a great bit of software! I am having difficulty with a script I am trying to create, and I cannot figure out how to do it. I receive a value from another MQTT client into this broker. This value is between 40.8 and 59.2. If the value is greater than 54.5 I want to turn on the relay. If the value is less than 51.7 I want to turn off the relay. I get an error when I load the script, I get an error. My script I'm having difficulty with is as follows:

on topic local $Voltage_topic
do
if $this_data > 54.5 then
setvar $relay_status = 1
gpio_out 14 $relay_status
gpio_out 13 not ($relay_status)
else
if $this_data < 51.7 then
setvar $relay_status = 0
gpio_out 14 $relay_status
gpio_out 13 not ($relay_status)
endif
endif

publish remote $Voltage_topic $this_data

Can you please show me what I am not understanding? Thanks in advance! Steve

Change Wifi AP name in user_config.h has no effect

Branch: Master
Commit: 6964c0e
Device: Sonoff switch

According to the "Usage" section of the README.md the default WIFI AP name can be changed by editing file user_config.h.
But when I change line 9 in user/user_config.h, it has no effect after flashing the device. I seems like the configurations are stored on some not flashed eeprom. Is this true? How can I overwrite those configurations?

When I change e.g. printf's in file user_main.c I see changes. So my tool chain and flashing works.

loop and recursion

Testing a recursive script, Sonoff goes on loop. Using the serial console (PuTTY) I get:

. . . . 
bcn 100   (here waits 3 sec)

 ets Jan  8 2013,rst cause:1, boot mode:(3,7)

load 0x40100000, len 30828, room 16
tail 12
chksum 0x40
ho 0 tail 12 room 4
load 0x3ffe8000, len 2124, room 12
tail 0
chksum 0x12
load 0x3ffe8850, len 10452, room 8
tail 12
chksum 0x86
csum 0x86
▒▒▒▒x▒n▒▒>r▒▒▒n▒b
▒l▒▒l`▒▒▒▒▒▒▒b▒r▒
                 n▒c▒8▒▒
r▒▒▒▒8  ▒▒


uMQTT Broker V2.0.4 starting

Config found and loaded
Starting Console TCP Server on port 7777
Max number of TCP clients: 15
mode : sta(ec:fa:bc:06:a7:a2) + softAP(ee:fa:bc:06:a7:a2)
add if0
add if1
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
bcn 100    (here waits 3 sec)
. . . 

I cannot insert any command !.
I also re-flashed the Sonoff (using last bin files) but it stiil loops :(
Any idea?
I'm trying to do iterations using 'on topic' as recursive function.
So it is possible that the script (wrong) goes in infinite loop, giving a stack error.
But flashing Sonoff don't clear the script?

Best regards
Marco

make issue

With the problem "wdt reset", I try remake the firmware.
Before "make" command, I changed the value of the "build area" in the Makefile, and wifi AP mode variable( ssid, and password) in "user_config.h" in user directory.
After correction, I applied "make" command at "user" directory but I got error....

kim@kim-R510-P510:~/opt/esp_mqtt/user$ make
LD build/app.out
/home/kim/opt/esp-open-sdk/sdk/lib/libmain.a(app_main.o): In function flash_data_check': (.irom0.text+0x770): undefined reference to user_init'
/home/kim/opt/esp-open-sdk/sdk/lib/libmain.a(app_main.o): In function flash_data_check': (.irom0.text+0xb27): undefined reference to user_init'
collect2: error: ld returned 1 exit status
../Makefile:122: recipe for target 'build/app.out' failed
make: *** [build/app.out] Error 1

How can I solved the problem?

Ability to configure softAP channel?

Brilliant product, thank you very much Martin.

I felt it would be very helpful if there was the ability to configure the WiFi channel that the softAP comes up on. When I bring up esp_mqtt in softAP plus station mode, it causes one device on my WiFi network to drop its network connection. I was hoping one could set a different channel for softAP vs station.

However I've subsequently learned that its a limitation of the esp8266; it has only one radio, so station and softAP will always be on the same WiFi channel. Permanent restriction then.
https://bbs.espressif.com/viewtopic.php?t=324

UI for setting up AP

Hi Martin,
In the README I see:
"While the user interface looks similar to my esp_wifi_repeater at https://github.com/martin-ger/esp_wifi_repeater", which leads me to believe that there is a GUI available at http://192.168.4.1 )or somewhere similar) which can be used to do the initial setup.

However when visiting 192.168.4.1 (or http://192.168.4.0) I simply get a timeout.

Am I wrong in my assumption, or am I accessing the UI incorrectly perhaps?

BTW the Telnet interface etc is all working fine.

Thanks.

enable PWM function?

What a nice project!
my project need PWM control. So how can I enable PWM function?
And where can I get the documents about scripting language used in "script.pir" and "script.sonoff"?

MQTT client id

I am exploring the esp_mqtt features, i found that:


CMD>show config
STA: SSID:FRITZ!Box 3272 PW:cirohomewifi
... omissis ....
MQTT client enabled
MQTT client host: 192.168.178.23
MQTT client port: 1883
MQTT client user: none
MQTT client password:
MQTT client id: ESPBroker_ 9c593 (!! space between '_' and '9')
MQTT SSL: off
NTP server: 1.it.pool.ntp.org (interval: 300 s, tz: 1)
Clock speed: 160
Serial bitrate: 115200


The MAC is DC:4F:22:09:C5:93 (i seen it on router).

I have also some more problems on script, maybe i will post again when it is more clear.
Thanks

Get Power data on MQTT with Sonoff Pow or Pow r2

Hello Martin,

I'm new with esp_mqtt. Thanks to your framework and scripts...I succeed in few hours to toggle the relay on a Sonoff Pow r2 with one of your script example. However, I need to read energy consumption data for my application, using MQTT.
Should I have to configure the UART ? How ?
Do you have an example that could help me ?...using Sonoff Pow would be great.
The Sonoff Pow r2 use the CSE7766. That's all I know.
Best regards

Laurent from Paris

set ntp publish interval

Thank you for useful Firmware.

After NTP sync has been completed successfully once,
the local time will be published every second under the topic "$SYS/broker/time" in the format "hh:mm:ss".

I want to set publish interval.

set ntp_local_interval1 600
set ntp_local_interval2 3600
set ntp_local_interval3 12:00:00
set ntp_local_interval4 0:00:00

the local time will be published every 10 minute under the topic "$SYS/broker/time1" in the format "hh:mm:ss".

the local time will be published every 60 minute under the topic "$SYS/broker/time2" in the format "hh:mm:ss".

the local time will be published at 12:00:00 under the topic "$SYS/broker/time3" in the format "hh:mm:ss".

the local time will be published at 00:00:00 under the topic "$SYS/broker/time4" in the format "hh:mm:ss".

open AP with ap_ssid MyAP not available

Hi there,
Your work seems great and just what I was looking for.
As I do not have the skill to build the code myself I am trying to use the pre-built binaries.

Flashing them to my NodeMCU seems to work fine (no error messages etc).
However, the 'open AP with ap_ssid MyAP' (or any other name for that matter) does not seem to show up for me to connect to.
Any guidance in this regard would be much appreciated.

Thanks.
Jan

Great working ! How to check the current number of clients connecting to this mqtt?

I have just tried on ArduinoIDE by default libmqtt.a,
and use mosquitto's clients connect to this mqtt-broker.
I have found that it can connect 10 clients, if more than it will be WDT's restart.

I want to count the number of clients by this mqtt server
for limitation and prevent WDT.

How can I count the number of clients by this mqtt server ?

Thank you.

"wdt reset"

After flashing ESP, broker startting message displayed.
And then configure loaded.
after a moment, ESP go to 'wdt reset'.

Any help?

Thankyou for PWM!

Size

Hi

This looks great but... 8 clients? I think my little IOT setup has about 15 ESP8266s talking to the broker - any chance of increasing that number or porting to the (now much cheaper than a few months ago) ESP32??

Request: "MQTT client user" too short for my cloud broker

Hi Martin,

First of all congratulate you for your great job.

I have a request for you. I can't publish or subscribe anything from my cloud broker because my "MQTT client user" is used as the TOKEN to connect to it and it is too short, in fact, it is too short for just 3 characters.

In addition to this, there are some cloud brokers that they need a longer "MQTT_client password" too.

By the way, there are a correction to do in the readme file in your github:
set mqtt_user password: Password for authentication -> set mqtt_password password...

I'd really appreciate you could increase the size of this configuration variables in next firmware update.

Thanks and keep it up!

CMD>show
Version V2.0.7 (build: Thu Jul 19 08:06:57 2018)
STA: SSID:TP-LINK_XXXXXX PW:XXXXXXXXXX
AP: SSID:MyAP PW:none [open] IP:192.168.4.1/24
Network console access on port 7777 (mode 3)
MQTT broker max. subscription: 30
MQTT broker max. retained messages: 30
MQTT client enabled
MQTT client host: XX.XX.XX.XX
MQTT client port: 1883
MQTT client user: XXX-ur1EjikpRuXXxNvd1Vua1r11aYh (3 characters are missing from my conf!!!)
MQTT client password:
MQTT client id: ESPBroker_23d0ad
MQTT SSL: off
NTP server: 1.pool.ntp.org (interval: 300 s, tz: 0)
Clock speed: 80
Serial bitrate: 115200

TCP console for Windows

Hello Martin,
May I know how to connect my windows PC to your firmware console using TCP port 7777? I type in my browser 192.186.X.Y:7777 but nothing happens.
Thank you in advance!

Joy

Static IP

Hello Martin,
Is it possible to assign static IP address on your firmware? What is the console command to do so?

Alarms per day

Awesome project!

Is there any way to set alarms per day in the script? Something like:
setalarm 1 "Fri 20:45"
setalarm 2 "Mon 21:45"
...

And/or to get the current day programmatically in the script? So as to make the choice there.

Thanks

Interrupt attachment in c not working

How do I add a interrupt to GPIO 0

This seems not to work (derived from user_basic/user_main.c):

#include "user_interface.h"
#include "mqtt/mqtt_server.h"
#include "user_config.h"
#include "easygpio.h"


static void sonoffBtnInterrupt(void* arg) {
  uint8_t value = easygpio_inputGet(13);
  easygpio_outputSet(13, !value);
}

int interruptOne = 42;

void ICACHE_FLASH_ATTR user_init() {
  struct station_config stationConf;

  // Initialize the UART
  uart_div_modify(0, UART_CLK_FREQ / 115200);

  os_printf("\r\n\r\nMQTT Broker starting\r\n");

  // Setup STA
  ...
  // Allow larger number of TCP (=MQTT) clients
  ...

  easygpio_pinMode(13, EASYGPIO_PULLUP, EASYGPIO_OUTPUT);
  easygpio_outputSet(13, 0); // turn on

  //easygpio_pinMode(0, EASYGPIO_PULLUP, EASYGPIO_INPUT);
  easygpio_attachInterrupt(0, EASYGPIO_PULLUP, &sonoffBtnInterrupt, &interruptOne);

  //Start MQTT broker
  MQTT_server_start(MQTT_PORT, MQTT_MAX_SUBSCRIPTIONS, MQTT_MAX_RETAINED_TOPICS);
}

Storing Config

Hi -
I've been looking into using spi-flash lib to store config info for another project, and have been having trouble figuring out where exactly the 4096 byte sector should be. I looked at your config_flash.c/.h files to see if I could find out what you were using for the 4096 byte block, and it appears you use FLASH_BLOCK_NO * SPI_FLASH_SEC_SIZE or 0xc *4096 = 0xc000. I'm not at all familiar with the ESP memory map (and find what's on the web to be very confusing), but this address seems low to me. so I wanted to check with you if I understood this correctly. I would in fact like to take (most of) your two files and include them in my project as they do exactly what I want. The only issue is I don't fully understand where the config is going, and why.

Thanks for your time.
Ron

What is the correct LED behavior?

Hi,

I was trying to upload the firmware to a NodeMCU but have no success seeing the SSID MyAP:

  • LED stays unlit after upload
  • If I press reset, LED will start a blink pattern
  • If I unplug the USB cable and replug, LED stays unlit until I press reset

What is the correct LED behavior to indicate a proper upload?
Thank you.

Arduino example

Can you write a simple example of an Arduino project using the differents functions of the esp_uMQTT_broker ?

Wemos mini PRO 16 MB

Hi Martin,
gibt einen Möglichkeit zu einen Wemos mini pro zu tragen?
Ich habe allein versucht aber keine maniere.
Vielen dank im Voraus.
SG,
Pablo.

not stable after enable auth

hello,
the mqtt borker become not stable after enable the MQTT_server_onAuth,
once the client disconnected, the system will restart.
here is the logs:

Connecting to chan's house
..
WiFi connected
IP address: 
192.168.10.251
Starting MQTT broker

username is: admins

received topic 'console' with data 'sss'
received topic 'console' with data 'sss'

Exception (9):
epc1=0x40237ec2 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000313 depc=0x00000000

ctx: sys 
sp: 3ffff9c0 end: 3fffffb0 offset: 01a0

>>>stack>>>
3ffffb60:  5720fa7f 00000004 3fff1dc4 40237a37  
3ffffb70:  00000000 3fff2468 3fff23dc 4022eefb  
3ffffb80:  3fffdaf0 00000000 3fff23dc 4022d002  
3ffffb90:  00000220 00000000 00000000 00000000  
3ffffba0:  00000000 00000000 00000000 00000000  
3ffffbb0:  00000000 00000000 00000000 00000000  
3ffffbc0:  00000000 00000000 00000000 00000000  
3ffffbd0:  9115efab 6d1b6545 506b7749 f7c72ca3  
3ffffbe0:  54a91448 d4a1d253 ab1dd0bd 7e673713  
3ffffbf0:  51ee6c81 195d89d9 c44c1358 21d5a378  
3ffffc00:  4000b5f9 00000008 00000038 3ffffce0  
3ffffc10:  00000008 3ffffce0 682c22ad 673a7d4e  
3ffffc20:  5ab69bbd ad5b4f7e b5761552 39cd3c1c  
3ffffc30:  ec7bd841 64000520 fc222ec2 fd1d8ea0  
3ffffc40:  ffc5d31b baf9fc59 9bd3347d abb747f1  
3ffffc50:  b0f50535 9fe0c482 7d73b811 408b66b8  
3ffffc60:  f605df9c 37f82f23 6ada6bb7 bb55cf62  
3ffffc70:  f874f309 991aa1fb bacd7dad 7935b634  
3ffffc80:  d62abc67 ab6e555c 592c56f8 387e3fd4  
3ffffc90:  00000005 00000000 00000020 40100ec2  
3ffffca0:  3ffe8fc5 401042bf 3ffeca50 40100ec2  
3ffffcb0:  40101bdd 3ffeca50 3ffeca28 3ffffd40  
3ffffcc0:  00007fff 08cf71ca 3ffed494 40101dae  
3ffffcd0:  3ffe987c 00000000 00000000 40101dae  
3ffffce0:  00007fff 08cf71ca 401021ee 00000100  
3ffffcf0:  7fffffff 3ffe987c 4021b153 00000001  
3ffffd00:  ffffffff 00000000 3ffe9111 00000008  
3ffffd10:  4021b1a2 3ffec668 3fff0ba4 00020021  
3ffffd20:  4021b2ae 3ffec668 3fff0ba4 3ffec668  
3ffffd30:  00000002 00000000 00000020 40100ec2  
3ffffd40:  3ffe8fc2 4021a27b 3ffec668 3fff104f  
3ffffd50:  00000000 4020d8eb 3fff1e0c 3fff104f  
3ffffd60:  00000000 00000002 00000000 3ffec668  
3ffffd70:  3fff2306 40224210 3fff2306 3fff22cc  
3ffffd80:  3fff101c 40224210 3fff2306 3fff22cc  
3ffffd90:  3fff101c 00000000 0000001f 00000002  
3ffffda0:  3fff03e8 00000003 3fff101c 402244e1  
3ffffdb0:  3ffe8fc5 401042bf 3ffeca28 402244e1  
3ffffdc0:  40101bdd 3ffeca28 00000003 3fff22cc  
3ffffdd0:  3fff22cc 3fff2218 3fff101c 40224730  
3ffffde0:  40103209 00040000 7fffffff 00000000  
3ffffdf0:  00000022 40103206 00040000 40225664  
3ffffe00:  3ffed188 40102132 00000000 401004d8  
3ffffe10:  3fff2218 3fff2214 00002000 4000050c  
3ffffe20:  3fffc278 40101f88 3fffc200 00000022  
3ffffe30:  3ffffe40 00000001 3fff22cc 00000080  
3ffffe40:  402381fe 00000030 0000001c ffffffff  
3ffffe50:  4022ce58 3fff1da4 3fffdcc0 00000014  
3ffffe60:  3ffee240 00000000 00000000 3fff2388  
3ffffe70:  ffffffff 3fffc6fc 0000005c 00000000  
3ffffe80:  3fff121c 3fff0650 3fff235c 00000030  
3ffffe90:  40228a8d 00000000 0000001a 40106acc  
3ffffea0:  402217fa 3fff2218 3fff2214 40221811  
3ffffeb0:  3fff1dc4 3fff2328 00000006 00000001  
3ffffec0:  00000024 00000036 3ffeca28 3fff04d4  
3ffffed0:  3fff2214 3fff04f0 00000000 4022704a  
3ffffee0:  00000001 0104a8c0 00000011 00000000  
3ffffef0:  40237d58 00000011 3ffe9010 00000030  
3fffff00:  002c0000 06e83a2e 515c5803 3fff235c  
3fffff10:  3fff0650 3fff1da4 00000000 4023931b  
3fffff20:  3ffeee50 0000039d 0000039d 4010020c  
3fffff30:  3ffeee50 0000038a 0000038a 4010020c  
3fffff40:  00000000 3ffe8d1f 3fff2344 4010068c  
3fffff50:  3fff0650 3ffe8a40 3fff23dc 40106acc  
3fffff60:  4023767e 3fff121c 3fff2344 40238a16  
3fffff70:  3fff0650 3fff121c 3fff2344 40238bcd  
3fffff80:  4010085e 00000002 00000000 3fff1074  
3fffff90:  40219ee2 3fffdab0 00000000 3fff0678  
3fffffa0:  3fffdc60 00000000 3fffdab0 40000f49  
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
v00000000
~ld


Connecting to chan's house
..
WiFi connected
IP address: 
192.168.10.251
Starting MQTT broker

Local and remote

(continue)
I make a simple 'flow' in node red: a catch-all with debug echo, and 3 commands: blink, toggle, off.
2018-02-03 200517 shot
All looks working.
But I don't see the commands I expect in debug window.
To be more explicit I change 2 lines: 53 and 95 (about). I replace remote payload:
publish remote $status_topic $relay_status retained with
publish remote $status_topic "{Time:" | $timestamp | ",Power:" | $relay_status | "}" retained

In debug window i see:
2018-02-03 200532 shot

and on console only
2018-02-03 201720 shot
No echo of remotes commands. For remotes commands I expect a remote echo and a local echo. (?) But this can be a Putty problem.

Maybe I am confused between 'local' and 'remote', but how to send status to mosquitto?
More:
the lines: publish local $status_topic $relay_status retained looks to me useless. None uses the 'local' status topic, the program uses only 'local' commands.
Best regards.
m.s.

Internet routing

Hi,
I would be useful to allow internet routing, as your esp_wifi_repeater do (possibly as a bridge, no NAS). Is it a problem to add such a feature?
Thanks
Hynek Baran

Script how to subscribe to # ?

In my script I can subscribe and receive specific events no problem.
But if I try to receive all events first I get script error because of # "Error (number of hexdigits must be multiple of 2) at >># on topic local "#...
If I put # in double or single quotes it accepts the script but no topics are matched and printed to serial_out. Also tried #.

on init
do
subscribe local #

on topic local #
do
serial_out "Received: " | $this_topic | " , " | $this_data

Is there some other trick to subscribe to # ?

Thanks!

PlatformIO flashing?

I am farly new to programming an ESP8266, so it might be a dump question.
Is it possible to flash this firmware to the ESP using PlatformIO?

Flashing the firmware binaries to a sonoff

Hey there ....

i was downloading the prebuild binaries from the firmware folder:
0x00000
0x10000
I'm little bit confused...
Have i flash the 0x10000 to 0x02000 like in the picture or have i flash it to 0x10000?
I tryed out both Variants, with all the settings like the manual Picture from ESP Download Tool, but nothing will happen after flashing....
Also tryed out with Flash Size 8Mb and 32Mb and Baud 15200 and 220400.

What i'm doing wrong?

Request: "MQTT client user" too short for my cloud broker #48

Hi martin

I tested the new version, as you can see, mqtt_user and mqtt_password are still truncated. MQTT client is still disconnected.

I stay tunned for next version.

Regards

CMD>show
Version V2.0.8 (build: Wed Jan 2 07:52:51 2019)
STA: SSID:XX-XXXX_XXXXXX PW:XXXXXXXXXX
AP: SSID:MyAP PW:none [open] [disabled] IP:192.168.4.1/24
Network console access on port 7777 (mode 3)
MQTT broker max. subscription: 30
MQTT broker max. retained messages: 30
MQTT client enabled
MQTT client host: XXXXXXXXXXXXX
MQTT client port: 1883
MQTT client user: XXX-ur1EjikpRuXXxNvd1Vua1r11aYh ->(Still truncated)
MQTT client password: XXX8545XXX204ea7bXXXfe42ebXXXf6e ->(Still truncated)
MQTT client id: ESPBroker_07b533
MQTT SSL: off
NTP server: 1.pool.ntp.org (interval: 300 s, tz: 0)
Clock speed: 80
Serial bitrate: 115200

Originally posted by @abaubi in #48 (comment)

Console with 'script' command.

My test configuration: Win 10, mosquitto, node-red, Putty.
On Putty console I get:

    CMD>show config
    STA: SSID:FRITZ!Box 3272 PW:cirohomewifi
    AP:  SSID:MQTT_home PW:sonoffbroker IP:192.168.4.1/24
    Network console access on port 7777 (mode 3)
    MQTT broker max. subscription: 30
    MQTT broker max. retained messages: 30
    MQTT broker max. clients: 0
    MQTT client enabled
    MQTT client host: 192.168.178.23
    MQTT client port: 1883
    MQTT client user: none
    MQTT client password:
    MQTT client id: ESPBroker_ 9c593
    MQTT SSL: off
    NTP server: 1.it.pool.ntp.org (interval: 300 s, tz: 1)
    Clock speed: 160
    Serial bitrate: 115200
    CMD>show stats
    System uptime: 0:03:28
    Free mem: 18896
    Interpreter loop: 65982 us
    External IP-address: 192.168.0.53
    0 Stations connected to AP
    NTP synced: 20:24:19
    CMD>echo config       (hops!)

    Invalid Command       (one blak line before message 'Invalid command')
    CMD>

All ok. Now I send a 'script delete' (I must do it before any new srcript ) the I download the script.
(It is 'script.sonoff', modifiend ONLY on start config as you see before)

   CMD>script http://192.168.178.23:85/www/sonoff/sonoffscript02.txt
   HTTP request to http://192.168.178.23:85/www/sonoff/sonoffscript02.txt started
   HTTP script download completed (2733 Bytes)
   _

Here it stops: no [CMD>] prompt, and I never seen the "Syntax okay" message.
I must press [CR], the prompt shows, and then I can do the 'reset' command.
(continue)

MQTT: Out of mem

Hi,

I think this is very useful project for small IoT devices.
I have found a minor issue if a client give NULL password to the broker...

For examble,

mosquitto_sub -h 192.168.4.1 -d -u "user" -P "" -t hello
mosquitto_pub -h 192.168.4.1 -u "user" -P "" -t hello -m message

There are always "MQTT: Out of mem" in the debug log due to the following conditions in mqtt_server.c at line number 532.

if (password != NULL)
clientcon->connect_info.password = (char *)os_zalloc(password_len+1);
if (clientcon->connect_info.password != NULL) { ...

In that case, the value of 'clientcon->connect_info.password' will be always NULL.

SJ

Script

Testing scripts I found a unespected behaviour:
This is accepted:

       publish remote $status_topic "{Time:" | $timestamp | ",TOGGLE}"  retained

But this not:

       publish remote $status_topic | "/user" "{Time:" | $timestamp | ",ON}" retained

With the message:
Error (action command expected) at >>"/user "{Time: | $timestamp | ",ON} retained publish
P.S.
I seen the BNF_: <topic_id> < exp r >, so <topic_id> can't be an expression. OK

One more note:
for a better utilization of 4000 script bytes, maybe it is possible to:

  • trim() any line before storage
  • reduce any comment line to only starting '%' (so the line numbers are respected) before storage

Best regards
Marco

Telnet Console Timeout

Is there a way to prevent the telnet console from timing out? Somewhat annoying to have to restart the session.

Thanks.

Password length limit?

Hi,

Is there a limit on the password length for mqtt_password?
I'm trying to add a remote mqtt broker, it always has 1 missing character in the password after set mqtt_password

Tested on ESP32?

Fantastic work - game changer for IOT on MQTT!
Have you tested this on the ESP32 by any chance? It has considerable more system resources so could be more viable.

Thanks.

ssid with spaces

My wifi AP is "FRITZ!Box 3272", but the command 'set ssid' cut it.
transcript:
scandone
no FRITZ!Box found, reconnect after 1s
disconnect from ssid FRITZ!Box, reason 201
reconnect
scandone
....... infinite loop

Firmware

Hi,
I flashed the firmware in the firmware directory onto an esp8266(Wemos D1) using ESP8266 Download Tool and if I use the terminal tools like Putty or Hyperterminal, I am unable to write any script.
Tried with both SPI modes QIO and DIO.
Flash size 32Mbit. Baud rate - 230400
I am getting some continuous symbols on the terminal window and the led on esp is flashing continuously.
It would be great if get some help regarding this.
I am using a windows 10 machine,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.