[SOLVED] Looking for help with MQTT and ESP8266 communication


(john) #1

Finally got openHAB 2.3.0 up and running on a RPi 2 b+. I used all the settings from MK-SmartHouse site as I know nothing about this stuff. I have read a lot but understand little. I have setup MQTT per the instructions on the above site. I used MQTTfx to verify that MQTT was communicating with my server. I have also loaded the sketch, provided from the above site, into a Wemos d1 mini to control a pushbutton setup to simulate a door switch. If I press the button the blue LED on the Wemos board comes on and I assume it is sending the information that the door is OPEN or CLOSED.

I have checked the log file to see if there were any errors generated while the program was loading. None that I saw. From the instructions from the above site, you are supposed to be able to see the door status change via the MQTTfx program. I see nothing. I have triple checked all of the files that needed to be created and they are correct, per the site.

You may be saying …Go to the above site forum and ask questions. I have posted there but no answers there for several days.

This kind of networking stuff is new to me. I have learned enough to set up my home network but getting into Linux is a new learning experience. If anyone is patient enough to help work through this I would greatly appreciate it. I think once I get one sensor setup and working, I hopefully will be able to expand my system. If there is any more information or file listings needed, let me know and I will post them.

Thank you in advance if you can provide help.
John Frankforther


(Angelos) #2

Which guide did you use? (link to it plz)

post also your OH2 related configs (mqtt, items, sitemap)

Ps: When posting configs, use: How to use code fences


(john) #3

Here are the websites that explain how to set up the files for openHAB from the MK-SmartHouse. They show the commands to enter into each file. Also, I’ll include the sketch for the Wemos board. The passwords and web address fields in the sketch have been removed.

https://www.mksmarthouse.com/setupinstallationwindows
https://www.mksmarthouse.com/config-files-and-interface
https://www.mksmarthouse.com/door-sensor-software-windows

/*
 * Device Title: MK-DoorSensor
 * Device Description: MQTT Door Sensor
 * Device Explanation: When the magnetic switch sensor is broken then 
 *                     the device sends an mqtt message to the defined server.
 * Device information: https://www.MK-SmartHouse.com/door-sensor
 *                     
 * Author: Matt Kaczynski
 * Website: http://www.MK-SmartHouse.com
 * 
 * Code may only be distrbuted through http://www.MK-SmartHouse.com any other methods
 * of obtaining or distributing are prohibited
 * Copyright (c) 2016-2017 
 * 
 * Note: After flashing the code once you can remotely access your device by going to http://HOSTNAMEOFDEVICE.local/firmware 
 * obviously replace HOSTNAMEOFDEVICE with whatever you defined below. The user name and password are also defined below.
 */

#include <ESP8266WiFi.h>
#include <MQTTClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <ESP8266HTTPUpdateServer.h>

/* ---------- DO NOT EDIT ANYTHING ABOVE THIS LINE ---------- */

//Only edit the settings in this section

/* WIFI Settings */
// Name of wifi network
const char* ssid = "ssid";

// Password to wifi network
const char* password = "password"; 

/* Web Updater Settings */
// Host Name of Device
const char* host = "MK-DoorSensor1";

// Path to access firmware update page (Not Neccessary to change)
const char* update_path = "/firmware";

// Username to access the web update page
const char* update_username = "admin";

// Password to access the web update page
const char* update_password = "Admin";

/* MQTT Settings */
// Topic which listens for commands
char* outTopic = "MK-SmartHouse/security/MKDoorSensor1"; 

//MQTT Server IP Address
const char* server = "IP address";

//Unique device ID 
const char* mqttDeviceID = "MK-SmartHouseDevice1"; 


/* ---------- DO NOT EDIT ANYTHING BELOW THIS LINE ---------- */

//the time when the sensor outputs a low impulse
long unsigned int lowIn;         

//the number of milliseconds the sensor has to be low 
//before we assume all detection has stopped
long unsigned int pause = 100;  

//sensor variables
boolean lockLow = true;
boolean takeLowTime;  

//the digital pin connected to the door sensor's output
int sensorPin = 4;  

//webserver 
ESP8266WebServer httpServer(80);
ESP8266HTTPUpdateServer httpUpdater;

//MQTT 
WiFiClient net;
MQTTClient client;

//Time Variable
unsigned long lastMillis = 0;

//Connect to WiFI and MQTT
void connect();

//Setup pins, wifi, webserver and MQTT
void setup() 
{
  pinMode(sensorPin, INPUT);
  digitalWrite(sensorPin, LOW);
  
  WiFi.mode(WIFI_STA);
  
  WiFi.begin(ssid, password);
  client.begin(server, net);

  connect();

  MDNS.begin(host);

  httpUpdater.setup(&httpServer, update_path, update_username, update_password);
  httpServer.begin();

  MDNS.addService("http", "tcp", 80);
}

//Connect to wifi and MQTT
void connect() 
{
  while (WiFi.status() != WL_CONNECTED) 
  {
    delay(1000);
  }

  while (!client.connect(mqttDeviceID)) 
  {
    delay(1000);
  }
}

void loop() 
{
  // MQTT Loop
  client.loop();
  delay(10);

  // Make sure device is connected
  if(!client.connected()) 
  {
    connect();
  }

  httpServer.handleClient();

  //Sensor Detection
  
  if(digitalRead(sensorPin) == HIGH)
  {
    if(lockLow)
    {  
      //makes sure we wait for a transition to LOW before any further output is made:
      lockLow = false;            
      client.publish(outTopic, "OPEN");  
      delay(50);
    }         
    takeLowTime = true;
  }

  if(digitalRead(sensorPin) == LOW)
  {       
    if(takeLowTime)
    {
      lowIn = millis();          //save the time of the transition from high to LOW
      takeLowTime = false;       //make sure this is only done at the start of a LOW phase
    }
    //if the sensor is low for more than the given pause, 
    //we assume that no more detection is going to happen
    if(!lockLow && millis() - lowIn > pause)
    {  
      //makes sure this block of code is only executed again after 
      //a new detection sequence has been detected
      lockLow = true;                        
      client.publish(outTopic, "CLOSED");
      delay(50);
    }
  }

}

void messageReceived(String topic, String payload, char * bytes, unsigned int length) 
{
  //This sensor does not recieve anything from MQTT Server so this is blank
}

(Ben Helps) #4

I can’t see any MQTT credentials in the sketch, and I know openHAB doesn’t play well with MQTT that has no authentication set up - does your MQTT broker require authentication?


(CM6.5 H102) #5

Need to make sure credentials match whats in the script and mqtt.cfg that’s located in /etc/openhab2/services.

FYI:
Nothing wrong with using scripts but have you considered flashing your Esp with tasmota or Esp Easy firmware? Both proved an easy way to use your device with just about anything and work great with OH.


(john) #6

Thanks you for replying benhelps and H102! As I mentioned in the original post, I am running OH on what was listed on the MK-SmartHouse site. From what I have been reading, MQTT is best used in hand shaking with the ESP8266 controllers. I have programmed them before but not using MQTT. If I didn’t have the above site to work from, I probably wouldn’t have started this project. Now that I’ve been working on it for several days and got part of it working, I really want to make the whole system work.

THEN yesterday when I went in to try other things, I forgot I changed the password at some point and couldn’t login using putty. I tried many things to no avail. So last night I just reloaded OH and will have to start from scratch again today. If nothing more, at least I’m learning some basic Linux commands.

If there is a better way to use MQTT or there is a correct way to setup what I have and you have instructions how to set it up so that it will work with what I have, I’ll give it a shot.

Thanks again for any help !

John Frankforther


(CM6.5 H102) #7

Mqtt can be a pain when first starting out, but after the initial hump I think you’ll enjoy it. Yes, there is a correct way and that depends on how the message is sent. Your item file in OH will need to have the correct syntax to communicate.

Looking at the site posted above your item file, in /etc/openhab2/items has this in home.items correct?

 Contact MKDoorSensor1 "Side Door [%s]" <door> { mqtt="<[broker:MK-SmartHouse/security/MK-DoorSensor1:state:default]" } 

The Item is a Contact and named MKDoorSensor1 “Side Door [%s]” is a label defined as a string and the is an icon. All of this is OH related, so to speak.

The next section is where the device and OH must match. The < indicates a message (state) from the device to OH. The first part in the bracket, broker must be the same in two places mqtt.cfg and home.items. The next section is the Topic and must be identical in both the home.items file and inside the device. The last two section is the state and default, kinda self explanatory for this example.

If all the above match and still no communication then the problem will most likely be in the mqtt.cfg file. If you could post any error msg from the log file we can help to identify what needs adjusting.

Also, make sure you have mqtt binding installed via PaperUI > addons > bindings and not the mqtt action binding listed under addons > actions. I assume during initial setup that you have the mosquitto broker installed. If not, use the openhabian tools from the command line type sudo openhabian-config and select Optional Components then Mosquitto.

Edit: After reading through all the post you listed, the setup should be good if all steps were followed. One thing I did notice with the script above is the MQTT Server IP address, this address should include the port as well. e.g. “10.0.1.10:1883”;

Unless changed 1883 is the OH default port for mqtt.
Here is what the mqtt.cfg looks like using the 10.0.1.10:1883 address:

Screenshot%20at%202018-10-01%2010-33-38


(john) #8

I’m still setting up everything from the total reinstall from last night. Using MQTTfx and I can still connect. I did check the mqtt.cfg file and it is set to my OH IP address as shown in your picture. After a couple corrected typos and a reboot here are listings in the log files which may be a problem.
I copied the code for the DEMOSW entries from the website so I’m assuming it is correct.

	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303) [87:org.eclipse.jetty.util:9.3.21.v20170918]

	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148) [87:org.eclipse.jetty.util:9.3.21.v20170918]

	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136) [87:org.eclipse.jetty.util:9.3.21.v20170918]

	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671) [87:org.eclipse.jetty.util:9.3.21.v20170918]

	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589) [87:org.eclipse.jetty.util:9.3.21.v20170918]

	at java.lang.Thread.run(Thread.java:748) [?:?]

2018-10-01 11:28:37.825 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'DEMOSW' for widget org.eclipse.smarthome.model.sitemap.Switch

2018-10-01 11:28:37.866 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Switch

2018-10-01 11:28:37.887 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'DEMOSW' for widget org.eclipse.smarthome.model.sitemap.Switch

2018-10-01 11:28:37.911 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'DEMOSW' for widget org.eclipse.smarthome.model.sitemap.Switch

2018-10-01 11:28:37.945 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'DEMOSW' for widget org.eclipse.smarthome.model.sitemap.Switch

2018-10-01 11:28:37.968 [WARN ] [basic.internal.render.SwitchRenderer] - Cannot determine item type of 'DEMOSW'

org.eclipse.smarthome.core.items.ItemNotFoundException: Item 'DEMOSW' could not be found in the item registry

	at org.eclipse.smarthome.core.internal.items.ItemRegistryImpl.getItem(ItemRegistryImpl.java:118) [101:org.eclipse.smarthome.core:0.10.0.oh230]

	at org.eclipse.smarthome.ui.internal.items.ItemUIRegistryImpl.getItem(ItemUIRegistryImpl.java:787) [147:org.eclipse.smarthome.ui:0.10.0.oh230]

	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136) [87:org.eclipse.jetty.util:9.3.21.v20170918]

	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671) [87:org.eclipse.jetty.util:9.3.21.v20170918]

	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589) [87:org.eclipse.jetty.util:9.3.21.v20170918]

	at java.lang.Thread.run(Thread.java:748) [?:?]

2018-10-01 11:28:38.234 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'DEMOSW' for widget org.eclipse.smarthome.model.sitemap.Switch

2018-10-01 11:28:38.292 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Switch

2018-10-01 11:28:38.315 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'DEMOSW' for widget org.eclipse.smarthome.model.sitemap.Switch

2018-10-01 11:28:38.346 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'DEMOSW' for widget org.eclipse.smarthome.model.sitemap.Switch

2018-10-01 11:28:38.368 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'DEMOSW' for widget org.eclipse.smarthome.model.sitemap.Switch

2018-10-01 11:29:05.637 [INFO ] [rest.core.internal.item.ItemResource] - Received HTTP POST request at 'items/DEMOSW' for the unknown item 'DEMOSW'.

2018-10-01 11:29:07.699 [INFO ] [rest.core.internal.item.ItemResource] - Received HTTP POST request at 'items/DEMOSW' for the unknown item 'DEMOSW'.

2018-10-01 11:29:08.945 [INFO ] [rest.core.internal.item.ItemResource] - Received HTTP POST request at 'items/DEMOSW' for the unknown item 'DEMOSW'.

2018-10-01 11:29:09.999 [INFO ] [rest.core.internal.item.ItemResource] - Received HTTP POST request at 'items/DEMOSW' for the unknown item 'DEMOSW'.

2018-10-01 11:29:11.045 [INFO ] [rest.core.internal.item.ItemResource] - Received HTTP POST request at 'items/DEMOSW' for the unknown item 'DEMOSW'.

2018-10-01 11:29:12.049 [INFO ] [rest.core.internal.item.ItemResource] - Received HTTP POST request at 'items/DEMOSW' for the unknown item 'DEMOSW'.

2018-10-01 11:29:14.509 [INFO ] [rest.core.internal.item.ItemResource] - Received HTTP POST request at 'items/DEMOSW' for the unknown item 'DEMOSW'.

2018-10-01 11:29:15.339 [INFO ] [rest.core.internal.item.ItemResource] - Received HTTP POST request at 'items/DEMOSW' for the unknown item 'DEMOSW'.

2018-10-01 11:36:34.859 [WARN ] [g.dispatch.internal.ConfigDispatcher] - Could not parse line 'Define your MQTT broker connections here for use in the MQTT Binding or MQTT# Persistence bundles. Replace <broker> with an ID you choose.'
``

(CM6.5 H102) #9

What is item DEMOSW?

Can you post your items and sitemap file?

Check your mqtt.cfg file and make sure you have everything un-commented that should be e.g. the # will comment out everything on that line, notice the pic above where the IP address is. I do not have a # there. If not sure try and post your mqtt.cfg and just omit the password.

Edit: I see where the DEMOSW item came from. For now commit DEMOSW out using // at the beginning and use only the mqtt item for testing.


(john) #10

Ok I missed removing the # when configuring today. Here is the current mqtt.cfg contents after removing the # .

#
Define your MQTT broker connections here for use in the MQTT Binding or MQTT# Persistence bundles. Replace <broker> with an ID you choose.
#

# URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883
<broker>.url=tcp://192.168.1.104:1883

# Optional. Client id (max 23 chars) to use when connecting to the broker.
# If not provided a random default is generated.
#<broker>.clientId=<clientId>

# Optional. True or false. If set to true, allows the use of clientId values
# up to 65535 characters long. Defaults to false.
# NOTE: clientId values longer than 23 characters may not be supported by all
# MQTT servers. Check the server documentation.
#<broker>.allowLongerClientIds=false

# Optional. User id to authenticate with the broker.
#<broker>.user=<user>

# Optional. Password to authenticate with the broker.
#<broker>.pwd=<password>

# Optional. Set the quality of service level for sending messages to this broker.
# Possible values are 0 (Deliver at most once),1 (Deliver at least once) or 2
# (Deliver exactly once). Defaults to 0.
#<broker>.qos=<qos>

# Optional. True or false. Defines if the broker should retain the messages sent to
# it. Defaults to false.
#<broker>.retain=<retain>

# Optional. True or false. Defines if messages are published asynchronously or
# synchronously. Defaults to true.
#<broker>.async=<async>

# Optional. Defines the last will and testament that is sent when this client goes offline
# Format: topic:message:qos:retained <br/>
#<broker>.lwt=<last will definition>

Here are the new errors from the log file

2018-10-01 11:49:08.773 [WARN ] [g.dispatch.internal.ConfigDispatcher] - Could not parse line 'Define your MQTT broker connections here for use in the MQTT Binding or MQTT# Persistence bundles. Replace &lt;broker&gt; with an ID you choose.'

2018-10-01 13:51:45.049 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection '<broker>'

2018-10-01 13:52:11.797 [ERROR] [t.mqtt.internal.MqttBrokerConnection] - MQTT connection to broker was lost

org.eclipse.paho.client.mqttv3.MqttException: Connection lost

	at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:146) [223:org.openhab.io.transport.mqtt:1.12.0]

	at java.lang.Thread.run(Thread.java:748) [?:?]

Caused by: java.io.EOFException

	at java.io.DataInputStream.readByte(DataInputStream.java:267) ~[?:?]

	at org.eclipse.paho.client.mqttv3.internal.wire.MqttInputStream.readMqttWireMessage(MqttInputStream.java:65) ~[?:?]

	at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:107) ~[?:?]

	... 1 more

2018-10-01 13:52:12.549 [ERROR] [t.mqtt.internal.MqttBrokerConnection] - MQTT connection to '<broker>' was lost: Connection lost : ReasonCode 32109 : Cause : null

2018-10-01 13:52:12.579 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting connection helper to periodically try restore connection to broker '<broker>'

2018-10-01 13:52:22.718 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection '<broker>'

2018-10-01 13:52:30.811 [INFO ] [basic.internal.servlet.WebAppServlet] - Stopped Basic UI

2018-10-01 10:44:38.558 [thome.event.ExtensionEvent] - Extension 'binding-mqtt1' has been installed.

2018-10-01 11:22:24.045 [thome.event.ExtensionEvent] - Extension 'action-mqtt' has been uninstalled.

==> /var/log/openhab2/openhab.log <==

2018-10-01 13:55:26.700 [WARN ] [g.dispatch.internal.ConfigDispatcher] - Could not parse line 'Define your MQTT broker connections here for use in the MQTT Binding or MQTT# Persistence bundles. Replace <broker> with an ID you choose.'


(CM6.5 H102) #11

EDIT:

In the mqtt.cfg the second line from the top needs to be # commented out like this.

That originally was two lines and both commented out. Compare with the pic I posted earlier.


(john) #12

Ok I missed that one while editing. I changed the colors of my putty screen as it is hard to see dark blue on a black screen. I also went through and removed all the DEMOSW items in all the files, so those are gone. It looks like everything loaded ok on boot up.

The only thing I have setup so far is one switch. If I switch it on and off in the Basic UI screen, I can see changes in the log file.

So now I’m to the point of getting the ESP8266 to communicate via MQTT to the server. I will go back in and check the wording in the wemos sketch and the mqtt code. Supposedly I should be able to use MQTTfx to see the transmitted data from the Wemos when I press the button simulating the door switch.


(CM6.5 H102) #13

The item above is a Contact and will have a state like OPEN/CLOSED. It will receive a status only.

If you want to send the wemos a command, like described ^^ you will need to change the item to a Switch not a big deal but this may require an adjustment in the sketch. I would say stick to the Contact item, see it working, then expand from there.

Here are a few mqtt item examples, notice one is a switch that can send a cmnd and the other is a number that will receive a value (state) only.

Number LivingRoom_Light_Humidity "Living Room Humidity [%.1f %%]" <humidity>
	{ mqtt="<[pibroker:tele/sonoff11/SENSOR:state:JSONPATH($.SI7021.Humidity)]" }

Switch FrontPorch_Light "Front Porch Lights" <light> (gSonoff) ["Lighting"]
	{ mqtt=">[pibroker:cmnd/sonoff-7CB10D/POWER:command:*:default],
	<[pibroker:stat/sonoff-7CB10D/POWER:state:default]" }

(john) #14

Thanks for the examples!

Is there any way to see if there any MQTT commands being sent to the OH? The light is coming on the Wemos when I press the button but I don’t know if anything is being sent/received. I’m still not sure of the naming conventions between the wemos sketch and the OH code.

I guess at this point I thought that if I press the button to simulate a door open, it should display that action on the UI screen and show OPEN or CLOSED.


(CM6.5 H102) #15

Correct, if you have everything setup correctly, including the sketch. Being new to OH, Linux, Mqtt, etc… I would look at flashing tasmota or Esp Easy firmware to the wemos, this will eliminate one possible source for errors. The setup is super friendly and you will find much more support and examples like posted above. Once you have a sensor/switch or two connected via mqtt everything will begin to click. If you choose to continue with the sketch it may be a good idea to go back over the tutorial you posted above. Now you have the Mqtt.cfg error solved, the correct binding installed, and an items file with the correct labeling it’s most likely a small syntax issue that reviewing each step will find.

Use mqttfx. and subscribe to your topic and see if an mqtt msg is being sent like:
MK-SmartHouse/security/MK-DoorSensor1/# to show all traffic or MK-SmartHouse/security/MK-DoorSensor1/state/default to see open or closed.


(john) #16

Thank you H102 for all your help. I have dropped several println statements into the wemos code and it looks like it may not be sending anything or I don’t have them in the correct places. A little more tinkering and then off to the other software you mentioned. Then again, “HE” is selling kits with all the software installed so that may be another gotcha!!

Again, Thank a lot for all the help!!

John


(CM6.5 H102) #17

“HE” is a forum member and contributor to the community. Not sure what he’s selling but I doubt there is a gotcha involved.

After getting mqtt working, you’re gonna look back and think, why did I think it was so difficult. I admit I did.:slightly_smiling_face:


(john) #18

Going through his instructions made it look step by step easy since i knew nothing about it in the first place. So when things go wrong and you are not familiar with the subject matter it’s a little daunting.

I found another site that describes how to setup the 8266 simple and easy. This code looks similar to his, just a little more straight forward with output to the serial screen to show what it is doing. Makes it easier to understand.

The last part of the code is supposed to send out a message and read it back. I’m guessing that it’s not setup on the OH end to handle the incoming / outgoing message so that’s why it isn’t displayed. Since I’m still in the dark here, that may not be true. Like you said, once I get this door switch working, the rest may be a lot easier. Most of what I need are sensors and switches. Light switches, door locks, water sensors.

Now I just have to figure out how to make it communicate with his OH side. Once I figure it out then I can change everything to get away from the MK-SmartHouse designation. I think that confuses me the most because in one place he has a dash between the name and other place he doesn’t.

I hope I haven’t been a pain!! I just really want to make this one thing work so I can move on with the knowledge I’ve learned.

John


(CM6.5 H102) #19

You have the right attitude and I’m confident you’ll be successful!

A few other things you may find interesting:

A video tutorial using Arduino to flash tasmato on a wemos https://www.youtube.com/watch?v=ioONHaUOtFM

Video guide using PlatformIO to flash tasmota to a sonoff (the same can be done to the wemos, using just your usb cable) https://www.youtube.com/watch?v=n4MDRm2yAJg If you haven’t read about PlatformIO as an alternative to Arduino IDE you may like this. Personally, I think PlatformIO is much easier to work with than Arduino but everyone has their preference. What’s important, is finding what works best for you.

Wiki page for using tasmoto https://github.com/arendst/Sonoff-Tasmota/wiki/Theo’s-Tasmota-Tips If you look on the right side of the page, you’ll see tips for Getting started, Upload tools, Usage, Devices Additional Info (notice the wemos in this section) and Home Automation Integration.

It may seem like I’m trying to push tasmoto firmware but that’s not the case. I just want you to see one, of several options available, and the firmware has all the libraries for sensors and such built in. It also supports firmware updates OTA (over the air) so no need to physically connect the device for updates. I use tasmota on most all sonoff devices and Esp Easy on all my Esp8266 chips. FYI sonoff uses the Esp8266 chip so either firmware will work as well as using a custom script.


(john) #20

Thanks for that information. I checked a couple different videos using tasmota and that looks WAY easier than coding by hand. I’ll have to try that on the ESP8266-01 boards as some locations I just need a switch or sensor. I scrapped all the MK stuff and am starting fresh. It’s better to figure it out and know how everything is set up so I can fix it if it breaks.

I’m retired so I have plenty of time to figure this out, even if it is the 6th time of reloading the software. LOL
But each time I learn something else so at some point I can make a backup of a basic working system so I don’t have to go through the set up stuff a million times. I’m trying to document everything as I go because a friend of mine wants to go the same thing.

I’ll let you know if I ever get something working, if that’s ok. Thanks again for all your help!

John