stefanbode / Sonoff-Tasmota

Provide ESP8266 based itead Sonoff with Web, MQTT and OTA firmware using Arduino IDE, enhanced with I2C options
GNU General Public License v3.0
128 stars 41 forks source link

MQTT Report during movement #209

Closed kabongsteve closed 4 years ago

kabongsteve commented 4 years ago

I use MQTT to connect to HASS and there is no MQTT reporting of position changes while its moving.

I added the following code to the ShutterReportPosition() method and this resolved the above.

This means I can see the movement in HASS while its moving

~Line 349 (after AddLog_P2()

  uint8_t position =  ShutterRealToPercentPosition(Shutter.real_position[i], i);
  Response_P(PSTR("{"));
  ResponseAppend_P(JSON_SHUTTER_POS, i+1, position, Shutter.direction[i]);
  ResponseJsonEnd();
  MqttPublishPrefixTopic_P(RESULT_OR_TELE, mqtt_data);
stefanbode commented 4 years ago

Yes makes sense. Will be merged in the next commit