433toMQTTto433 Bidirectional Arduino Gateway

hello i have this problem;

5
try again in 5 seconds
Attempting MQTT connection…
failed, rc=
5
try again in 5 seconds

// Update these with values suitable for your network.
#define wifi_ssid “Casa”
#define wifi_password “96xxxxx”
#define mqtt_server “192.168.1.89”
#define mqtt_user “xxx” // not compulsory if you set it uncomment line 127 and comment line 129
#define mqtt_password “xxx” // not compulsory if you set it uncomment line 127 and comment line 129

i change all values …how can see if my mqtt broker is running?

Use the one inegrated with home-assistant to begin. Its simpler like that. Dont forget to set your mqtt username and password.
You can also download an mqtt client and try to connect to your mqtt broker.

i test my broker with the mqtt.fx for windows, and connect well. works
but on arduino the problem continue…

Attempting MQTT connection…
failed, rc=
5
try again in 5 seconds

SOLVED

edit:

// If you want to use a username and password, uncomment next line and comment the line if (client.connect(“433toMQTTto433”)) {
if (client.connect(“433toMQTTto433”, mqtt_user, mqtt_password)) {
// and set username and password at the program beginning
// if (client.connect(“433toMQTTto433”)) {

Hi
Thanks for this project and all the time in making this available for us.
I have few switches and some sensor that i am hooping to integrate in Home Assistant.
one is this one http://www.ebay.com.au/itm/Wireless-PIR-Infrared-IR-Motion-Auto-Sensor-Detector-Home-Security-Alarm-System-/401156569289?var=&hash=item5d66cb78c9:m:mA4IfQWJy4u95MF7EtGfXng

The problem i found is that it has only one play load one code there is no code sent for off just for on so i have no idea how to make it work in HA.
I had a look around in mqtt example but nothing worked if anyone can help or point me in the right direction will be grate.
Thanks

Here’s my doorbell if you want to ring it if your in Seymour IN.

This is just one of my switches:

  - platform: mqtt
    name: "Doorbell" 
    state_topic: "home/433toMQTT"
    command_topic: "home/MQTTto433/"
    payload_on: "5316092"
    payload_off: ""
    optimistic: true
    retain: false

Like your PIR, the doorbell doesn’t have an off. The retain: false lets this slide back into the off position after it is activated.

To do anything with this you will have to check out some automation… make a script for it to turn on a light when it gets turned on…

Enjoy, Scott

2 Likes

For some reason does not work for me i tried your configuration in binary sensors where it begin not triggered and when the code was sent it changed to on and remained on. In normal sensors different story it will start with the code on displayed and will remain there.
I changed the value of retain but no success.
Thanks anyway.

@adifoto try this
this works for me

1 Like

Thanks for that.
Now all works fine. Should go and buy more sensors now.
Thanks again.

´see this post:

and if you buy a new sensors, inside this post, say us if works or not.

1 Like

@1technophile,
The Home Assistant sits on Raspberry PI so, is there a reason for implementing the 433toMQTTto433 on Arduino ?
I guess the 433 transmitter and receiver could be connected through Raspberry PI, am I right ?

Yes there is a reason,the separation of responsabilities between gateway and hub software. In particular if you want to keep at arduino level some basic and crucial functions like an alarm system.
Yes you could connect a 433 transmitter and receiver to the Pi, in my point of view not so easy than an arduino but can be done.

Could be done, but not everybody runs HASS on a Raspberry. I don’t for example :slight_smile:

Yeah, I understand the basic/obvious reasons - simplicity/modularity (but on other hand - more hardware is needed).
Was curious, what THE Creator (@1technophile ) had in mind :slight_smile: :sunglasses:

that’s an interesting point (I remember reading this somewhere on forum … or maybe on @1technophile’s blog) :

For instance if my pi breakdown, or if I’m running a backup (happening every week during one hour) the security functions keep going on.

1 Like

Where is this setting I am also getting same error while connecting but i cannot find the line to uncomment in OpenMQTTGateway.ino or User_config.h file. I am able to connect it via windows

if you want to set mqtt user name and password:
-uncomment line 32 of user_config.h and set your username
-set your password below

Below is my user_config.h do i have to add something else also

#define mqtt_server “192.168.0.211”
#define mqtt_user “xxx” // not compulsory only if your broker needs authentication
#define mqtt_password “xxx” // not compulsory only if your broker needs authentication
#define mqtt_port 1883
#define Gateway_Name “OpenMQTTGateway”
#define will_Topic “home/OpenMQTTGateway/LWT”
#define will_QoS 0
#define will_Retain true
#define will_Message “Offline”
#define Gateway_AnnouncementMsg “Online”

is your broker setup with authentification?

Yes i tried it from windows using mqtt.fx and i can connect to it

is your mqtt server secured by TLS?