SamZorSec / Itead_Sonoff

Alternative firmware for Itead Sonoff switches, based on the MQTT protocol and a TLS connection
MIT License
116 stars 33 forks source link

CloudMQTT and Direct Operation #2

Open matheustms opened 7 years ago

matheustms commented 7 years ago

I don't want to use CloudMQTT and I dont know what I need to change to set my raspberry ip as local broker. When I'm setting up the wifi credentials, the space for ip broker are defined as CloudMQTT and I can't change it.

Another problem is when I reset the Sonoff, I can't do direct relay operation through on board button without setting up the wifi credentials first. Thats bad because I cant operate the sonoff if I don't have wireless in home, at least for instance.

If I'm saying shit, sorry for my ignorance on this theme.

SamZorSec commented 7 years ago

Hi, Thank you for your feedback.

// SHA1 fingerprint of the certificate // openssl x509 -fingerprint -in .crt const char* fingerprint = "A5 02 FF 13 99 9F 8B 39 8E F1 83 4F 11 23 65 0B 32 36 FC 07";

endif



I'll modify the sketch to work without an active Wi-Fi connection.

Sam
matheustms commented 7 years ago

Thank you so much, bro.

If not too much to ask, can you implement the input settings of MQTT topics too when we are setting up the network and entering the MQTT username, password, broker IP address and broker port. So we can setup everything on the web configuration portal.

Another question is when I long press the button, reset the relay or all the configurations to default?

Thanks so much again

matheustms commented 7 years ago

Find another problem (rsrs), there is no auto reconnect function. When I turn restart my router and not restart sonoff, it calls the wifi manager again, to set another wireless credentials.

SamZorSec commented 7 years ago

If not too much to ask, can you implement the input settings of MQTT topics too when we are setting up the network and entering the MQTT username, password, broker IP address and broker port. So we can setup everything on the web configuration portal.

Implemented now.

Another question is when I long press the button, reset the relay or all the configurations to default?

6-7 seconds. If the LED doesn't blink, unplug/plug the Sonoff from power.

Find another problem (rsrs), there is no auto reconnect function. When I turn restart my router and not restart sonoff, it calls the wifi manager again, to set another wireless credentials.

The module will restart now if no IP address is assigned to it. It's not easy to test if the module is connected to the internet. My Wi-Fi is always on.

void reconnect() {
  // test if the module has an IP address
  // if not, restart the module
  if (WiFi.status() != WL_CONNECTED) {
    DEBUG_PRINTLN(F("ERROR: The module isn't connected to the internet"));
    restart();
  }
  ...
matheustms commented 7 years ago

Man, you are the best. Really, the best. I will try when I get home. I don't know how to implement functions because I'm new on this. Thanks for help me. If I found another thing, I will tell you for sure. Rsrs

matheustms commented 7 years ago

Did you did this "I'll modify the sketch to work without an active Wi-Fi connection."?

SamZorSec commented 7 years ago

Did you did this "I'll modify the sketch to work without an active Wi-Fi connection."?

Not yet. It's complicated because I use the WiFiManager library and if the connection to the router isn't successful, the module restarts. I control it only with MQTT and Home Assistant and I'll probably not implement this feature.

Alternative firmwares:

matheustms commented 7 years ago

I understand. I use MQTT and Home Assistant too, but I need to implement this because if my router gets dead, for example, I can't ativate the relay and my house will stay in dark, if it's night. I use sonoff as my light switch. I will study on this, I really like your firmware. Thanks Man.

kornfool commented 7 years ago

newbies here, how to get the fingerprint ?

SamZorSec commented 7 years ago

if you have the public certificate, just use the following command :

// SHA1 fingerprint of the certificate
// openssl x509 -fingerprint -in  <certificate>.crt

https://knowledge.symantec.com/support/identity-protection-support/index?page=content&id=SO28771&actp=RSS&viewlocale=en_US or https://www.grc.com/fingerprints.htm

Sunrise17 commented 6 years ago

How to assign different Fingerprints for each sonoff (with tasmota fw) device to connect CloudMqtt? For secure connection, each device has a particular Fingerprint.