Add driver JSON if available

Add driver JSON if available
This commit is contained in:
Theo Arends 2019-09-29 18:11:36 +02:00
parent e40475b563
commit e90f67bbbb
2 changed files with 2 additions and 5 deletions

View File

@ -748,10 +748,7 @@ bool MqttShowSensor(void)
}
}
XsnsCall(FUNC_JSON_APPEND);
#ifdef USE_SCRIPT_JSON_EXPORT
XdrvCall(FUNC_JSON_APPEND);
#endif
bool json_data_available = (strlen(mqtt_data) - json_data_start);
if (strstr_P(mqtt_data, PSTR(D_JSON_PRESSURE)) != nullptr) {

View File

@ -51,7 +51,7 @@ void (* const ShutterCommand[])(void) PROGMEM = {
&CmndShutterOpenTime, &CmndShutterCloseTime, &CmndShutterRelay,
&CmndShutterSetHalfway, &CmndShutterSetClose, &CmndShutterInvert, &CmndShutterCalibration };
const char JSON_SHUTTER_POS[] PROGMEM = "\"" D_SHUTTER "%d\":{\"position\":%d,\"direction\":%d}";
const char JSON_SHUTTER_POS[] PROGMEM = "\"" D_PRFX_SHUTTER "%d\":{\"Position\":%d,\"Direction\":%d}";
Ticker TickerShutter;
@ -211,7 +211,7 @@ void Schutter_Update_Position()
Shutter_Start_Position[i] = Shutter_Real_Position[i];
// sending MQTT result to broker
snprintf_P(scommand, sizeof(scommand),PSTR("%s%d"), D_SHUTTER, i+1);
snprintf_P(scommand, sizeof(scommand),PSTR(D_SHUTTER "%d"), i+1);
GetTopic_P(stopic, STAT, mqtt_topic, scommand);
Response_P("%d", Settings.shutter_invert[i] ? 100 - Settings.shutter_position[i]: Settings.shutter_position[i]);
MqttPublish(stopic, Settings.flag.mqtt_power_retain);