I’ve chosen not to ship internationally because workbox dimensions and electrical safety standards are different from place to place and I don’t really have the means to adapt this project for all countries. If you’d like to try it out, check out AllPCB who can manufacture and ship this globally for cheap. That’s an affiliate link which offers me credit for future designs which I appreciate.
Great project. Thanks luma and all you guys that share ideas and knowledge. So I could not resist to try it. I bought today a Nextion 2.4. Took a NodeMCU that a had around and as I don’t know if I could flash the precompiled bin (for Wemos D1 Mini), I tryed to compile by myself, but I got many errors. It should be something that I did wrong, probably related to libraries, but I already had Wifimanager and ArduinoJson (just updated). And just included MQTT library (https://github.com/256dpi/arduino-mqtt).
Below are the errors that I’m getting in Arduino 1.8.5.
C:\Users\Roni\Documents\Arduino\HASWITCHPLATE\HASwitchPlate.ino: In function 'void mqttStatusUpdate()':
HASwitchPlate:445: error: 'DynamicJsonBuffer' was not declared in this scope
DynamicJsonBuffer updateBuffer(200);
^
C:\Users\Roni\Documents\Arduino\HASWITCHPLATE\HASwitchPlate.ino:445:3: note: suggested alternative:
In file included from C:\Users\Roni\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/DynamicJsonDocument.hpp:10:0,
from C:\Users\Roni\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.hpp:9,
from C:\Users\Roni\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.h:9,
from C:\Users\Roni\Documents\Arduino\HASWITCHPLATE\HASwitchPlate.ino:60:
C:\Users\Roni\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Memory/DynamicJsonBuffer.hpp:159:5: note: 'ArduinoJson::Internals::DynamicJsonBuffer'
DynamicJsonBuffer;
^
HASwitchPlate:445: error: expected ';' before 'updateBuffer'
DynamicJsonBuffer updateBuffer(200);
^
HASwitchPlate:446: error: 'updateBuffer' was not declared in this scope
JsonObject &statusUpdate = updateBuffer.createObject();
^
HASwitchPlate:456: error: 'class ArduinoJson::JsonObject' has no member named 'printTo'
statusUpdate.printTo(mqttStatusPayload);
^
C:\Users\Roni\Documents\Arduino\HASWITCHPLATE\HASwitchPlate.ino: In function 'void readSavedConfig()':
HASwitchPlate:1038: error: 'DynamicJsonBuffer' was not declared in this scope
DynamicJsonBuffer configJsonBuffer(256);
^
C:\Users\Roni\Documents\Arduino\HASWITCHPLATE\HASwitchPlate.ino:1038:9: note: suggested alternative:
In file included from C:\Users\Roni\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/DynamicJsonDocument.hpp:10:0,
from C:\Users\Roni\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.hpp:9,
from C:\Users\Roni\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.h:9,
from C:\Users\Roni\Documents\Arduino\HASWITCHPLATE\HASwitchPlate.ino:60:
C:\Users\Roni\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Memory/DynamicJsonBuffer.hpp:159:5: note: 'ArduinoJson::Internals::DynamicJsonBuffer'
DynamicJsonBuffer;
^
HASwitchPlate:1038: error: expected ';' before 'configJsonBuffer'
DynamicJsonBuffer configJsonBuffer(256);
^
HASwitchPlate:1039: error: 'configJsonBuffer' was not declared in this scope
JsonObject &configJson = configJsonBuffer.parseObject(buf.get());
^
HASwitchPlate:1040: error: 'class ArduinoJson::JsonObject' has no member named 'success'
if (configJson.success())
^
HASwitchPlate:1042: error: 'class ArduinoJson::Internals::JsonObjectSubscript<const char*>' has no member named 'success'
if (configJson["mqttServer"].success())
^
HASwitchPlate:1046: error: 'class ArduinoJson::Internals::JsonObjectSubscript<const char*>' has no member named 'success'
if (configJson["mqttPort"].success())
^
HASwitchPlate:1050: error: 'class ArduinoJson::Internals::JsonObjectSubscript<const char*>' has no member named 'success'
if (configJson["mqttUser"].success())
^
HASwitchPlate:1054: error: 'class ArduinoJson::Internals::JsonObjectSubscript<const char*>' has no member named 'success'
if (configJson["mqttPassword"].success())
^
HASwitchPlate:1058: error: 'class ArduinoJson::Internals::JsonObjectSubscript<const char*>' has no member named 'success'
if (configJson["haspNode"].success())
^
HASwitchPlate:1062: error: 'class ArduinoJson::Internals::JsonObjectSubscript<const char*>' has no member named 'success'
if (configJson["configUser"].success())
^
HASwitchPlate:1066: error: 'class ArduinoJson::Internals::JsonObjectSubscript<const char*>' has no member named 'success'
if (configJson["configPassword"].success())
^
HASwitchPlate:1071: error: 'class ArduinoJson::JsonObject' has no member named 'printTo'
configJson.printTo(configJsonStr);
^
C:\Users\Roni\Documents\Arduino\HASWITCHPLATE\HASwitchPlate.ino: In function 'void saveUpdatedConfig()':
HASwitchPlate:1098: error: 'DynamicJsonBuffer' was not declared in this scope
DynamicJsonBuffer jsonBuffer(256);
^
C:\Users\Roni\Documents\Arduino\HASWITCHPLATE\HASwitchPlate.ino:1098:3: note: suggested alternative:
In file included from C:\Users\Roni\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/DynamicJsonDocument.hpp:10:0,
from C:\Users\Roni\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.hpp:9,
from C:\Users\Roni\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.h:9,
from C:\Users\Roni\Documents\Arduino\HASWITCHPLATE\HASwitchPlate.ino:60:
C:\Users\Roni\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Memory/DynamicJsonBuffer.hpp:159:5: note: 'ArduinoJson::Internals::DynamicJsonBuffer'
DynamicJsonBuffer;
^
HASwitchPlate:1098: error: expected ';' before 'jsonBuffer'
DynamicJsonBuffer jsonBuffer(256);
^
HASwitchPlate:1099: error: 'jsonBuffer' was not declared in this scope
JsonObject &json = jsonBuffer.createObject();
^
HASwitchPlate:1115: error: 'class ArduinoJson::JsonObject' has no member named 'printTo'
json.printTo(configFile);
^
C:\Users\Roni\Documents\Arduino\HASWITCHPLATE\HASwitchPlate.ino: In function 'void clearSavedConfig()':
HASwitchPlate:1133: error: 'class EEPROMClass' has no member named 'length'
for (uint16_t i = 0; i < EEPROM.length(); i++)
^
C:\Users\Roni\Documents\Arduino\HASWITCHPLATE\HASwitchPlate.ino: In function 'bool updateCheck()':
HASwitchPlate:1750: error: 'DynamicJsonBuffer' was not declared in this scope
DynamicJsonBuffer updateJsonBuffer(sizeof(updatePayload));
^
C:\Users\Roni\Documents\Arduino\HASWITCHPLATE\HASwitchPlate.ino:1750:3: note: suggested alternative:
In file included from C:\Users\Roni\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/DynamicJsonDocument.hpp:10:0,
from C:\Users\Roni\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.hpp:9,
from C:\Users\Roni\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.h:9,
from C:\Users\Roni\Documents\Arduino\HASWITCHPLATE\HASwitchPlate.ino:60:
C:\Users\Roni\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Memory/DynamicJsonBuffer.hpp:159:5: note: 'ArduinoJson::Internals::DynamicJsonBuffer'
DynamicJsonBuffer;
^
HASwitchPlate:1750: error: expected ';' before 'updateJsonBuffer'
DynamicJsonBuffer updateJsonBuffer(sizeof(updatePayload));
^
HASwitchPlate:1753: error: 'updateJsonBuffer' was not declared in this scope
JsonObject &updateJson = updateJsonBuffer.parseObject(updatePayload);
^
HASwitchPlate:1754: error: 'class ArduinoJson::JsonObject' has no member named 'success'
if (!updateJson.success())
^
HASwitchPlate:1761: error: 'ArduinoJson::Internals::enable_if<true, ArduinoJson::Internals::JsonObjectSubscript<const char*> >::type' has no member named 'success'
if (updateJson["d1_mini"]["version"].success())
^
HASwitchPlate:1771: error: 'ArduinoJson::Internals::enable_if<true, ArduinoJson::Internals::JsonObjectSubscript<const char*> >::type' has no member named 'success'
if (nextionModel && updateJson[nextionModel]["version"].success())
^
exit status 1
'DynamicJsonBuffer' was not declared in this scope
I plan to simulate the LCD using a arduino or another ModeMCU using Nextion Simulator, while the Nextion is traveling. If I understood well the pins using a NodeMCU won’t be changed (D4 to Rx and D7 to Tx). The second NodeMCU or UNO should be blank? I believe Nextion Simulator will have access to serial anyway. Sorry if some questions are pretty basic.
Other than that:
In the Nextion Simulator select “User MCU Input”
select your UARTs COM port
set the Baud to 115200
then click Start
Thank you for your help.
Have you installed ArduinoJson? I think that’s your problem here.
In regards to NodeMCU, while it has more pins it offers zero more actually usable pins than a WeMos (sounds crazy, but I assure you it’s true). As a result, all of the same rules apply and the pinouts will be the same. D1 on WeMos is D1 on NodeMCU so it should be a simple job, just wire everything using the same pin labels and it should work as documented.
Yes, in fact I had it already installed.
It’s a beta, don’t believe that it would be because of this.
Then, probably it doesn’t worth to pull out my hair. I will flash the pre compiled firmware.
Thank you for your fast response!
Flashed and already connected in the network.
FWIW it appears that the beta release of ArduinoJSON has API-breaking changes. Revert to the previous not-beta release and things should compile (but really, the compiled version is fine so just keep doing that).
I installed the beta for a reason that I can’t remeber anymore, months ago…
Then it should be this. At the moment I have it already running. Just preparing another nodemcu to give it a try…
Thanks!
It’s an extensive edit in HA configuration. I may be missing something.
I believe that I got serial communication for the Simulator, but it still not running as it should. I say this because some Automations (FirstTimeSetup and Plate01 Backlight) make MCU Return (in Simulator) change.
In the screen I see (after HASP Initializing):
Wifi Connected:
192.168.1.131
MQTT Connected:
192.168.1.20
So I think communication is present, but there is something that I’m missing. Do you have a tip, based in this behavior?
If you run the deployhasp.sh script you should have all the configuration changes created and your automations available. You’ll then want to trigger the “FirstTimeSetup” automation to configure the various Hass input variables. It sounds like you’ve done these two things but I’m mostly just confirming
At that point you can use the Active Page slider to change between pages and you should see the page switch buttons on the display (or simulator). Try dragging it to Page 1.
Sorry but I missed deployhasp.sh.
The problem now is that it can’t locate configuration.yaml. Weird, since I’m running it from the configuration folder so configuration.yaml is in the same folder.
Hi,
had the same problem yesterday i have all the automations hidden, in my case all the automations that are making the screen work went off and as soon as i toggled them back to On Voila everything came back up till then i was also getting same wifi connected mqtt connected msg.
hope this helps
Are you running as a user with write permissions to configuration.yaml
? Can you paste the output of deployhasp.sh
?
Thanks for your feedback. I believe you are replying my connected wifi and mqtt message.
My problem now is that deployhasp.sh, for some reason is not detecting configuration.yaml, even being at the same configuration folder.
As you see, I’m running as pi.
pi@hassbian:~ $ ls -l /home/homeassistant/.homeassistant/configuration.yaml
-rwxrwxrwx 1 root root 7941 Aug 7 00:44 /home/homeassistant/.homeassistant/configuration.yaml
pi@hassbian:~ $ /home/homeassistant/.homeassistant/deployhasp.sh
Enter the new HASP device name and press [RETURN]: plate01
WARNING: 'configuration.yaml' not found in current directory.
Searching for Home Assistant 'configuration.yaml'...
ERROR: Failed to locate the active 'configuration.yaml'
Please run this script from the homeassistant
configuration folder for your environment.
pi@hassbian:~ $
What’s your current directory? Can you do a cd /home/homeassistant/.homeassistant
first and then do a ./deployhasp.sh
and see if it works?
Yes, it makes difference…
pi@hassbian:/home/homeassistant/.homeassistant $ ./deployhasp.sh
Enter the new HASP device name and press [RETURN]: plate01
sed: couldn't open temporary file ./sed39tMvG: Permission denied
cp: cannot create directory './packages': Permission denied
I believe .homeassistant belongs to homeassistant user.
?!
According to your earlier post it’s owned by root. You’re going to need to do this as an elevated user. If you’re running as “homeassistant”, you may want to validate that you have ownership and permissions set correctly.
Can I.run.as sudo?
sudo ./deployhasp.sh
Or it is not a good idea?
That should work.
Using sudo it run without complain.
pi@hassbian:/home/homeassistant/.homeassistant $ sudo ./deployhasp.sh
Enter the new HASP device name and press [RETURN]: plate01
pi@hassbian:/home/homeassistant/.homeassistant $
Then I’m back to:
Wifi Connected:
192.168.1.131
MQTT Connected:
192.168.1.20
Rebooted NodeMCU but no way.
I don’t know if a reboot of HA is needed after running deployhasp.sh…