Homeyduino weatherstation

Good morning, I was trying to create a weatherstation with arduino using a:

  • DHT22 (temperature/humidity sensor)
  • Rain/Snow sensor
  • NodeMcu V3 ESP-12E

This is working standalone as webserver. After testing it, i’ve tried to change my code, so I could add it to homey with the not further developed homeyduino app. But I’m receiving error:

This is my full arduino code:

#include <ESP8266WiFi.h>
#include <Homey.h>
#include <DHT.h>

#define DHTPIN D4
#define DHTTYPE DHT22
#define RAIN_SENSOR_PIN A0

DHT dht(DHTPIN, DHTTYPE);

const char* ssid = "changed";
const char* password = "changed";

// Statisch IP-adres instellen
IPAddress staticIP(192, 168, 2, 219);  
IPAddress gateway(192, 168, 2, 254);
IPAddress subnet(255, 255, 255, 0);

void setup() {
  Serial.begin(115200);
  dht.begin();
  pinMode(RAIN_SENSOR_PIN, INPUT);

  WiFi.begin(ssid, password);
  WiFi.config(staticIP, gateway, subnet);
  Serial.print("Verbinden met WiFi");
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("Verbonden!");
  Serial.println(WiFi.localIP());

  // Homeyduino setup
  Homey.begin("TempHuminRainSensor", "sensor");
  Homey.setClass("sensor");
  Homey.addCapability("measure_temperature");
  Homey.addCapability("measure_humidity");
  Homey.addCapability("measure_rain");
  Homey.addCapability("alarm_water");
}

void loop() {
  Homey.loop();

  float temperature = dht.readTemperature();
  float humidity = dht.readHumidity();
  int rainValue = analogRead(RAIN_SENSOR_PIN);
  
  float rainAmount = 0.0;
  bool rainAlarm = false;

  if (rainValue < 500) {
    rainAmount = 2.0;  // Simuleer regenval in mm
    rainAlarm = true;
  } else if (rainValue >= 500 && rainValue <= 600) {
    rainAmount = 0.5;  // Simuleer motregen
    rainAlarm = true;
  } else {
    rainAmount = 0.0;  // Droog
    rainAlarm = false;
  }

  // Stuur waarden naar Homey
  Homey.setCapabilityValue("measure_temperature", temperature);
  Homey.setCapabilityValue("measure_humidity", humidity);
  Homey.setCapabilityValue("measure_rain", rainAmount);
  Homey.setCapabilityValue("alarm_water", rainAlarm);

  delay(5000); // Update elke 5 seconden
}

Hoping someone could point me into the right direction, so I can get it to work and continue to print a casing for it.

Thank in advance

Please use the app’s topic