danionescu
Published © GPL3+

Home Assistant Geiger Counter Integration

Full instructions provided23
Home Assistant Geiger Counter Integration

Story

Read more

Code

Code snippet #2

Plain text
Booting
IP address: 192.168.1.168
OTA enabled
Connecting to MQTT... MQTT Connected!
{"radiation": 0.03}
..

Code snippet #4

Plain text
sensor:
  - platform: mqtt
    name: "Radiation"
    state_topic: "ha/radiation"
    unit_of_measurement: 'uSv'
    unique_id: "radiation"
    value_template: "{{ value_json.radiation }}"

Code snippet #12

Plain text
while (WiFi.waitForConnectResult() != WL_CONNECTED) {
      Serial.println("Connection Failed! Rebooting...");
      delay(5000);
      ESP.restart();
    }
    ArduinoOTA.setPassword(SKETCHPASS);
    ArduinoOTA.onStart([]() {
        String type;
        if (ArduinoOTA.getCommand() == U_FLASH) {
          type = "sketch";
        } else { // U_FS
          type = "filesystem";
        }
        Serial.println("Start updating " + type);
    });
    ArduinoOTA.onEnd([]() {
        Serial.println("\nEnd");
    });
    ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
        Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
    });
    ArduinoOTA.onError([](ota_error_t error) {
        Serial.printf("Error[%u]: ", error);
        if (error == OTA_AUTH_ERROR) {
          Serial.println("Auth Failed");
        } else if (error == OTA_BEGIN_ERROR) {
          Serial.println("Begin Failed");
        } else if (error == OTA_CONNECT_ERROR) {
          Serial.println("Connect Failed");
        } else if (error == OTA_RECEIVE_ERROR) {
          Serial.println("Receive Failed");
        } else if (error == OTA_END_ERROR) {
          Serial.println("End Failed");
        }
    });
    ArduinoOTA.begin();
    Serial.print("IP address: ");
    Serial.println(WiFi.localIP());

Github

https://github.com/danionescu0/arduino

Credits

danionescu
11 projects • 73 followers
I'm an electronics enthusiast, passionate about science, and programming.I like the challenges involved with building things from scratch.
Contact

Comments

Please log in or sign up to comment.