Log output changed to console instead of mqtt
This commit is contained in:
parent
b860d50d23
commit
2fed8b51ec
|
@ -56,129 +56,118 @@ mqtt:
|
||||||
on_json_message:
|
on_json_message:
|
||||||
topic: $devicename/led/command
|
topic: $devicename/led/command
|
||||||
then:
|
then:
|
||||||
- if:
|
# Debug
|
||||||
condition:
|
- lambda: |-
|
||||||
not:
|
const char * c = x["color"];
|
||||||
# todo check json length
|
const char * e = x["effect"];
|
||||||
text_sensor.state:
|
const char * s = x["speed"];
|
||||||
id: fingerprint_state
|
const char * cnt = x["count"];
|
||||||
state: "cancelling enrollment"
|
|
||||||
then:
|
|
||||||
# default values speed count
|
|
||||||
- text_sensor.template.publish:
|
|
||||||
id: mqtt_json
|
|
||||||
state: !lambda |-
|
|
||||||
std::string color = x["color"];
|
|
||||||
std::string effect = x["effect"];
|
|
||||||
std::string speed = x["speed"];
|
|
||||||
std::string count = x["count"];
|
|
||||||
|
|
||||||
return "Color:" + color + " Effekt:" + effect + " Speed:" + speed + " Count:" + count;
|
ESP_LOGD("main", "Cmd: Color:%s | Effect: %s | Speed:%s | Count:%s", c,e,s,cnt);
|
||||||
|
- fingerprint_grow.aura_led_control:
|
||||||
|
state: !lambda |-
|
||||||
|
std::string str = x["effect"];
|
||||||
|
std::transform(str.begin(), str.end(), str.begin(), ::toupper);
|
||||||
|
|
||||||
- fingerprint_grow.aura_led_control:
|
uint8_t eff = 0x03;
|
||||||
state: !lambda |-
|
if(str == "BREATHING")
|
||||||
std::string str = x["effect"];
|
{
|
||||||
std::transform(str.begin(), str.end(), str.begin(), ::toupper);
|
eff = 0x01;
|
||||||
|
return eff;
|
||||||
uint8_t eff = 0x03;
|
}
|
||||||
if(str == "BREATHING")
|
else if (str == "FLASHING"){
|
||||||
{
|
eff = 0x02;
|
||||||
eff = 0x01;
|
return eff;
|
||||||
return eff;
|
}
|
||||||
}
|
else if (str == "ALWAYS_ON"){
|
||||||
else if (str == "FLASHING"){
|
eff = 0x03;
|
||||||
eff = 0x02;
|
return eff;
|
||||||
return eff;
|
}
|
||||||
}
|
else if (str == "ALWAYS_OFF"){
|
||||||
else if (str == "ALWAYS_ON"){
|
eff = 0x04;
|
||||||
eff = 0x03;
|
return eff;
|
||||||
return eff;
|
}
|
||||||
}
|
else if (str == "GRADUAL_ON"){
|
||||||
else if (str == "ALWAYS_OFF"){
|
eff = 0x05;
|
||||||
eff = 0x04;
|
return eff;
|
||||||
return eff;
|
}
|
||||||
}
|
else if (str == "GRADUAL_OFF"){
|
||||||
else if (str == "GRADUAL_ON"){
|
eff = 0x06;
|
||||||
eff = 0x05;
|
return eff;
|
||||||
return eff;
|
}
|
||||||
}
|
return 0;
|
||||||
else if (str == "GRADUAL_OFF"){
|
speed: !lambda return x["speed"];
|
||||||
eff = 0x06;
|
color: !lambda |-
|
||||||
return eff;
|
std::string str = x["color"];
|
||||||
}
|
std::transform(str.begin(), str.end(), str.begin(), ::toupper);
|
||||||
return 0;
|
|
||||||
speed: !lambda return x["speed"];
|
uint8_t color = 0x01;
|
||||||
color: !lambda |-
|
if(str == "RED")
|
||||||
std::string str = x["color"];
|
{
|
||||||
std::transform(str.begin(), str.end(), str.begin(), ::toupper);
|
color = 0x01;
|
||||||
|
return color;
|
||||||
uint8_t color = 0x01;
|
}
|
||||||
if(str == "RED")
|
else if (str == "BLUE"){
|
||||||
{
|
color = 0x02;
|
||||||
color = 0x01;
|
return color;
|
||||||
return color;
|
}
|
||||||
}
|
else if (str == "PURPLE"){
|
||||||
else if (str == "BLUE"){
|
color = 0x03;
|
||||||
color = 0x02;
|
return color;
|
||||||
return color;
|
}
|
||||||
}
|
else if (str == "GREEN"){
|
||||||
else if (str == "PURPLE"){
|
color = 0x04;
|
||||||
color = 0x03;
|
return color;
|
||||||
return color;
|
}
|
||||||
}
|
else if (str == "YELLOW"){
|
||||||
else if (str == "GREEN"){
|
color = 0x05;
|
||||||
color = 0x04;
|
return color;
|
||||||
return color;
|
}
|
||||||
}
|
else if (str == "CYAN"){
|
||||||
else if (str == "YELLOW"){
|
color = 0x06;
|
||||||
color = 0x05;
|
return color;
|
||||||
return color;
|
}
|
||||||
}
|
else if (str == "WHITE"){
|
||||||
else if (str == "CYAN"){
|
color = 0x07;
|
||||||
color = 0x06;
|
return color;
|
||||||
return color;
|
}
|
||||||
}
|
return color;
|
||||||
else if (str == "WHITE"){
|
count: !lambda return x["count"];
|
||||||
color = 0x07;
|
- text_sensor.template.publish:
|
||||||
return color;
|
id: led_color
|
||||||
}
|
state: !lambda |-
|
||||||
return color;
|
std::string str = x["effect"];
|
||||||
count: !lambda return x["count"];
|
std::string color = x["color"];
|
||||||
- text_sensor.template.publish:
|
std::transform(str.begin(), str.end(), str.begin(), ::toupper);
|
||||||
id: led_color
|
if(str == "ALWAYS_OFF" || str == "GRADUAL_OFF")
|
||||||
state: !lambda |-
|
{
|
||||||
std::string str = x["effect"];
|
return "off";
|
||||||
std::string color = x["color"];
|
}
|
||||||
std::transform(str.begin(), str.end(), str.begin(), ::toupper);
|
else
|
||||||
if(str == "ALWAYS_OFF" || str == "GRADUAL_OFF")
|
{
|
||||||
{
|
return color;
|
||||||
return "off";
|
}
|
||||||
}
|
# show on webserver
|
||||||
else
|
- text_sensor.template.publish:
|
||||||
{
|
id: led_state
|
||||||
return color;
|
state: !lambda |-
|
||||||
}
|
std::string str = x["effect"];
|
||||||
# show on webserver
|
std::transform(str.begin(), str.end(), str.begin(), ::toupper);
|
||||||
- text_sensor.template.publish:
|
if(str == "ALWAYS_OFF" || str == "GRADUAL_OFF")
|
||||||
id: led_state
|
{
|
||||||
state: !lambda |-
|
return "off";
|
||||||
std::string str = x["effect"];
|
}
|
||||||
std::transform(str.begin(), str.end(), str.begin(), ::toupper);
|
else
|
||||||
if(str == "ALWAYS_OFF" || str == "GRADUAL_OFF")
|
{
|
||||||
{
|
return "on";
|
||||||
return "off";
|
}
|
||||||
}
|
- mqtt.publish_json:
|
||||||
else
|
topic: $devicename/led/
|
||||||
{
|
qos: 1
|
||||||
return "on";
|
#retain: true
|
||||||
}
|
payload: |-
|
||||||
- mqtt.publish_json:
|
root["led_state"] = id(led_state).state;
|
||||||
topic: $devicename/led/
|
root["color"] = id(led_color).state;
|
||||||
qos: 1
|
|
||||||
#retain: true
|
|
||||||
payload: |-
|
|
||||||
root["led_state"] = id(led_state).state;
|
|
||||||
root["color"] = id(led_color).state;
|
|
||||||
|
|
||||||
|
|
||||||
# Fingerpint functions
|
# Fingerpint functions
|
||||||
|
@ -263,13 +252,9 @@ text_sensor:
|
||||||
count: 6
|
count: 6
|
||||||
|
|
||||||
- platform: template
|
- platform: template
|
||||||
name: "Log Message"
|
name: "Fingerprint Log"
|
||||||
id: fingerprint_state
|
id: fingerprint_state
|
||||||
|
|
||||||
- platform: template
|
|
||||||
name: "MQTT Message"
|
|
||||||
id: mqtt_json
|
|
||||||
|
|
||||||
- platform: template
|
- platform: template
|
||||||
name: "LED color"
|
name: "LED color"
|
||||||
id: led_color
|
id: led_color
|
||||||
|
@ -301,8 +286,8 @@ binary_sensor:
|
||||||
filters:
|
filters:
|
||||||
- invert:
|
- invert:
|
||||||
- delayed_on: 20ms
|
- delayed_on: 20ms
|
||||||
- delayed_off: 100ms
|
- delayed_off: 400ms
|
||||||
- delayed_on_off: 500ms
|
- delayed_on_off: 100ms
|
||||||
|
|
||||||
# Door Sensor - GPIO connected to GND over reed sensor
|
# Door Sensor - GPIO connected to GND over reed sensor
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
|
|
Loading…
Reference in New Issue