tagyoureit / nodejs-poolController

An application to control pool equipment from various manufacturers.
GNU Affero General Public License v3.0
327 stars 97 forks source link

Last Dose Time and Volume for IntelliChem in mqtt #369

Closed snagytx closed 3 years ago

snagytx commented 3 years ago

Describe the bug I'm not really sure if this is a bug or a feature. I have an IntelliChem setup and I want to graph the dosing in HomeAssistant, so I enabled MQTT. I noticed that the last Dose Time and Volume are not sent to MQTT . I tried to expose the timeDosed to mqtt and it works, but this will send as timeDosed changes, 0,2,3,4,5...20 and then remains at 20 until another dose is triggered. Not sure if this is useful, but for my use case it's not useful.

To Reproduce Add to mqtt.json

        {
          "topic": "state/chemControllers/@bind=data.id;/@bind=data.name;/orpTimeDosed",
          "message": "{\"orpTimeDosed\":@bind=data.orp.timeDosed;}"
        },
        {
          "topic": "state/chemControllers/@bind=data.id;/@bind=data.name;/pHTimeDosed",
          "message": "{\"pHTimeDosed\":@bind=data.ph.timeDosed;}"
        },
        {
          "topic": "state/chemControllers/@bind=data.id;/@bind=data.name;/orpVolumeDosed",
          "message": "{\"orpVolumeDosed\":@bind=data.orp.volumeDosed;}"
        },
        {
          "topic": "state/chemControllers/@bind=data.id;/@bind=data.name;/pHVolumeDosed",
          "message": "{\"pHVolumeDosed\":@bind=data.ph.volumeDosed;}"
        },

then monitor the mqtt and note that the sensors will constantly increase during dosing - this will make it hard to plot

Expected behavior Get a single value at the end of the dosing, or set it to 0 when it starts then to the dosed time at the end.

Pool Equipment

rstrouse commented 3 years ago

Unfortunately, IntelliChem reports this on their status messages just as you described. However, there is a chemicalDose event that keeps track of the current dose and its status. Sadly, much of the data that exists for REM Chem is omitted by IntelliChem. The output is really limited from IntelliChem. However, I added the chemicalDose emit so that it will give you some additional data when IntelliChem is dosing (we measure this on the status edges).

Pull njsPC and you should have additional information on your mqtt emits.

   {
      "name": "chemicalDose",
      "description": "Event when a chemical is being dosed",
      "topics": [
        {
          "topic": "state/chemControllers/@bind=data.id;/@bind=data.chem;",
          "message": "@bind=data;",
          "enabled": true
        }
      ]
    },
snagytx commented 3 years ago

The update solved my issue.