Browse Source

Codacy changes

rfm69
Xose Pérez 6 years ago
parent
commit
1f880e0cde
2 changed files with 7 additions and 6 deletions
  1. +4
    -4
      code/espurna/homeassistant.ino
  2. +3
    -2
      code/espurna/system.ino

+ 4
- 4
code/espurna/homeassistant.ino View File

@ -23,8 +23,8 @@ void _haSendMagnitude(unsigned char i, JsonObject& config) {
unsigned char type = magnitudeType(i);
config["name"] = getSetting("hostname") + String(" ") + magnitudeTopic(type);
config["platform"] = "mqtt";
config["device_class"] = "sensor";
config.set("platform", "mqtt");
config.set("device_class", "sensor");
config["state_topic"] = mqttTopic(magnitudeTopicIndex(i).c_str(), false);
config["unit_of_measurement"] = String("\"") + magnitudeUnits(type) + String("\"");
@ -67,8 +67,8 @@ void _haSendSwitch(unsigned char i, JsonObject& config) {
name += String(" #") + String(i);
}
config["name"] = name;
config["platform"] = "mqtt";
config.set("name", name);
config.set("platform", "mqtt");
if (relayCount()) {
config["state_topic"] = mqttTopic(MQTT_TOPIC_RELAY, i, false);


+ 3
- 2
code/espurna/system.ino View File

@ -105,12 +105,13 @@ void systemLoop() {
static unsigned long last_loadcheck = 0;
static unsigned long load_counter_temp = 0;
static unsigned long load_counter = 0;
static unsigned long load_counter_max = 1;
load_counter_temp++;
if (millis() - last_loadcheck > LOADAVG_INTERVAL) {
static unsigned long load_counter = 0;
static unsigned long load_counter_max = 1;
load_counter = load_counter_temp;
load_counter_temp = 0;
if (load_counter > load_counter_max) {


Loading…
Cancel
Save