@@ -741,21 +741,25 @@ bool readSerial()
741741 log_message (_F (" Extra data available on this heatpump" ));
742742 extraDataBlockAvailable = true ; // request for extra data next run
743743 }
744+ #ifdef RAWDEBUG
744745 {
745746 char mqtt_topic[256 ];
746747 sprintf (mqtt_topic, " %s/raw/data" , heishamonSettings.mqtt_topic_base );
747748 mqtt_client.publish (mqtt_topic, (const uint8_t *)actData, DATASIZE, false ); // do not retain this raw data
748749 }
750+ #endif
749751 data_length = 0 ;
750752 return true ;
751753 } else if (data[3 ] == 0x21 ) { // decode the new model extra data block
752754 extraDataBlockAvailable = true ; // set the flag to true so we know we can request this data always
753755 decode_heatpump_data_extra (data, actDataExtra, mqtt_client, log_message, heishamonSettings.mqtt_topic_base , heishamonSettings.updateAllTime );
756+ #ifdef RAWDEBUG
754757 {
755758 char mqtt_topic[256 ];
756759 sprintf (mqtt_topic, " %s/raw/dataextra" , heishamonSettings.mqtt_topic_base );
757760 mqtt_client.publish (mqtt_topic, (const uint8_t *)actDataExtra, DATASIZE, false ); // do not retain this raw data
758761 }
762+ #endif
759763 data_length = 0 ;
760764 return true ;
761765 } else {
@@ -814,6 +818,7 @@ void pushCommandBuffer(byte* command, int length) {
814818void serialTXTask (void *pvParameters) {
815819 unsigned long lastPCBSendTime = 0 ;
816820 unsigned long lastHPSendTime = 0 ;
821+ unsigned long lastHPExtraSendTime = 0 ;
817822 unsigned long lastPCBSaveTime = 0 ;
818823 char local_log_msg[LOG_MSG_SIZE];
819824
@@ -857,18 +862,26 @@ void serialTXTask(void *pvParameters) {
857862 byte chk = calcChecksum (panasonicQuery, PANASONICQUERYSIZE);
858863 heatpumpSerial.write (panasonicQuery, PANASONICQUERYSIZE);
859864 heatpumpSerial.write (chk);
860- if (extraDataBlockAvailable) {
861- panasonicQuery[3 ] = 0x21 ;
862- chk = calcChecksum (panasonicQuery, PANASONICQUERYSIZE);
863- heatpumpSerial.write (panasonicQuery, PANASONICQUERYSIZE);
864- heatpumpSerial.write (chk);
865- panasonicQuery[3 ] = 0x10 ;
866- }
867- sprintf_P (local_log_msg, PSTR (" heatpump request datagram sent bytes: %d" ), PANASONICQUERYSIZE + 1 );
865+ sprintf_P (local_log_msg, PSTR (" heatpump request query sent bytes: %d" ), PANASONICQUERYSIZE + 1 );
868866 xQueueSend (logQueue,local_log_msg,0 );
869867 }
870868 }
871869
870+ // third priority: extra data block query every waitTime seconds (offset from basic query)
871+ if ((!sending) && (!heishamonSettings.listenonly ) && extraDataBlockAvailable) {
872+ if ((unsigned long )(now - lastHPExtraSendTime) >= (1000 * heishamonSettings.waitTime )) {
873+ lastHPExtraSendTime = now;
874+ sending = true ;
875+ sendCommandReadTime = now;
876+ panasonicQuery[3 ] = 0x21 ;
877+ byte chk = calcChecksum (panasonicQuery, PANASONICQUERYSIZE);
878+ heatpumpSerial.write (panasonicQuery, PANASONICQUERYSIZE);
879+ heatpumpSerial.write (chk);
880+ panasonicQuery[3 ] = 0x10 ;
881+ xQueueSend (logQueue, (void *)" heatpump extra query sent" , 0 );
882+ }
883+ }
884+
872885 // lowest priority: user commands from queue
873886 if ((!sending) && (!heishamonSettings.listenonly )) {
874887 struct cmdbuffer_t cmd;
0 commit comments