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

"Waiting" continues. #4

Open
leechan10 opened this issue May 19, 2019 · 16 comments
Open

"Waiting" continues. #4

leechan10 opened this issue May 19, 2019 · 16 comments

Comments

@leechan10
Copy link

I want to know why data is not displayed.

I'm using the HCSR04 sensor.

image

image

Like the second picture, data is received continuously.
but In the mirror, like first picture,
data is not displayed and "Waiting" is displayed.

Could you please help me..?

This is my Arduino code.

image

image

This is my config.js file.

image

I need help.. please help me..

@misijan1cz
Copy link

I have the same problem. Trying running with example settings and still...waiting...and every 3 minutes shows the "Arduino connected successfully" prompt.

@Dentrax
Copy link
Owner

Dentrax commented Mar 28, 2020

@leechan10 @misijan1cz

I am sorry to hear that is not working stable anymore. I didn't test very-well because I had running out-of-time to complete this RTOS assignment.

Maybe an-updated JS or Python library can cause this bug. I have put log things on to all possible else situations. Can you please share all the logs that you've received from terminal?

Sorry for the late answer. Any PRs are welcomed. :)

@misijan1cz
Copy link

misijan1cz commented Apr 2, 2020

I'm sorry for my late response.

ArduPort Log:

...
[2020-04-02 16:55:32.950] [LOG] Initializing new module helper ...
[2020-04-02 16:55:32.951] [LOG] Module helper loaded: MMM-ArduPort
[2020-04-02 16:55:32.956] [LOG] Initializing new module helper ...
...
[2020-04-02 16:55:33.101] [LOG] All module helpers loaded.
...
[2020-04-02 16:55:33.327] [LOG] Connecting socket for: MMM-ArduPort
[2020-04-02 16:55:33.328] [LOG] [MMM-ArduPort]:: Starting node_helper for module [MMM-ArduPort]
...
[2020-04-02 16:55:33.367] [LOG] Sockets connected & modules started ...
[2020-04-02 16:55:33.563] [LOG] Launching application.
...
[2020-04-02 16:55:42.476] [LOG] { debug: 'SerialPort shell started...' }
[2020-04-02 16:55:42.484] [LOG] undefined[MMM-ArduPort] SerialPort shell started...
[2020-04-02 16:55:42.485] [LOG] { debug: 'Waiting Ardunio to connect on port...' }
[2020-04-02 16:55:42.487] [LOG] undefined[MMM-ArduPort] Waiting Ardunio to connect on port...
[2020-04-02 16:55:42.488] [LOG] { status: { name: 'connect', data: 'connected' } }
[2020-04-02 16:55:42.490] [LOG] { name: 'connect', data: 'connected' }
[2020-04-02 16:55:44.729] [LOG] { status: { name: 'setup', data: 'starting' } }
[2020-04-02 16:55:44.731] [LOG] { name: 'setup', data: 'starting' }
[2020-04-02 16:55:45.229] [LOG] { status: { name: 'setup', data: 'started' } }
[2020-04-02 16:55:45.234] [LOG] { name: 'setup', data: 'started' }
[2020-04-02 16:55:47.563] [LOG] { sensor: { name: 'T', data: '21' } }
[2020-04-02 16:55:47.582] [LOG] { sensor: { name: 'Hum', data: '35' } }
[2020-04-02 16:55:47.585] [LOG] { sensor: { name: 'CO2', data: '1200' } }
...
[2020-04-02 16:55:58.829] [LOG] { sensor: { name: 'T', data: '21' } }
[2020-04-02 16:55:58.934] [LOG] { sensor: { name: 'Hum', data: '35' } }
[2020-04-02 16:55:59.040] [LOG] { sensor: { name: 'CO2', data: '1200' } }
[2020-04-02 16:56:01.050] [LOG] { status: { name: 'setup', data: 'starting' } }
[2020-04-02 16:56:01.052] [LOG] { name: 'setup', data: 'starting' }
[2020-04-02 16:56:02.258] [LOG] { status: { name: 'setup', data: 'started' } }
[2020-04-02 16:56:02.259] [LOG] { name: 'setup', data: 'started' }
[2020-04-02 16:56:03.262] [LOG] { sensor: { name: 'T', data: '21' } }
[2020-04-02 16:56:03.365] [LOG] { sensor: { name: 'Hum', data: '35' } }
[2020-04-02 16:56:03.467] [LOG] { sensor: { name: 'CO2', data: '1200' } }
...
[2020-04-02 16:56:09.601] [LOG] { sensor: { name: 'T', data: '21' } }
[2020-04-02 16:56:09.704] [LOG] { sensor: { name: 'Hum', data: '35' } }
[2020-04-02 16:56:09.807] [LOG] { sensor: { name: 'CO2', data: '1200' } }
[2020-04-02 16:56:12.172] [LOG] { status: { name: 'setup', data: 'starting' } }
[2020-04-02 16:56:12.175] [LOG] { name: 'setup', data: 'starting' }
[2020-04-02 16:56:13.244] [LOG] { status: { name: 'setup', data: 'started' } }
[2020-04-02 16:56:13.247] [LOG] { name: 'setup', data: 'started' }
[2020-04-02 16:56:14.245] [LOG] { sensor: { name: 'T', data: '21' } }
[2020-04-02 16:56:14.347] [LOG] { sensor: { name: 'Hum', data: '35' } }
[2020-04-02 16:56:14.450] [LOG] { sensor: { name: 'CO2', data: '1200' } }

ArduPort config:

{
module: 'MMM-ArduPort',
position: 'bottom_left',
config: {
portname: "/dev/ttyUSB0",
useColors: false,
sensors: [
{
name: "T",
},
{
name: "Hum",
},
{
name: "CO2",
},
],
},
},

/* controlled by... */
{module: 'MMM-pages'},
{module: 'MMM-ModuleToggle'},

Arduino code (part of it):

void setup() {
Serial.begin(9600);
mySerial.begin(BAUDRATE);
xsensor.begin(mySerial);
Serial.println("[status:setup:starting]");

unsigned status;
status = xxx();  
if (!status) {
    Serial.println("[status:setup:failed]");
}
Serial.println("[status:setup:started]");
delay(1000);

}

void loop() {
if (millis() - getDataTimer >= 2000)
{
Serial.println("[sensor:T:21]");

    Serial.println("[sensor:Hum:35]");

    Serial.println("[sensor:CO2:1200]");                             

    getDataTimer = millis();
}

}

I have restarted Arduino twice: after startup, the module shows sensors with "Waiting" (for values) and after both Arduino restarts the module has shown "Starting..". I'm running a fresh update now, but before that update, the module was showing just "Waiting..." (the one without sensors list), but I don't have a log for that already. Thank you very much for your time. :)

@Dentrax
Copy link
Owner

Dentrax commented Apr 2, 2020

@misijan1cz

I couldn't see the these logs on your logs. Start function is not working somehow, i guess.

I'm afraid I don't have time to investigate why this is not working anymore. I'd appreciate if you fix the bug with a PR. :)

@LilCritical
Copy link

anyone found a fix for this ?
im facing the same issue , waiting...
but it does show the data in console.

@Dentrax
Copy link
Owner

Dentrax commented Jan 30, 2022

Hey @LilCritical, can you please share your logs and Arduino code?

@LilCritical
Copy link

LilCritical commented Jan 30, 2022

Hey @LilCritical, can you please share your logs and Arduino code?

Hello, @Dentrax thanks for the reply !
here is the arduino code :

#define VCC 5 //Supply voltage
#define R 9830 //R=10KΩ
#define RT0 10000 // Ω
#define B 3977 // K

//Variables
float RT, VR, ln, TX, T0, VRT;

volatile int32_t m_counter = 0;
bool WasStarted = false;

static const char *pcMQ2Prefix = "[sensor:MQ2:";
static const char *pcLM35Prefix = "[sensor:LM35:";
static const char *pcHCSR04Prefix = "[sensor:HCSR04:";
static const char *pcPostfix = "]";

void setup() {
Serial.begin(9600);
while(!Serial);
T0 = 25 + 273.15; //Temperature T0 from datasheet, conversion from Celsius to kelvin
Serial.println("[status:setup:starting]");

int test = 1;
m_counter = test;

if(test > 1) {
WasStarted = false;
Serial.println("[status:setup:failed]");
return;
}

delay(3000);
WasStarted = true;
Serial.println("[status:setup:started]");
delay(100);
}

void loop() {

VRT = analogRead(A0);              //Acquisition analog value of VRT

VRT = (5.00 / 1023.00) * VRT; //Conversion to voltage
VR = VCC - VRT;
RT = VRT / (VR / R); //Resistance of RT

ln = log(RT / RT0);
TX = (1 / ((ln / B) + (1 / T0))); //Temperature from thermistor

TX = TX - 273.15; //Conversion to Celsius

Serial.print(pcMQ2Prefix);

Serial.print(TX);

Serial.println(pcPostfix);
delay(500);

}

here the log :

[30.01.2022 03:44.09.879] [INFO] Checking git for module: MMM-ArduPort
[30.01.2022 03:44.10.026] [INFO] Checking git for module: MMM-EyeCandy
[30.01.2022 03:44.10.057] [LOG] { debug: 'SerialPort shell started...' }
[30.01.2022 03:44.10.058] [LOG] undefined[MMM-ArduPort] SerialPort shell started...
[30.01.2022 03:44.10.059] [LOG] { debug: 'Waiting Ardunio to connect on port...' }
[30.01.2022 03:44.10.060] [LOG] undefined[MMM-ArduPort] Waiting Ardunio to connect on port...
[30.01.2022 03:44.10.092] [LOG] Refreshed access token because it has expired. Expired at: 03:44:09 now is: 03:44:10
[30.01.2022 03:44.10.101] [LOG] { status: { name: 'connect', data: 'connected' } }
[30.01.2022 03:44.10.101] [LOG] { name: 'connect', data: 'connected' }
[30.01.2022 03:44.10.103] [INFO] Checking git for module: MMM-SimpleText
[30.01.2022 03:44.10.126] [INFO] Newsfeed-Fetcher: Broadcasting 58 items.
[30.01.2022 03:44.10.169] [INFO] Checking git for module: MMM-NowPlayingOnSpotify
[30.01.2022 03:44.10.222] [INFO] Checking git for module: MMM-Remote-Control
[30.01.2022 03:44.10.268] [INFO] Checking git for module: MMM-SmartTouch
[30.01.2022 03:44.10.310] [INFO] Checking git for module: default
[30.01.2022 03:44.10.402] [INFO] Calendar-Fetcher: Broadcasting 10 events.
[30.01.2022 03:44.10.473] [LOG] [MMM-PushBulletNotifications][Info] 03:44:10.473 - PushBullet connected
[30.01.2022 03:44.11.075] [LOG] { status: { name: 'setup', data: 'starting' } }
[30.01.2022 03:44.11.075] [LOG] { name: 'setup', data: 'starting' }
[30.01.2022 03:44.14.029] [LOG] { status: { name: 'setup', data: 'started' } }
[30.01.2022 03:44.14.030] [LOG] { name: 'setup', data: 'started' }
[30.01.2022 03:44.14.139] [LOG] { sensor: { name: 'MQ2', data: '21.96' } }
[30.01.2022 03:44.14.689] [LOG] { sensor: { name: 'MQ2', data: '21.87' } }
[30.01.2022 03:44.15.126] [LOG] { sensor: { name: 'MQ2', data: '21.96' } }
[30.01.2022 03:44.15.672] [LOG] { sensor: { name: 'MQ2', data: '21.87' } }
[30.01.2022 03:44.16.660] [LOG] { sensor: { name: 'MQ2', data: '21.87' } }
[30.01.2022 03:44.17.646] [LOG] { sensor: { name: 'MQ2', data: '21.70' } }
[30.01.2022 03:44.18.192] [LOG] { sensor: { name: 'MQ2', data: '21.78' } }
[30.01.2022 03:44.18.627] [LOG] { sensor: { name: 'MQ2', data: '21.78' } }
[30.01.2022 03:44.19.175] [LOG] { sensor: { name: 'MQ2', data: '21.87' } }
[30.01.2022 03:44.20.158] [LOG] { sensor: { name: 'MQ2', data: '21.78' } }
[30.01.2022 03:44.21.147] [LOG] { sensor: { name: 'MQ2', data: '21.87' } }
[30.01.2022 03:44.21.696] [LOG] { sensor: { name: 'MQ2', data: '21.96' } }
[30.01.2022 03:44.22.132] [LOG] { sensor: { name: 'MQ2', data: '21.87' } }
[30.01.2022 03:44.22.673] [LOG] { sensor: { name: 'MQ2', data: '22.04' } }
[30.01.2022 03:44.23.652] [LOG] { sensor: { name: 'MQ2', data: '21.87' } }
[30.01.2022 03:44.24.201] [LOG] { sensor: { name: 'MQ2', data: '21.78' } }
[30.01.2022 03:44.24.638] [LOG] { sensor: { name: 'MQ2', data: '21.87' } }
[30.01.2022 03:44.25.182] [LOG] { sensor: { name: 'MQ2', data: '21.78' } }
[30.01.2022 03:44.26.163] [LOG] { sensor: { name: 'MQ2', data: '21.78' } }
[30.01.2022 03:44.26.706] [LOG] { sensor: { name: 'MQ2', data: '21.78' } }
[30.01.2022 03:44.27.141] [LOG] { sensor: { name: 'MQ2', data: '21.78' } }
[30.01.2022 03:44.27.694] [LOG] { sensor: { name: 'MQ2', data: '21.78' } }
[30.01.2022 03:44.28.132] [LOG] { sensor: { name: 'MQ2', data: '21.87' } }

Also when you refresh the mirror page the arduino doesnt reconnect so it keeps saying waiting for connection. in order to make connection again you have to unplug usb from arduino and plug it in again , then console will recognise it again.

https://prnt.sc/26lwl73

Hope you can help me out , i love this feature you created and is exactly what i need for my mirror project :)
thanks in advance !

EDIT :
@Dentrax
I have done some investigation , arduport.py works perfectly fine.
The issue i think is in MMM-ArduPort.js line 142

    if (value != null) {

apparently value = null , but im not sure why it is not receiving the data ( not that skilled in node )

@Dentrax
Copy link
Owner

Dentrax commented Jan 30, 2022

Thanks for investigation! It seems ArduPort.py working fine as you said. But I'm busy nowadays and haven't appropriate environment to test this. And not sure why value is null. If you find something that fixes this, feel free to send a PR!

@LilCritical
Copy link

Thanks for investigation! It seems ArduPort.py working fine as you said. But I'm busy nowadays and haven't appropriate environment to test this. And not sure why value is null. If you find something that fixes this, feel free to send a PR!

i am not sure if il be able to fix it :( , what i figured is that value = undefined in function formatValue: function(value, sensor) {
any idea what may cause this ?

@LilCritical
Copy link

@Dentrax a fix to this was mentioned here

#3 (comment)

@a2ngerer
Copy link

Any updates on this topic?
The solution from problem #3 didn't work for me

@Dentrax
Copy link
Owner

Dentrax commented Feb 21, 2022

No updates, would you like to get into it and send a PR? I would appreciate. @a2ngerer @LilCritical 🙏

@LilCritical
Copy link

No updates, would you like to get into it and send a PR? I would appreciate. @a2ngerer @LilCritical 🙏

I did a pr a long time ago and i fixed it and updated the pr but you never reviewed ..

@Dentrax
Copy link
Owner

Dentrax commented Feb 21, 2022

No updates, would you like to get into it and send a PR? I would appreciate. @a2ngerer @LilCritical 🙏

I did a pr a long time ago and i fixed it and updated the pr but you never reviewed ..

Actually I reviewed your PR and have been waiting your reviews:

@zharfanw
Copy link

zharfanw commented Feb 25, 2023

hi, i just try to modify MMM-ArduPort.js file it with add defaultFormat at sensors properties
image
and using this method like this comment
with code below
image

instead using val.innerHTML = sensor.maxFormat.format(value); or similar like that.

so at config.js i just add like this
image

result view is picture below
image

@zharfanw
Copy link

hi, i just try to modify MMM-ArduPort.js file it with add defaultFormat at sensors properties image and using this method like this comment with code below image

instead using val.innerHTML = sensor.maxFormat.format(value); or similar like that.

so at config.js i just add like this image

once i code like val.innerHTML = sensor.defaultFormat.format(sensor.value); the result is like picture below
image
with config.js like picture below
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants