Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Console commands not working #152

Closed
tam481 opened this issue Dec 21, 2016 · 22 comments
Closed

Bug: Console commands not working #152

tam481 opened this issue Dec 21, 2016 · 22 comments

Comments

@tam481
Copy link

tam481 commented Dec 21, 2016

Hello,
Once again, thanks for the amazing firmware.

I haven't been able to send commands to Sonoff since version 3.0.3. I don't think it's that particular build. It's just when I noticed the issue.

I've tried resetting to default configs to no avail. Cleared cookies, tried a different browser but nothing happens when I enter commands and hit enter.
I've tried
cmnd/home/bedroom/sonoff Reset 2
cmnd/home/bedroom/sonoff Reset2
Reset 2
Restart
cmnd/home/bedroom/sonoff Restart

In the past entering the wrong syntax would result in an MQTT error now nothing happens.

I've also tried overwriting the firmware with NodeMCU then loading this firmware again to no avail.

I'm now running 3.1.0 and still experiencing the same issue. The reason why I tried this is because MQTT keeps turning the light ON after upgrading regardless even if the "retained" message is OFF and I wanted to do a complete "Reset 2" to clear everything.

@tam481
Copy link
Author

tam481 commented Dec 21, 2016

Using MQTT-Spy
I can see that the status of cmnd and stat can have a different status so that the last cmnd is ON while stat is OFF which is odd given that stat should reflect the last message sent by the last cmnd!

However, the issue with the relay turning on automatically after an upgrade persists still even when cmnd and stat are both set to OFF so I'm not sure how MQTT could be causing this issue.

I hope this helps.

I know the "issue" is to do with commands but I stumbled upon that while trying to fix the automatic ON issue.

@arendst arendst changed the title Console commands not working Help: Console commands not working Dec 30, 2016
@tam481
Copy link
Author

tam481 commented Jan 6, 2017

Hello all,
Update: managed to resolve the MQTT issue by deleting my MQTT db and starting again which is fine as I don't have that many devices.

However, I cannot get Console commands to work no matter what browser I use. I used to modify the user_config.h file but moved to using the override file in the hope of fixing whatever is broken to no avail. What can I do to get the Console to work?

I enter a command then hit enter and nothing happens.

@arendst
Copy link
Owner

arendst commented Jan 6, 2017

You might try to execute command weblog 2 in the console...

@tam481
Copy link
Author

tam481 commented Jan 6, 2017

Tried that to no avail!
I can see the hourly tele status reports

@tam481
Copy link
Author

tam481 commented Jan 6, 2017

I can publish the command via MQTT and I can see it in the console after publishing it via MQTT. It's jus the web version that doesn't work.

@arendst
Copy link
Owner

arendst commented Jan 6, 2017

What is the exact text you type in the console?

@tam481
Copy link
Author

tam481 commented Jan 6, 2017

weblog 2

Also tried

cmnd/home/livingroom/TableLamp/weblog 2

@arendst
Copy link
Owner

arendst commented Jan 6, 2017

First stop using the complete topic as there is no need for it. It already knows it is on cmnd/home/livingroom/TableLamp.

Second how did you configure the cmnd/home/livingroom/TableLamp?
What part is defined in SUB_PREFIX and what part in TOPIC?

@tam481
Copy link
Author

tam481 commented Jan 6, 2017

I had been using the "shortened" but thought I'd try the full thing.

I'm using the following in the override file:
#ifdef PROJECT
#undef PROJECT
#endif
#define PROJECT "TableLamp"

#ifdef SUB_PREFIX
#undef SUB_PREFIX
#endif
#define SUB_PREFIX "cmnd/home/livingroom"

@arendst
Copy link
Owner

arendst commented Jan 6, 2017

Do you see more information if you execute weblog 3?

@tam481
Copy link
Author

tam481 commented Jan 6, 2017

No. It's as if nothing happened.

@tam481
Copy link
Author

tam481 commented Jan 6, 2017

Tried with my second Sonoff and getting the same thing i.e. nothing happens

@arendst
Copy link
Owner

arendst commented Jan 6, 2017

And if you execute it from your mqtt client: cmnd/home/livingroom/TableLamp/weblog 3 (the topic is case sensitive!)

@tam481
Copy link
Author

tam481 commented Jan 6, 2017

I get this when I do it via the mosquitto_pub utility.

16:58:08 MQTT: stat/home/livingroom/TableLamp/WEBLOG = 3
16:58:08 Config: Saved configuration (928 bytes) to flash at F8 and count 39

@arendst
Copy link
Owner

arendst commented Jan 6, 2017

That's correct. Now try from the console command status. What do you see in the console and what does the MQTT server see?

@tam481
Copy link
Author

tam481 commented Jan 6, 2017

now status returns:
17:07:41 HTTP: Handle console

@tam481
Copy link
Author

tam481 commented Jan 6, 2017

In fact, any command such as weblog 3 and weblog 2 returns Handle console

@arendst
Copy link
Owner

arendst commented Jan 6, 2017

That's correct as it is the extra information enabled by option 3 of the weblog command. Puzzling is why the other messages are not being shown...

17:09:22 HTTP: Handle console
17:09:22 MQTT: DataCb Topic sonoff, Group 0, Index 1, Type STATUS, Data  ()
17:09:22 MQTT: stat/sonoff/RESULT = 3.1.11b, 1, sonoff, 0, POWER, 0, 3, 1, 1, 1, 1, 0, 0

@BuilderBrian
Copy link

BuilderBrian commented Jan 6, 2017 via email

@arendst
Copy link
Owner

arendst commented Jan 6, 2017

I can reproduce! If I use your PUB_PREFIX (cmnd/home/livingroom) and SUB_PREFIX (stat/home/livingroom) it fails too.

Current workaround: do not change the default PUB_PREFIX and SUB_PREFIX or at least do not use / in it. cmnd_home_livingroom is fine.

I'll investigate but not in due time

@tam481
Copy link
Author

tam481 commented Jan 6, 2017

That's great. Thank you @arendst and also @BuilderBrian. I'll change it to use the default until you fix it in a future release :-)

@arendst arendst added the bug label Jan 7, 2017
arendst added a commit that referenced this issue Jan 7, 2017
3.1.13 20170107
* Fix web console command input when SUB_PREFIX contains '/' (#152)
* Add command response to web command (#200)
* Add option to disable MQTT as define USE_MQTT in user_config.h (#200)
@arendst
Copy link
Owner

arendst commented Jan 7, 2017

Fixed in version 3.1.13 just released

@arendst arendst added the solved label Jan 7, 2017
arendst added a commit that referenced this issue Jan 7, 2017
3.1.14 20170107
* Add support for command TOGGLE (define MQTT_CMND_TOGGLE) when
ButtonTopic is in use and not equal to Topic (#207)
* Fix web console command input when SUB_PREFIX contains '/' (#152)
* Add command response to web command (#200)
* Add option to disable MQTT as define USE_MQTT in user_config.h (#200)
@arendst arendst changed the title Help: Console commands not working Bug: Console commands not working Jan 8, 2017
@arendst arendst closed this as completed Jan 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants