diff --git a/docs/source/Plugin/P176.rst b/docs/source/Plugin/P176.rst index 11fdda2a1e..d1a7535592 100644 --- a/docs/source/Plugin/P176.rst +++ b/docs/source/Plugin/P176.rst @@ -95,6 +95,8 @@ The *Data* column shows the actual data as received. The *Value* column shows a factored result based on the value, as mV is not always very useful, so that's converted to V, mA to A, Wh to kWh, etc. +For items that use ON and OFF (or On and Off for older firmwares) as Data, these will be available as 1 and 0 respectively, so they can be used as Values. If needed, a transformation like ``[VE.Direct#Alarm#O]`` can be used to present the value as ON/OFF for 1/0. Adding the ``C`` justification, like ``[VE.Direct#Alarm#O#C]``, will be presented as On/Off. + It shows that it has received 2 packets, but as a packet only contains a part of the available data, and a next packet another part, etc. there's no fixed relation to the amount of samples, and the number of packets received. Some devices may send all data in a single packet, other devices may need 3 or even 4 packets to send all available data. Also, the number of checksum errors is shown, this counter is automatically reset after receiving 50 consecutive correct packets. diff --git a/src/_P176_VE_Direct.ino b/src/_P176_VE_Direct.ino index bf85ace1b0..832120d85c 100644 --- a/src/_P176_VE_Direct.ino +++ b/src/_P176_VE_Direct.ino @@ -6,6 +6,7 @@ // ####################################################################################################### /** Changelog: + * 2024-10-30 tonhuisman: Accept ON/On and OFF/Off as 1 and 0 numeric values, to be able to use them as Values in the device configuration * 2024-10-30 tonhuisman: Simplifying the code somewhat, making it more robust, partially by TD-er * 2024-10-29 tonhuisman: Optimize receiving and processing data, resulting in much lower load (based on suggestions by TD-er) * Removed the RX Timeout setting, as it doesn't help here, seems to slow things down. diff --git a/src/src/PluginStructs/P176_data_struct.h b/src/src/PluginStructs/P176_data_struct.h index c2f3d15838..e4e57d49b5 100644 --- a/src/src/PluginStructs/P176_data_struct.h +++ b/src/src/PluginStructs/P176_data_struct.h @@ -109,6 +109,12 @@ struct P176_data_struct : public PluginTaskData_base { if (validIntFromString(_value, iValue)) { _numValue = iValue * _factor; + } else + if (_value.equalsIgnoreCase(F("ON"))) { // Can be ON or On + _numValue = 1.0f; + } else + if (_value.equalsIgnoreCase(F("OFF"))) { // Can be OFF or Off + _numValue = 0.0f; } else { _isNumeric = false; }