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

Sonoff POW REQUEST : if vaule W is over "X" or Range vaule SONOFF POW send automatic HTTP API instruction. #1968

Closed
cent0 opened this issue Nov 1, 2019 · 6 comments
Labels
enhancement New feature or request

Comments

@cent0
Copy link

cent0 commented Nov 1, 2019

@mcspr @zafirron hello i need adjust Pow interface and add this string code. if have overcurrent need switch off other interface.
please help for searc point for insertion

in the future for develop gui interface

This is code:
_
//http.begin("http://192.168.123.101/api/relay/0?apikey=1234567890123456&value=0"); //HTTP
// start connection and send //HTTP header
// int httpCode = http.GET();

// http.end(); "
_

best regards

i have like the plugin
#762
suggest for send to other interface http api comand ?

@cent0 cent0 added the enhancement New feature or request label Nov 1, 2019
@mcspr
Copy link
Collaborator

mcspr commented Nov 23, 2019

See #1988 (comment)
And also see this example from influxdb module:

SensorBroker::Register(_idbBrokerSensor);

void _idbBrokerSensor(const String& topic, unsigned char id, double, const char* value) {
idbSend(topic.c_str(), id, value);
}

How often it is called depends on the BROKER_REAL_TIME define. When set to 0 (default), it will report each N readings (snsReport / SENSOR_REPORT_EVERY. MQTT works like this). When set to 1, it will publish sensor data each reading (snsRead / SENSOR_READ_INTERVAL. WebUI is updated each reading).

I would also suggest to use schedule_function([bind,variables,here]() { ... your http code here ... }); in the broker callback.

@MihataBG
Copy link

MihataBG commented Dec 6, 2019

In master branch 1.14.0 BROKER_REAL_TIME is set to 1, is it correct and are you changed default behavior?

@mcspr
Copy link
Collaborator

mcspr commented Dec 6, 2019

@MihataBG Can you explain the problem with it?
Looks unintentional, I thought that was 0 at the time of writing this (...since I switched off RULES_SUPPORT default in #1984)

@MihataBG
Copy link

MihataBG commented Dec 6, 2019

The problem is with POW R2, it crashes few minutes after reboot when BROKER_REAL_TIME is set to 1. In web debug i see INFLUXDB messages in every 5-6 seconds.

@cent0
Copy link
Author

cent0 commented May 30, 2020

See #1988 (comment)
And also see this example from influxdb module:

SensorBroker::Register(_idbBrokerSensor);

void _idbBrokerSensor(const String& topic, unsigned char id, double, const char* value) {
idbSend(topic.c_str(), id, value);
}

How often it is called depends on the BROKER_REAL_TIME define. When set to 0 (default), it will report each N readings (snsReport / SENSOR_REPORT_EVERY. MQTT works like this). When set to 1, it will publish sensor data each reading (snsRead / SENSOR_READ_INTERVAL. WebUI is updated each reading).

I would also suggest to use schedule_function([bind,variables,here]() { ... your http code here ... }); in the broker callback.

@mcspr @lblabr
For solve this is possible add this line in main.cpp?
#include newfunction.h

And new file in espurna folder.
In this file newfunction.h

#include esp8266HTTPClient
#include sensor.h
If (MAGNITUDE_POWER_ACTIVE >100); //working this call?
{

_
//http.begin("http://192.168.123.101/api/relay/0?apikey=1234567890123456&value=0"); //HTTP
// start connection and send //HTTP header
// int httpCode = http.GET();

// http.end(); "

}

@cent0 cent0 changed the title Sonoff POW REQUEST : if vaule W is over "X" or Range vaule SONOFF POW send automatic HTTP API instruction. QSonoff POW REQUEST : if vaule W is over "X" or Range vaule SONOFF POW send automatic HTTP API instruction. May 30, 2020
@cent0 cent0 changed the title QSonoff POW REQUEST : if vaule W is over "X" or Range vaule SONOFF POW send automatic HTTP API instruction. Sonoff POW REQUEST : if vaule W is over "X" or Range vaule SONOFF POW send automatic HTTP API instruction. May 31, 2020
@mcspr
Copy link
Collaborator

mcspr commented May 31, 2020

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

No branches or pull requests

3 participants