My first post here so right up front, I'll state that I have read the stickies. In fact, I read them a couple of weeks ago, followed a bunch of info in them which was awesome then came back today and read them again.
I'm not a dev but I get many of the concepts. I mostly do 'my thing' in YAML under ESPHome but lately I've got into using Arduino IDE and then VS Code with Platformio. Most of the time, I pull code from other public projects and then try and 'glue' it all together into something that works, researching why the code was written they way it was along the way so that I can learn. I'm a 'see one, do one, teach one' kind of guy.
Current project is an ESP8266 with a DS18B20 sensor which monitors freezer temp and sends a Pushover alert if it rises above -20*C. I have a couple of these in use but with hard-coded Pushbullet keys and Unit IDs. With this project, I wanted to push my boundaries a bit and use a self-generating AP on power-up with a captive portal for entry of SSID, password, Pushover user keys and Unit ID. That part works just fine.
The problem I'm struggling with is using those details in construction of the Pushover message. I did manage to get the code to compile in Arduino IDE but the pushParameters content was simply '1' rather than token, keys, message etc. VS Code has other ideas though.
// Assign Dynamic Variables
char pushoverApiKey[31];
char pushoverUsrKey[31];
char UnitID[31];
// Add Dynamic Variables Activation
ESPAsync_WMParameter custom_pushoverApiKey("api", "Pushover API Key", pushoverApiKey, 31);
ESPAsync_WMParameter custom_pushoverUsrKey("usr", "Pushover User Key", pushoverUsrKey, 31);
ESPAsync_WMParameter custom_UnitID("unitid", "Unit ID", UnitID, 31);
// Code section for Push notifications to Pushover service
int TempValue = sensors.getTempCByIndex(0);
String msgcontent = UnitID && " temp is " && TempValue && "°C";
String pushParameters = ("token=" && pushoverApiKey && "&user=" && pushoverUsrKey && "&message=" && msgcontent);
The errors that are coming from VS Code are:
no suitable constructor exists to convert from "bool" to "String"
on the last two lines. The 'squiggle' is at the first character after the the =.
Yes, I know that I have one line in () and the other without. I've tried parentheses, & instead of && and also + for connecting but I don't feel that is the cause here. This seems to be something related to using a char value (let's say UnitID is entered in the portal as "Walk-In Freezer") in the string. What I want to get to with the message content is "Walk-In Freezer temp is -18*C" for example.
Any and all help is appreciated. Please assume that I have zero knowledge.
Full file is attached.
I've researched the error and while I can usually figure out what I need to do to adapt an answer to my needs, the stuff I'm reading I can't relate to in my situation because I don't already have the foundation knowledge to understand the answer in the first place.
esp8266_WiFi_Captive_Portal_FREEZERS_Working_Copy_vs.cpp (20.3 KB)