Controlling Mobius enabled VorTech pump using 0-10V (and BLE)

Paulo Hanashiro

Community Member
View Badges
Joined
Jun 4, 2013
Messages
56
Reaction score
29
Location
Sydney/Australia
Rating - 0%
0   0   0
In regards the simple Feed Mode using the MobiusBLE library.

The sketch I posted before isn't working properly, but the one down below was just tested and is working for me.

Let me explain the idea:

The sketch uses the HA/MQTT auto discovery function.

during boot, it will publish 2 initial JSON messages so the HA component can be created automatically:

homeassistant/switch/mobiusBridge/config:
JSON:
{
    "name":"Feed Mode",   
    "command_topic":"homeassistant/switch/mobiusBridge/set",   
    "state_topic":"homeassistant/switch/mobiusBridge/state",   
    "unique_id":"mobius01ad",   
    "device":{
        "identifiers":[ "mobridge01ad" ],     
        "name":"Mobius"         
    }
}

and

homeassistant/sensor/mobiusBridge/config:
JSON:
{
    "name":"QTY Devices",   
    "state_topic":"homeassistant/sensor/mobiusBridge/state",   
    "value_template":"{{ value_json.qtydevices}}",   
    "unique_id":"qtydev01ae",   
    "device":{     
        "identifiers":[ "mobridge01ad" ]     
    }   
}

It will then send the Feed mode status and the quantity of Mobius Devices found:

homeassistant/switch/mobiusBridge/state: OFF
homeassistant/sensor/mobiusBridge/state: {"qtydevices":2}

Ideally, this should auto create the component in HA similar to the below:

1717480706128.png


To enable/disable Feed Mode, just turn on/off the "Feed Mode" switch.

Although the switch is now reflecting the new state, please note it takes time to scan and set the scene, but you can monitor the execution using the arduino Serial Monitor.

and lastly, use it at your own risk as I'm not a programmer and this was coded as a simple proof of concept based on @thetastate initial idea and no extensive test was executed.

C++:
#include <ESP32_MobiusBLE.h>
#include "ArduinoSerialDeviceEventListener.h"

#include "EspMQTTClient.h"
#include <string>
#include "secrets.h"
#include <ArduinoJson.h>

// Configuration for wifi and mqtt
EspMQTTClient client(
  mySSID,                // Your Wifi SSID
  myPassword,            // Your WiFi key
  "homeassistant.local", // MQTT Broker server ip
  mqttUser,              // mqtt username Can be omitted if not needed
  mqttPass,              // mqtt pass Can be omitted if not needed
  "Mobius",              // Client name that uniquely identify your device
  1883                   // MQTT Broker server port
);

char* jsonSwitchDiscovery =  "{\
    \"name\":\"Feed Mode\",\
    \"command_topic\":\"homeassistant/switch/mobiusBridge/set\",\
    \"state_topic\":\"homeassistant/switch/mobiusBridge/state\",\
    \"unique_id\":\"mobius01ad\",\
    \"device\":{\
      \"identifiers\":[\
        \"mobridge01ad\"\
      ],\
      \"name\":\"Mobius\"\
         }}";

char* jsonSensorDiscovery =  "{ \
    \"name\":\"QTY Devices\",\
    \"state_topic\":\"homeassistant/sensor/mobiusBridge/state\",\
    \"value_template\":\"{{ value_json.qtydevices}}\",\
    \"unique_id\":\"qtydev01ae\",\
    \"device\":{\
      \"identifiers\":[\
        \"mobridge01ad\"\
      ]\
      }\
    }";

char* jsonDeviceDiscovery =  "{ \
    \"state_topic\":\"homeassistant/sensor/%s/state\",\
    \"unique_id\":\"%s\",\
    \"device\":{\
      \"identifiers\":[\
        \"%s\"\
      ],\
      \"name\":\"%s\",\
      }\
    }";

bool prevState = false;
bool currState = false;
bool configPublish = false;
bool firstRun = true;

// wifi and mqtt connection established
void onConnectionEstablished()
{
  Serial.println("Connected to MQTT Broker :)");
 
  // Listen for a scene update from mqtt and call the update function
  // May need to do this from the loop(). Test.
  client.subscribe("homeassistant/switch/mobiusBridge/set", [](const String& feedMode) {
    if (feedMode.length() > 0) {
      if (feedMode == "ON") {
        Serial.printf("INFO: IS this On?   %s\n", feedMode);
        currState = true;
      } else {
        Serial.printf("INFO: IS this Off?   %s\n", feedMode);
        currState = false;
      }
      configPublish = false;

      Serial.printf("INFO: Update device scene from MQTT trigger: %s\n", feedMode);
      if (!client.publish("homeassistant/switch/mobiusBridge/state", feedMode)) {
        Serial.printf("ERROR: Did not publish Feed Switch");
      }

    }
  });

}

// Define a device buffer to hold found Mobius devices
MobiusDevice deviceBuffer[20];
int deviceCount = 0;

JsonDocument doc;

void setup() {
  // connect the serial port for logs
  Serial.begin(115200);
  while (!Serial);

  prevState = !currState;
  firstRun = true;

  client.enableDebuggingMessages(); // Enable debugging messages sent to serial output
  client.enableHTTPWebUpdater(); // Enable the web updater. User and password default to values of MQTTUsername and MQTTPassword. These can be overridded with enableHTTPWebUpdater("user", "password").
 
  // Increase default packet size for HA mqtt json messages
  client.setMaxPacketSize(2048);

  // Initialize the library with a useful event listener
  MobiusDevice::init(new ArduinoSerialDeviceEventListener());

  Serial.println("Setup run");
}

void loop() {
  // Wait for mqtt and wifi connection
  while(!client.isConnected()){client.loop();};

  // Loop mqtt
  client.loop();


  // create buffer to store the Mobius devices
  MobiusDevice device = deviceBuffer[0];

  if (!configPublish) {
    //Scan BLE and MQTT Publish the main config only on boot or on status change
    Serial.printf("=========================================================\n");
    Serial.printf("     INFO: BLE SCAN + PUBLISHING THE MAIN CONFIG \n");
    Serial.printf("=========================================================\n");

    //Scan for Mobius devices
    int scanDuration = 5; // in seconds
    deviceCount = 0;

    while (!deviceCount) {
      //Scan until at least one device is returned
      deviceCount = MobiusDevice::scanForMobiusDevices(scanDuration, deviceBuffer,10);
      Serial.printf("INFO: Mobius Devices found: %i\n", deviceCount);
    }

    if (!client.publish("homeassistant/switch/mobiusBridge/config", jsonSwitchDiscovery)) {  //This one is for the switch
      Serial.printf("ERROR: Did not publish");
    }

    if (!client.publish("homeassistant/sensor/mobiusBridge/config", jsonSensorDiscovery)) { //This is for the QTY
      Serial.printf("ERROR: Did not publish");
    }

    configPublish = true;

    // delaying without sleeping
    unsigned long startMillis = millis();
    while (2000 > (millis() - startMillis)) {}   
  }

  /***************************************************************
  ************       BLE Connection starts here       ************
  ***************************************************************/
  //inside the mqtt subscribe function onConnectionEstablished(), it will turn the LED on with digitalWrite(LED_BUILTIN, HIGH);

    if (prevState != currState) {
    //If Current state is different from previous, publish MQTT state
    Serial.printf("INFO: Publishing state");

    if (!firstRun){
      // Do not connect to device during boot

      for (int i = 0; i < deviceCount; i++) {
        // connect to each device in buffer to set the new scene
        device = deviceBuffer[i];

        int tries = 1;
        //loop until connected or exit after 10 tries
        while(tries<=10){

          // Connect, get serialNumber and current scene
          Serial.printf("\nINFO: Connect to device number: %i\n", i);
          if (device.connect()) {

            //Get Current scene
            uint16_t sceneId = device.getCurrentScene();

            //Convert scene from int to friendly MQTT text
            char currScene[2];
            sprintf(currScene, "%u", sceneId);
            
            // delaying without sleeping
            unsigned long startMillis = millis();
            while (1000 > (millis() - startMillis)) {}

            /*===============================================
            =====               Set Scene               =====
            ===============================================*/
            if ((sceneId!=1) and (currState) ) {
              //Scene is different from feed mode (1), and Feed switch is ON, set device to feed mode
              device.setFeedScene();
            } else if ((sceneId==1) and !currState) {
              //Scene is feed mode (1), and Feed switch is OFF, set device to Normal Schedule
              device.runSchedule();
            }

            //Disconnect from Mobius Device
            device.disconnect();

            //If connection completed, break the loop
            break;
          }
          else {
            tries++;
          }
          
        }

        //Print error message if didn't connect after 10 tries
        if (tries>9) {
          ESP_LOGE(LOG_TAG, "ERROR: Failed to connect to device");
        }
      }
    }   

    char cstr[20];
    JsonDocument jsonQtyDev;
    jsonQtyDev["qtydevices"] = deviceCount;
    serializeJson(jsonQtyDev, cstr);

    Serial.printf("INFO: Mobius BLE device count: %i\n", deviceCount);
    
      if (!client.publish("homeassistant/sensor/mobiusBridge/state", cstr)) {
        FYI:Serial.printf("ERROR: Did not publish qtyitems");
      }

    prevState = currState;
  }

  firstRun = false;
}
 

iamdan

Community Member
View Badges
Joined
Jul 1, 2022
Messages
87
Reaction score
74
Location
Western Australia
Rating - 0%
0   0   0
My addition to @Paulo Hanashiro's work - Added Control of ESP32S3 RGB Led, MQTT Sensor to Advise if Feed Mode was successful or not - This is so you can either have in Home Assistant the simple sensor it provides or you can code your button to change colours if the operation worked or not etc:


C++:
#include <ESP32_MobiusBLE.h>
#include "ArduinoSerialDeviceEventListener.h"
#include "EspMQTTClient.h"
#include <string>
#include "secrets.h"
#include <ArduinoJson.h>
#include <Adafruit_NeoPixel.h>

// Configuration for wifi and mqtt
EspMQTTClient client(
  mySSID,                // Your Wifi SSID
  myPassword,            // Your WiFi key
  "homeassistant.local", // MQTT Broker server ip
  mqttUser,              // mqtt username Can be omitted if not needed
  mqttPass,              // mqtt pass Can be omitted if not needed
  "Mobius",              // Client name that uniquely identify your device
  1883                   // MQTT Broker server port
);

// WS2812 LED configuration
#define LED_PIN 48
#define LED_COUNT 1
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);

// JSON configurations
char* jsonSwitchDiscovery =  "{\
    \"name\":\"Feed Mode\",\
    \"command_topic\":\"homeassistant/switch/mB/set\",\
    \"state_topic\":\"homeassistant/switch/mB/state\",\
    \"unique_id\":\"m01ad\",\
    \"device\":{\
      \"identifiers\":[\
        \"bridge01ad\"\
      ],\
      \"name\":\"Mobius\"\
         }}";

char* jsonSensorDiscovery =  "{ \
    \"name\":\"Devices\",\
    \"state_topic\":\"homeassistant/sensor/mB/state\",\
    \"value_template\":\"{{ value_json.qtydevices}}\",\
    \"unique_id\":\"dev01ae\",\
    \"device\":{\
      \"identifiers\":[\
        \"bridge01ad\"\
      ]\
      }\
    }";

char* jsonFeedModeStatusDiscovery =  "{ \
    \"name\":\"FM Status\",\
    \"state_topic\":\"homeassistant/sensor/mB/fmstatus\",\
    \"unique_id\":\"status01ae\",\
    \"device\":{\
      \"identifiers\":[\
        \"bridge01ad\"\
      ]\
      }\
    }";

char* jsonDeviceDiscovery =  "{ \
    \"state_topic\":\"homeassistant/sensor/%s/state\",\
    \"unique_id\":\"%s\",\
    \"device\":{\
      \"identifiers\":[\
        \"%s\"\
      ],\
      \"name\":\"%s\",\
      }\
    }";

bool prevState = false;
bool currState = false;
bool configPublish = false;
bool firstRun = true;

// Function to flash LED with specified color and duration
void flashLED(uint32_t color, int duration) {
  strip.setPixelColor(0, color);
  strip.show();
  delay(duration);
  strip.setPixelColor(0, 0); // Turn off the LED
  strip.show();
}

// wifi and mqtt connection established
void onConnectionEstablished() {
  Serial.println("CONNECTED TO MQTT BROKER :)");
  flashLED(strip.Color(0, 0, 255), 5000); // Flash blue for success
 
  // Listen for a scene update from mqtt and call the update function
  client.subscribe("homeassistant/switch/mB/set", [](const String& feedMode) {
    if (feedMode.length() > 0) {
      if (feedMode == "ON") {
        Serial.printf("INFO: VERIFY SWITCH ON: %s\n", feedMode);
        currState = true;
      } else {
        Serial.printf("INFO: VERIFY SWITCH OFF: %s\n", feedMode);
        currState = false;
      }
      configPublish = false;

      Serial.printf("INFO: UPDATE DEVICE SCENE FROM MQTT TRIGGER: %s\n", feedMode);
      if (!client.publish("homeassistant/switch/mB/state", feedMode)) {
        Serial.printf("ERROR: DID NOT PUBLISH FEED SWITCH\n");
        flashLED(strip.Color(255, 0, 0), 15000); // Flash red for error
        client.publish("homeassistant/sensor/mB/fmstatus", "FM ERROR");
        Serial.println("FM Status: ERROR");
      } else {
        if (currState) {
          client.publish("homeassistant/sensor/mB/fmstatus", "FM ON OK");
          Serial.println("FM Status: FM ON OK");
        } else {
          client.publish("homeassistant/sensor/mB/fmstatus", "FM OFF OK");
          Serial.println("FM Status: FM OFF OK");
        }
      }
    }
  });
}

// Define a device buffer to hold found Mobius devices
MobiusDevice deviceBuffer[20];
int deviceCount = 0;

JsonDocument doc;

void setup() {
  // connect the serial port for logs
  Serial.begin(115200);
  while (!Serial);

  // Initialize the WS2812 LED
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
 
  prevState = !currState;
  firstRun = true;

  client.enableDebuggingMessages(); // Enable debugging messages sent to serial output
  client.enableHTTPWebUpdater(); // Enable the web updater. User and password default to values of MQTTUsername and MQTTPassword. These can be overridden with enableHTTPWebUpdater("user", "password").
 
  // Increase default packet size for HA mqtt json messages
  client.setMaxPacketSize(2048);

  // Initialize the library with a useful event listener
  MobiusDevice::init(new ArduinoSerialDeviceEventListener());

  Serial.println("SETUP RUN");
}

void loop() {
  // Wait for mqtt and wifi connection
  while(!client.isConnected()) {
    client.loop();
    flashLED(strip.Color(0, 0, 255), 100); // Flash blue for in-progress
  }

  // Loop mqtt
  client.loop();

  // create buffer to store the Mobius devices
  MobiusDevice device = deviceBuffer[0];

  if (!configPublish) {
    // Scan BLE and MQTT Publish the main config only on boot or on status change
    Serial.printf("INFO: BLE SCAN + PUBLISHING THE MAIN CONFIG \n");
    flashLED(strip.Color(0, 0, 255), 100); // Flash blue for in-progress

    // Scan for Mobius devices
    int scanDuration = 5; // in seconds
    deviceCount = 0;
    flashLED(strip.Color(0, 0, 255), 5000); // Flash blue for in-progress

    while (!deviceCount) {
      // Scan until at least one device is returned
      deviceCount = MobiusDevice::scanForMobiusDevices(scanDuration, deviceBuffer, 10);
      Serial.printf("INFO: DEVICES FOUND: %i\n", deviceCount);
    }

    if (!client.publish("homeassistant/switch/mB/config", jsonSwitchDiscovery)) {  // This one is for the switch
      Serial.printf("ERROR: DID NOT PUBLISH SWITCH\n");
      flashLED(strip.Color(255, 0, 0), 15000); // Flash red for error
    }

    if (!client.publish("homeassistant/sensor/mB/config", jsonSensorDiscovery)) { // This is for the QTY
      Serial.printf("ERROR: DID NOT PUBLISH DETECTED DEVICES\n");
      flashLED(strip.Color(255, 0, 0), 15000); // Flash red for error
    }
    
    if (!client.publish("homeassistant/sensor/mB/fmstatus/config", jsonFeedModeStatusDiscovery)) { // This is for the feed mode status
      Serial.printf("ERROR: DID NOT PUBLISH FM STATUS\n");
      flashLED(strip.Color(255, 0, 0), 15000); // Flash red for error
    }

    configPublish = true;

    // Delaying without sleeping
    unsigned long startMillis = millis();
    while (2000 > (millis() - startMillis)) {}
  }

  /***************************************************************
  ************       BLE Connection starts here       ************
  ***************************************************************/
  // Inside the mqtt subscribe function onConnectionEstablished(), it will turn the LED on with digitalWrite(LED_BUILTIN, HIGH);

  if (prevState != currState) {
    // If Current state is different from previous, publish MQTT state
    Serial.printf("INFO: PUBLISHING STATE: ");
    flashLED(strip.Color(0, 0, 255), 100); // Flash blue for in-progress

    if (!firstRun) {
      // Do not connect to device during boot

      for (int i = 0; i < deviceCount; i++) {
        // connect to each device in buffer to set the new scene
        device = deviceBuffer[i];

        int tries = 1;
        // Loop until connected or exit after 10 tries
        while(tries <= 10) {
          // Connect, get serialNumber and current scene
          Serial.printf("\nINFO: CONNECT TO DEVICE NUMBER: %i\n", i);
          if (device.connect()) {
            // Get Current scene
            uint16_t sceneId = device.getCurrentScene();

            // Convert scene from int to friendly MQTT text
            char currScene[2];
            sprintf(currScene, "%u", sceneId);

            // Delaying without sleeping
            unsigned long startMillis = millis();
            while (1000 > (millis() - startMillis)) {}

            /*===============================================
            =====               Set Scene               =====
            ===============================================*/
            if ((sceneId != 1) && (currState)) {
              // Scene is different from feed mode (1), and Feed switch is ON, set device to feed mode
              if (!device.setFeedScene()) {
                client.publish("homeassistant/sensor/mB/fmstatus", "FM ERROR");
                Serial.println("FM Status: ERROR");
              }
            } else if ((sceneId == 1) && !currState) {
              // Scene is feed mode (1), and Feed switch is OFF, set device to Normal Schedule
              if (!device.runSchedule()) {
                client.publish("homeassistant/sensor/mB/fmstatus", "FM ERROR");
                Serial.println("FM Status: ERROR");
              }
            }

            // Disconnect from Mobius Device
            device.disconnect();

            // If connection completed, break the loop
            break;
          } else {
            tries++;
          }
        }

        // Print error message if didn't connect after 10 tries
        if (tries > 9) {
          ESP_LOGE(LOG_TAG, "ERROR: FAILED TO CONNECT TO DEVICE");
          flashLED(strip.Color(255, 0, 0), 15000); // Flash red for error
          client.publish("homeassistant/sensor/mB/fmstatus", "FM ERROR");
          Serial.println("FM Status: ERROR");
        } else {
          if (currState) {
            client.publish("homeassistant/sensor/mB/fmstatus", "FM ON OK");
            Serial.println("FM Status: FM ON OK");
          } else {
            client.publish("homeassistant/sensor/mB/fmstatus", "FM OFF OK");
            Serial.println("FM Status: FM OFF OK");
          }
        }
      }
    }

    char cstr[20];
    JsonDocument jsonQtyDev;
    jsonQtyDev["qtydevices"] = deviceCount;
    serializeJson(jsonQtyDev, cstr);

    Serial.printf("INFO: MOBIUS BLE DEVICE COUNT: %i\n", deviceCount);
    flashLED(strip.Color(0, 255, 0), 5000); // Flash green for success

    if (!client.publish("homeassistant/sensor/mB/state", cstr)) {
      Serial.printf("ERROR: DID NOT PUBLISH DETECTED DEVICES\n");
      flashLED(strip.Color(255, 0, 0), 15000); // Flash red for error
    }

    prevState = currState;
  }

  firstRun = false;
}
 

iamdan

Community Member
View Badges
Joined
Jul 1, 2022
Messages
87
Reaction score
74
Location
Western Australia
Rating - 0%
0   0   0
Does anyone know if possible and if so what to code:
-- Have a permanent (if toggled on) "Feed Mode" where the pumps are idling like feed mode or even not spinning but the main unit is still on so you can send commands to it? until you turn that mode off?

-- Is it possible to set feed mode longer than 10 minutes? either by the Mobius app so that this Feed Mode code will activate that or by programming in this code directly?

Reason being is i have some slow eating plecos in a rapids simulated env where i need to have the pumps idling for a period of time so they can get to their food :p
 

iamdan

Community Member
View Badges
Joined
Jul 1, 2022
Messages
87
Reaction score
74
Location
Western Australia
Rating - 0%
0   0   0
I mean I'm not blaming anyone :beaming-face-with-smiling-eyes:

Its all a matter of time - the good thing on the HA front is it has good support for BLE devices directly, including GATT devices which need active connections, as well as using ESP32 devices as bridges to extend reach.
Hey Theatrus, out of curiousity, how you going with the Home Assistant version? i'm having issues where oneday everything works and cannot fault it and other days it's like why am i bothering lol
 

theatrus

Valuable Member
View Badges
Joined
Mar 26, 2016
Messages
2,223
Reaction score
3,632
Location
Sacramento, CA area
Rating - 0%
0   0   0
Hey Theatrus, out of curiousity, how you going with the Home Assistant version? i'm having issues where oneday everything works and cannot fault it and other days it's like why am i bothering lol

No progress on this yet, though I do want to try. Been too busy with getting other things out the door.

Your experience sounds like how the Mobius app its self works in general.. :)
 

iamdan

Community Member
View Badges
Joined
Jul 1, 2022
Messages
87
Reaction score
74
Location
Western Australia
Rating - 0%
0   0   0
No progress on this yet, though I do want to try. Been too busy with getting other things out the door.

Your experience sounds like how the Mobius app its self works in general.. :)
Yeah pretty much, 2 steps forward 6 steps back it seems but slowly making some progress with the error logic
 

iamdan

Community Member
View Badges
Joined
Jul 1, 2022
Messages
87
Reaction score
74
Location
Western Australia
Rating - 0%
0   0   0
Hi All

For those following along or that stumble on this thread, to make it "easier" i have compiled everything that i used into one location (Libraries, Instructions and Code): https://github.com/danmrossi/MobiusControl

For someone that is an IT Guy but first-time Arduino/Coder, I managed to get my ESP32 device to reliably turn on and off "Feed Mode" for 2x MP60's - Maybe can give the Mobius app devs some pointers :p :p :p (joking)

I learnt alot playing with this over the last few weeks, things like yes you can code in alot of failsafes and functions - but due to the, for lack of a better word "Quirks" of ESP32 Hardware, Libraries utilised etc - Sometimes "Less is more" as delays, buffer sizes etc that fix one thing breaks something else...
 

iamdan

Community Member
View Badges
Joined
Jul 1, 2022
Messages
87
Reaction score
74
Location
Western Australia
Rating - 0%
0   0   0
I was facing an issue where, if you leave the ESP32 device for a couple of hours/day etc and then try to toggle Feed Mode on/off it would either then only detect 1 device or even if it detected my 2 it wasn't able to set the Feed Mode on/off... but if i rebooted the ESp32 then did it it was fine....

After further digging and seeing that the ESP32 shares the same Antenna for WiFi & Bluetooth and looking into the specs on both i found that the WiFi 2.4ghz channel can overlap with the Bluetooth's so when i set my 2.4ghz on my Router from "Auto" to "Channel 1" - that solves that problem.

And if you want your device to work 24+ hours after look at my MobiusControl-v2 code on github :)
 

iamdan

Community Member
View Badges
Joined
Jul 1, 2022
Messages
87
Reaction score
74
Location
Western Australia
Rating - 0%
0   0   0
In regards the simple Feed Mode using the MobiusBLE library.

The sketch I posted before isn't working properly, but the one down below was just tested and is working for me.

Let me explain the idea:

The sketch uses the HA/MQTT auto discovery function.

during boot, it will publish 2 initial JSON messages so the HA component can be created automatically:

homeassistant/switch/mobiusBridge/config:
JSON:
{
    "name":"Feed Mode",  
    "command_topic":"homeassistant/switch/mobiusBridge/set",  
    "state_topic":"homeassistant/switch/mobiusBridge/state",  
    "unique_id":"mobius01ad",  
    "device":{
        "identifiers":[ "mobridge01ad" ],    
        "name":"Mobius"        
    }
}

and

homeassistant/sensor/mobiusBridge/config:
JSON:
{
    "name":"QTY Devices",  
    "state_topic":"homeassistant/sensor/mobiusBridge/state",  
    "value_template":"{{ value_json.qtydevices}}",  
    "unique_id":"qtydev01ae",  
    "device":{    
        "identifiers":[ "mobridge01ad" ]    
    }  
}

It will then send the Feed mode status and the quantity of Mobius Devices found:

homeassistant/switch/mobiusBridge/state: OFF
homeassistant/sensor/mobiusBridge/state: {"qtydevices":2}

Ideally, this should auto create the component in HA similar to the below:

1717480706128.png


To enable/disable Feed Mode, just turn on/off the "Feed Mode" switch.

Although the switch is now reflecting the new state, please note it takes time to scan and set the scene, but you can monitor the execution using the arduino Serial Monitor.

and lastly, use it at your own risk as I'm not a programmer and this was coded as a simple proof of concept based on @thetastate initial idea and no extensive test was executed.

C++:
#include <ESP32_MobiusBLE.h>
#include "ArduinoSerialDeviceEventListener.h"

#include "EspMQTTClient.h"
#include <string>
#include "secrets.h"
#include <ArduinoJson.h>

// Configuration for wifi and mqtt
EspMQTTClient client(
  mySSID,                // Your Wifi SSID
  myPassword,            // Your WiFi key
  "homeassistant.local", // MQTT Broker server ip
  mqttUser,              // mqtt username Can be omitted if not needed
  mqttPass,              // mqtt pass Can be omitted if not needed
  "Mobius",              // Client name that uniquely identify your device
  1883                   // MQTT Broker server port
);

char* jsonSwitchDiscovery =  "{\
    \"name\":\"Feed Mode\",\
    \"command_topic\":\"homeassistant/switch/mobiusBridge/set\",\
    \"state_topic\":\"homeassistant/switch/mobiusBridge/state\",\
    \"unique_id\":\"mobius01ad\",\
    \"device\":{\
      \"identifiers\":[\
        \"mobridge01ad\"\
      ],\
      \"name\":\"Mobius\"\
         }}";

char* jsonSensorDiscovery =  "{ \
    \"name\":\"QTY Devices\",\
    \"state_topic\":\"homeassistant/sensor/mobiusBridge/state\",\
    \"value_template\":\"{{ value_json.qtydevices}}\",\
    \"unique_id\":\"qtydev01ae\",\
    \"device\":{\
      \"identifiers\":[\
        \"mobridge01ad\"\
      ]\
      }\
    }";

char* jsonDeviceDiscovery =  "{ \
    \"state_topic\":\"homeassistant/sensor/%s/state\",\
    \"unique_id\":\"%s\",\
    \"device\":{\
      \"identifiers\":[\
        \"%s\"\
      ],\
      \"name\":\"%s\",\
      }\
    }";

bool prevState = false;
bool currState = false;
bool configPublish = false;
bool firstRun = true;

// wifi and mqtt connection established
void onConnectionEstablished()
{
  Serial.println("Connected to MQTT Broker :)");
 
  // Listen for a scene update from mqtt and call the update function
  // May need to do this from the loop(). Test.
  client.subscribe("homeassistant/switch/mobiusBridge/set", [](const String& feedMode) {
    if (feedMode.length() > 0) {
      if (feedMode == "ON") {
        Serial.printf("INFO: IS this On?   %s\n", feedMode);
        currState = true;
      } else {
        Serial.printf("INFO: IS this Off?   %s\n", feedMode);
        currState = false;
      }
      configPublish = false;

      Serial.printf("INFO: Update device scene from MQTT trigger: %s\n", feedMode);
      if (!client.publish("homeassistant/switch/mobiusBridge/state", feedMode)) {
        Serial.printf("ERROR: Did not publish Feed Switch");
      }

    }
  });

}

// Define a device buffer to hold found Mobius devices
MobiusDevice deviceBuffer[20];
int deviceCount = 0;

JsonDocument doc;

void setup() {
  // connect the serial port for logs
  Serial.begin(115200);
  while (!Serial);

  prevState = !currState;
  firstRun = true;

  client.enableDebuggingMessages(); // Enable debugging messages sent to serial output
  client.enableHTTPWebUpdater(); // Enable the web updater. User and password default to values of MQTTUsername and MQTTPassword. These can be overridded with enableHTTPWebUpdater("user", "password").
 
  // Increase default packet size for HA mqtt json messages
  client.setMaxPacketSize(2048);

  // Initialize the library with a useful event listener
  MobiusDevice::init(new ArduinoSerialDeviceEventListener());

  Serial.println("Setup run");
}

void loop() {
  // Wait for mqtt and wifi connection
  while(!client.isConnected()){client.loop();};

  // Loop mqtt
  client.loop();


  // create buffer to store the Mobius devices
  MobiusDevice device = deviceBuffer[0];

  if (!configPublish) {
    //Scan BLE and MQTT Publish the main config only on boot or on status change
    Serial.printf("=========================================================\n");
    Serial.printf("     INFO: BLE SCAN + PUBLISHING THE MAIN CONFIG \n");
    Serial.printf("=========================================================\n");

    //Scan for Mobius devices
    int scanDuration = 5; // in seconds
    deviceCount = 0;

    while (!deviceCount) {
      //Scan until at least one device is returned
      deviceCount = MobiusDevice::scanForMobiusDevices(scanDuration, deviceBuffer,10);
      Serial.printf("INFO: Mobius Devices found: %i\n", deviceCount);
    }

    if (!client.publish("homeassistant/switch/mobiusBridge/config", jsonSwitchDiscovery)) {  //This one is for the switch
      Serial.printf("ERROR: Did not publish");
    }

    if (!client.publish("homeassistant/sensor/mobiusBridge/config", jsonSensorDiscovery)) { //This is for the QTY
      Serial.printf("ERROR: Did not publish");
    }

    configPublish = true;

    // delaying without sleeping
    unsigned long startMillis = millis();
    while (2000 > (millis() - startMillis)) {}  
  }

  /***************************************************************
  ************       BLE Connection starts here       ************
  ***************************************************************/
  //inside the mqtt subscribe function onConnectionEstablished(), it will turn the LED on with digitalWrite(LED_BUILTIN, HIGH);

    if (prevState != currState) {
    //If Current state is different from previous, publish MQTT state
    Serial.printf("INFO: Publishing state");

    if (!firstRun){
      // Do not connect to device during boot

      for (int i = 0; i < deviceCount; i++) {
        // connect to each device in buffer to set the new scene
        device = deviceBuffer[i];

        int tries = 1;
        //loop until connected or exit after 10 tries
        while(tries<=10){

          // Connect, get serialNumber and current scene
          Serial.printf("\nINFO: Connect to device number: %i\n", i);
          if (device.connect()) {

            //Get Current scene
            uint16_t sceneId = device.getCurrentScene();

            //Convert scene from int to friendly MQTT text
            char currScene[2];
            sprintf(currScene, "%u", sceneId);
           
            // delaying without sleeping
            unsigned long startMillis = millis();
            while (1000 > (millis() - startMillis)) {}

            /*===============================================
            =====               Set Scene               =====
            ===============================================*/
            if ((sceneId!=1) and (currState) ) {
              //Scene is different from feed mode (1), and Feed switch is ON, set device to feed mode
              device.setFeedScene();
            } else if ((sceneId==1) and !currState) {
              //Scene is feed mode (1), and Feed switch is OFF, set device to Normal Schedule
              device.runSchedule();
            }

            //Disconnect from Mobius Device
            device.disconnect();

            //If connection completed, break the loop
            break;
          }
          else {
            tries++;
          }
         
        }

        //Print error message if didn't connect after 10 tries
        if (tries>9) {
          ESP_LOGE(LOG_TAG, "ERROR: Failed to connect to device");
        }
      }
    }  

    char cstr[20];
    JsonDocument jsonQtyDev;
    jsonQtyDev["qtydevices"] = deviceCount;
    serializeJson(jsonQtyDev, cstr);

    Serial.printf("INFO: Mobius BLE device count: %i\n", deviceCount);
   
      if (!client.publish("homeassistant/sensor/mobiusBridge/state", cstr)) {
        FYI:Serial.printf("ERROR: Did not publish qtyitems");
      }

    prevState = currState;
  }

  firstRun = false;
}
And you Mr :p hows your project coming along?
 

deutchriffer

Community Member
View Badges
Joined
Jul 15, 2024
Messages
53
Reaction score
9
Location
Germany
Rating - 0%
0   0   0
Wondering if this has any ability to control the versa’s purely from a on/off perspective or something to pause dosing, one thing I regret about buying the base station for the versa is you can only turn all pumps off rather than the one you need to turn off (hope that makes sense)
 

deutchriffer

Community Member
View Badges
Joined
Jul 15, 2024
Messages
53
Reaction score
9
Location
Germany
Rating - 0%
0   0   0
Does anyone know if this can be used to control a versa pump? Even if it’s just on/off or pausing dosing..one of the biggest regrets grabbing the 4 kit with base station is having no way to control the power of an individual pump, eg when trying a continuous dosing task like kalk or AWC
 

Simonv92

Active Member
View Badges
Joined
Oct 21, 2014
Messages
145
Reaction score
105
Location
Italy
Rating - 0%
0   0   0
How did you go mate?
Sorry for the late reply @iamdan..
I've tryed the code (fixing all the ArduinoJason file path) but I have these errors:


Code:
In file included from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\rgbw.h:7,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\rgbw.cpp:5:
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\eorder.h:11:6: error: multiple definition of 'enum EOrder'
 enum EOrder {
      ^~~~~~
In file included from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\controller.h:9,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\FastLED.h:61,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\rgbw.cpp:3:
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\pixeltypes.h:954:6: note: previous definition here
 enum EOrder {
      ^~~~~~
In file included from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt.h:114,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt_impl.cpp:16:
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/eorder.h:11:6: error: multiple definition of 'enum EOrder'
 enum EOrder {
      ^~~~~~
In file included from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/controller.h:9,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/FastLED.h:61,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt_impl.cpp:14:
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/pixeltypes.h:954:6: note: previous definition here
 enum EOrder {
      ^~~~~~
In file included from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt_impl.h:15,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt_impl.cpp:17:
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\clock_cycles.h:15:56: error: redefinition of 'uint32_t __clock_cycles()'
 __attribute__ ((always_inline)) inline static uint32_t __clock_cycles() {
                                                        ^~~~~~~~~~~~~~
In file included from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms/esp/32/fastled_esp32.h:12,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms.h:42,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/FastLED.h:66,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt_impl.cpp:14:
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms/esp/32/clockless_rmt_esp32.h:144:56: note: 'uint32_t __clock_cycles()' previously defined here
 __attribute__ ((always_inline)) inline static uint32_t __clock_cycles() {
                                                        ^~~~~~~~~~~~~~
In file included from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt_impl.cpp:17:
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt_impl.h:58:7: error: redefinition of 'class ESP32RMTController'
 class ESP32RMTController
       ^~~~~~~~~~~~~~~~~~
In file included from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms/esp/32/fastled_esp32.h:12,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms.h:42,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/FastLED.h:66,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt_impl.cpp:14:
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms/esp/32/clockless_rmt_esp32.h:238:7: note: previous definition of 'class ESP32RMTController'
 class ESP32RMTController
       ^~~~~~~~~~~~~~~~~~
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt_impl.cpp:267:1: error: no declaration matches 'ESP32RMTController::ESP32RMTController(int, int, int, int, int, bool)'
 ESP32RMTController::ESP32RMTController(int DATA_PIN, int T1, int T2, int T3, int maxChannel, bool built_in_driver)
 ^~~~~~~~~~~~~~~~~~
In file included from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms/esp/32/fastled_esp32.h:12,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms.h:42,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/FastLED.h:66,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt_impl.cpp:14:
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms/esp/32/clockless_rmt_esp32.h:238:7: note: candidates are: 'constexpr ESP32RMTController::ESP32RMTController(ESP32RMTController&&)'
 class ESP32RMTController
       ^~~~~~~~~~~~~~~~~~
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms/esp/32/clockless_rmt_esp32.h:238:7: note:                 'constexpr ESP32RMTController::ESP32RMTController(const ESP32RMTController&)'
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms/esp/32/clockless_rmt_esp32.h:285:5: note:                 'ESP32RMTController::ESP32RMTController(int, int, int, int, int, int)'
     ESP32RMTController(int DATA_PIN, int T1, int T2, int T3, int maxChannel, int memBlocks);
     ^~~~~~~~~~~~~~~~~~
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms/esp/32/clockless_rmt_esp32.h:238:7: note: 'class ESP32RMTController' defined here
 class ESP32RMTController
       ^~~~~~~~~~~~~~~~~~
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt_impl.cpp:336:6: error: no declaration matches 'void ESP32RMTController::init(gpio_num_t, bool)'
 void ESP32RMTController::init(gpio_num_t pin, bool built_in_driver)
      ^~~~~~~~~~~~~~~~~~
In file included from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms/esp/32/fastled_esp32.h:12,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms.h:42,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/FastLED.h:66,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt_impl.cpp:14:
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms/esp/32/clockless_rmt_esp32.h:296:17: note: candidate is: 'static void ESP32RMTController::init(gpio_num_t)'
     static void init(gpio_num_t pin);
                 ^~~~
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms/esp/32/clockless_rmt_esp32.h:238:7: note: 'class ESP32RMTController' defined here
 class ESP32RMTController
       ^~~~~~~~~~~~~~~~~~
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt_impl.cpp: In member function 'void ESP32RMTController::showPixels()':
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt_impl.cpp:410:20: error: 'mBuiltInDriver' was not declared in this scope
         init(mPin, mBuiltInDriver);
                    ^~~~~~~~~~~~~~
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt_impl.cpp: In member function 'void ESP32RMTController::startOnChannel(int)':
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt_impl.cpp:499:9: error: 'mBuiltInDriver' was not declared in this scope
     if (mBuiltInDriver)
         ^~~~~~~~~~~~~~
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt_impl.cpp:511:63: error: cannot convert 'volatile rmt_item32_t*' {aka 'volatile rmt_item32_s*'} to 'volatile uint32_t*' {aka 'volatile unsigned int*'} in assignment
         mRMT_mem_start = &(RMTMEM.chan[mRMT_channel].data32[0]);
                                                               ^
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt_impl.cpp: In member function 'void ESP32RMTController::fillNext(bool)':
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt_impl.cpp:879:53: error: cannot convert 'volatile uint32_t*' {aka 'volatile unsigned int*'} to 'volatile rmt_item32_t*' {aka 'volatile rmt_item32_s*'} in initialization
     volatile FASTLED_REGISTER rmt_item32_t *pItem = mRMT_mem_ptr;
                                                     ^~~~~~~~~~~~
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt_impl.cpp:904:17: error: cannot convert 'volatile uint32_t*' {aka 'volatile unsigned int*'} to 'volatile rmt_item32_t*' {aka 'volatile rmt_item32_s*'} in assignment
         pItem = mRMT_mem_start;
                 ^~~~~~~~~~~~~~
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt_impl.cpp:909:20: error: cannot convert 'volatile rmt_item32_t*' {aka 'volatile rmt_item32_s*'} to 'volatile uint32_t*' {aka 'volatile unsigned int*'} in assignment
     mRMT_mem_ptr = pItem;
                    ^~~~~
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt_impl.cpp: At global scope:
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt_impl.cpp:929:6: error: no declaration matches 'void ESP32RMTController::ingest(uint8_t)'
 void ESP32RMTController::ingest(uint8_t byteval)
      ^~~~~~~~~~~~~~~~~~
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt_impl.cpp:929:6: note: no functions named 'void ESP32RMTController::ingest(uint8_t)'
In file included from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms/esp/32/fastled_esp32.h:12,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms.h:42,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/FastLED.h:66,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt_impl.cpp:14:
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms/esp/32/clockless_rmt_esp32.h:238:7: note: 'class ESP32RMTController' defined here
 class ESP32RMTController
       ^~~~~~~~~~~~~~~~~~
In file included from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/controller.h:9,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/FastLED.h:61,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt.cpp:10:
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/pixeltypes.h:954:6: error: multiple definition of 'enum EOrder'
 enum EOrder {
      ^~~~~~
In file included from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt.h:114,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt.cpp:9:
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/eorder.h:11:6: note: previous definition here
 enum EOrder {
      ^~~~~~
In file included from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt_impl.h:15,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt.cpp:11:
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\clock_cycles.h:15:56: error: redefinition of 'uint32_t __clock_cycles()'
 __attribute__ ((always_inline)) inline static uint32_t __clock_cycles() {
                                                        ^~~~~~~~~~~~~~
In file included from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms/esp/32/fastled_esp32.h:12,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms.h:42,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/FastLED.h:66,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt.cpp:10:
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms/esp/32/clockless_rmt_esp32.h:144:56: note: 'uint32_t __clock_cycles()' previously defined here
 __attribute__ ((always_inline)) inline static uint32_t __clock_cycles() {
                                                        ^~~~~~~~~~~~~~
In file included from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt.cpp:11:
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt_impl.h:58:7: error: redefinition of 'class ESP32RMTController'
 class ESP32RMTController
       ^~~~~~~~~~~~~~~~~~
In file included from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms/esp/32/fastled_esp32.h:12,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms.h:42,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/FastLED.h:66,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt.cpp:10:
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms/esp/32/clockless_rmt_esp32.h:238:7: note: previous definition of 'class ESP32RMTController'
 class ESP32RMTController
       ^~~~~~~~~~~~~~~~~~
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt.cpp: In static member function 'static void RmtController::init(int, bool)':
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt.cpp:15:51: error: no matching function for call to 'ESP32RMTController::init(gpio_num_t&, bool&)'
     ESP32RMTController::init(_pin, built_in_driver);
                                                   ^
In file included from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms/esp/32/fastled_esp32.h:12,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms.h:42,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/FastLED.h:66,
                 from c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt.cpp:10:
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms/esp/32/clockless_rmt_esp32.h:296:17: note: candidate: 'static void ESP32RMTController::init(gpio_num_t)'
     static void init(gpio_num_t pin);
                 ^~~~
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src/platforms/esp/32/clockless_rmt_esp32.h:296:17: note:   candidate expects 1 argument, 2 provided
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt.cpp: In member function 'void RmtController::ingest(uint8_t)':
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt.cpp:27:50: error: 'class ESP32RMTController' has no member named 'ingest'; did you mean 'init'?
 void RmtController::ingest(uint8_t val) { pImpl->ingest(val); }
                                                  ^~~~~~
                                                  init
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt.cpp: In member function 'bool RmtController::built_in_driver()':
c:\Users\Simone\Documents\Arduino\libraries\FastLED\src\platforms\esp\32\idf4_rmt.cpp:33:55: error: 'class ESP32RMTController' has no member named 'mBuiltInDriver'
 bool RmtController::built_in_driver() { return pImpl->mBuiltInDriver; }
                                                       ^~~~~~~~~~~~~~
Multiple libraries were found for "ESP32_MobiusBLE.h"
  Used: C:\Users\Simone\Documents\Arduino\libraries\ESP32_MobiusBLE
  Not used: C:\Users\Simone\Documents\Arduino\libraries\esp32-MobiusBLE-main
exit status 1

Compilation error: exit status 1

What can it be?
 

HAVE YOU EVER KEPT A RARE/UNCOMMON FISH, CORAL, OR INVERT? SHOW IT OFF IN THE THREAD!

  • Yes!

    Votes: 32 45.7%
  • Not yet, but I have one that I want to buy in mind!

    Votes: 9 12.9%
  • No.

    Votes: 26 37.1%
  • Other (please explain).

    Votes: 3 4.3%
Back
Top