Skip to content

Commit

Permalink
Merge pull request #55 from HomeControlAS/no_issue_arduino_lib_manager
Browse files Browse the repository at this point in the history
No issue arduino lib manager
  • Loading branch information
sekyHC authored Oct 7, 2020
2 parents e8732e6 + 2c41d1e commit 3b9a921
Show file tree
Hide file tree
Showing 9 changed files with 123 additions and 182 deletions.
80 changes: 0 additions & 80 deletions Functions.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "DHT.h"
#include "Endpoints/EndpointOnOff.h"
#include "Endpoints/EndpointTemperatureTarget.h"
#include "Endpoints/EndpointThermostat.h"

//#define DEBUG

Expand All @@ -30,7 +30,7 @@ bool last_state = false;

HomeControlMagic hcm(deviceName);

EndpointTemperatureTarget endpointTemperatureTarget(&hcm);
EndpointThermostat endpointThermostat(&hcm);
EndpointOnOff endpointOnOff(&hcm);

DHT dht(DHT_PIN, DHTTYPE);
Expand Down Expand Up @@ -76,13 +76,13 @@ void setup()

pinMode(DEVICE_PIN, OUTPUT);

hcm.addEndpoint(&endpointTemperatureTarget);
hcm.addEndpoint(&endpointThermostat);
hcm.addEndpoint(&endpointOnOff);

dht.begin();

double temperature = dht.readTemperature();
endpointTemperatureTarget.setTemperatureTarget(temperature);
endpointThermostat.setTemperatureTarget(temperature);
}

void loop()
Expand All @@ -105,17 +105,17 @@ void loop()
}
else
{
endpointTemperatureTarget.setTemperature(temperature);
endpointThermostat.setTemperature(temperature);
}

#ifdef DEBUG
Serial.print("Temperature from sensor: ");
Serial.print(endpointTemperatureTarget.getTemperature());
Serial.print(endpointThermostat.getTemperature());
Serial.print(" *C ");
Serial.println();

Serial.print("Temperature target: ");
Serial.print(endpointTemperatureTarget.getTemperatureTarget());
Serial.print(endpointThermostat.getTemperatureTarget());
Serial.print(" *C ");
Serial.println();
#endif
Expand Down
38 changes: 38 additions & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Syntax Coloring Map For HomeControl-mqtt library

# Datatypes (KEYWORD1)
HomeControlMagic KEYWORD1
EndpointOnOff KEYWORD1
EndpointColor KEYWORD1
EndpointIdentify KEYWORD1
EndpointLevel KEYWORD1
EndpointMotion KEYWORD1
EndpointTemperature KEYWORD1
EndpointThermostat KEYWORD1

# Methods and Functions (KEYWORD2)
doMagic KEYWORD2
addEndpoint KEYWORD2
getState KEYWORD2
setState KEYWORD2
setLevel KEYWORD2
getLevel KEYWORD2
getColorR KEYWORD2
getColorG KEYWORD2
getColorB KEYWORD2
setTemperature KEYWORD2
getTemperature KEYWORD2
setHeatingSetpoint KEYWORD2
getHeatingSetpoint KEYWORD2
networkSetSsid KEYWORD2
networkSetPass KEYWORD2
networkSetSecure KEYWORD2
networkSetup KEYWORD2
networkStart KEYWORD2
wrapperSetServer KEYWORD2
wrapperSetUsernamePassword KEYWORD2
wrapperSetup KEYWORD2

# Instances (KEYWORD2)

# Constants (LITERAL1)
18 changes: 0 additions & 18 deletions library.json

This file was deleted.

9 changes: 5 additions & 4 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name=homecontrol-mqtt
version=0.1
author=homecontrol
maintainer=homecontrol
version=1.0.0
author=Home Control <integration@homecontrol.no>
maintainer=Home Control <integration@homecontrol.no>
sentence=A client library for MQTT messaging.
paragraph= This library allows you to send and receive MQTT messages with HomeControlAS system.
category=Communication
url=https://github.com/HomeControlAS/homecontrol-mqtt
architectures=*
architectures=*
depends=PubSubClient
66 changes: 0 additions & 66 deletions src/Endpoints/EndpointTemperatureTarget.cpp

This file was deleted.

66 changes: 66 additions & 0 deletions src/Endpoints/EndpointThermostat.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#include "EndpointThermostat.h"
#include "HomeControlMagic.h"
#include "debugDefines.h"
#include "helperFunctions.h"
#include "printWrapper.h"

static char* const CONFIG = "thrmstt";

EndpointThermostat::EndpointThermostat(HomeControlMagic* hcm_ptr)
: Endpoint(hcm_ptr)
, m_temperature(0)
{
m_config = CONFIG;
}

void EndpointThermostat::setTemperature(double temperature)
{
m_temperature = temperature;
}

double EndpointThermostat::getTemperature()
{
return m_temperature;
}

void EndpointThermostat::setHeatingSetpoint(double temperature)
{
m_heating_setpoint = temperature;
}

double EndpointThermostat::getHeatingSetpoint()
{
return m_heating_setpoint;
}

void EndpointThermostat::incomingMessage(char* topic, uint8_t* payload, unsigned int length)
{
#ifdef ENDPOINT_THERMOSTAT_DEBUG
print(F("Incoming message, EndpointThermostat"));
#endif

if(lineContains(topic, "chs"))
{
m_heating_setpoint = extractDouble(payload, length);
}

else if(lineContains(topic, "shs"))
{
m_owner->sendMessage("shs", m_heating_setpoint, m_id);
}

else if(lineContains(topic, "st"))
{
m_owner->sendMessage("st", m_temperature, m_id);
}
}

void EndpointThermostat::sendFeedbackMessage()
{
#ifdef ENDPOINT_THERMOSTAT_DEBUG
print(F("Sending feedback message, EndpointThermostat"));
#endif

m_owner->sendMessage("st", m_temperature, m_id);
m_owner->sendMessage("shs", m_heating_setpoint, m_id);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@

#include "Endpoint.h"

class EndpointTemperatureTarget : public Endpoint
class EndpointThermostat : public Endpoint
{
public:
EndpointTemperatureTarget(HomeControlMagic* hcm_ptr);
EndpointThermostat(HomeControlMagic* hcm_ptr);

virtual void sendFeedbackMessage();

virtual void incomingMessage(char* topic, uint8_t* payload, unsigned int length);

virtual void setTemperature(double temperature);
virtual void setTemperatureTarget(double temperature);
virtual void setHeatingSetpoint(double temperature);

virtual double getTemperature();
virtual double getTemperatureTarget();
virtual double getHeatingSetpoint();

protected:
double m_temperature;
double m_temperature_target;
double m_heating_setpoint;
};
4 changes: 2 additions & 2 deletions src/debugDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#define HCM_DEBUG
#define ENDPOINT_DEBUG
#define ENDPOINT_ZERO_DEBUG
#define ENDPOINT_TEMPERATURE_TARGET_DEBUG
#define ENDPOINT_THERMOSTAT_DEBUG
#define ENDPOINT_TEMPERATURE_DEBUG
#define ENDPOINT_ON_OFF_DEBUG
#define ENDPOINT_MOTION_DEBUG
Expand All @@ -21,7 +21,7 @@
// #define HCM_DEBUG
// #define ENDPOINT_DEBUG
// #define ENDPOINT_ZERO_DEBUG
// #define ENDPOINT_TEMPERATURE_TARGET_DEBUG
// #define ENDPOINT_THERMOSTAT_DEBUG
// #define ENDPOINT_TEMPERATURE_DEBUG
// #define ENDPOINT_ON_OFF_DEBUG
// #define ENDPOINT_MOTION_DEBUG
Expand Down

0 comments on commit 3b9a921

Please sign in to comment.