433toMQTTto433 Bidirectional Arduino Gateway

Hello,

Yes my current setup with openhab includes two sensors working with this principle. Instead of sending a fixed decimal value with rcswitch you send a constant value plus the temperature :
-constant : 100000
-measured temperature 25.2 degree
-value sent 100252

The program below use this principle :

The value is sent by the gateway to the mqtt broker, the controller handle it and convert it to a temperature. Done in openhab with a mapping. I don t think someone use it like that yet in home assistant , i will be interested on seeing how the conversion can be done.

1 Like

I can receive the information in mqtt server.

But to implement as a sensor in the HA is trick.

Its possible to send the information in json format?

What do you receive by mqtt finaly ?

I receive like this:

@masterkenobi: Did you by chance figured out if this can actually be used as an outside sensor?

no. thermometer doesn’t work with this gateway. i also want to know which thermometer is supported by this gateway. Anyone?

And you dont how to parameter this to be set as a temperature in home assistant isn t it ?

@1technophile

After uploading the sketch getting following message in serial monitor:

SmartLink

OpenMQTTGateway ip adress:

0.0.0.0


WiFi connected

Attempting MQTT connection…

connected to broker

subscription OK to the subjects defined

Is it normal that when nodemcu connect with wifi it shows “OpenMQTTGateway ip adress:
0.0.0.0”

shouldn’t it shows a IP address instead of 0.0.0.0?

I didn’t change following lines in the sketch:

#else // for arduino + W5100

const byte mac[] = { 0xDE, 0xED, 0xAB, 0xFE, 0x23, 0x21 }; //W5100 ethernet shield mac adress

#endif

The values below are optional if you want to use these parameters uncomment line 158 of OpenMQTTGateway.ino

const byte ip[] = { 192, 168, 1, 99 }; // ip adress

const byte gateway[] = { 192, 168, 1, 1 }; //ip adress

const byte dns[] = { 192, 168, 1, 1 }; //ip adress

const byte subnet[] = { 255, 255, 255, 0 }; //ip adress

should I replace mac address of my nodemcu?
My wifi router ip address is: 192.168.1.1

but when I run “sudo mosquitto_sub -t home/# -v” in putty it says “Connection Refused: not authorised.”

OK… two new questions that are related…

My wife bought some analog led lights to light a stain glass picture in a frame. It came with a 433 mhz remote!!! I couldn’t be more exited. For the power on and off I get the code 11752449. When I send the code from the gateway I get nothing. I get the same code but it doesn’t turn on the lights. Different protocol?

Ok related question… I’m still using the original code from when I built it, it’s not the newer open gateway… Would upgrading the code make it work?

Thanks @1technophile, you are awesome!

Hello,

With the last version of openmqttgateway you will be able to see the protocol used by this device and reproduce it. The data will be published by the gateway to

home/433toMQTTAdvanced

Yes upgrading the code should work, comment maybe the gateways you don’t need to avoid memory issues on your arduino Uno.

For some reason, I am unable to transmit. I’ve tried a separate 5V source, a different transmitter, a different pin (pin 4 to pin 8) on the arduino uno. I’m thinking it’s my configuration, since the mqtt topics have changed since the original gateway.

Here’s what I have:

  - platform: mqtt
    name: "Office Light"  
    state_topic: "home/433toMQTT"
    command_topic: "home/commands/MQTTto433"
    payload_on: "1389###"
    payload_off: "1389###"
    optimistic: true
    retain: true

The Serial Monitor shows all the codes I receive and it also shows this when I press the button in Home Assistant.
Hey I got a callback
MQTTtoRF default
Ack published
Hey I got a callback
Storing signal
Min index:
0
store code :
…

I have to be overlooking something…

Hello,

your HA config seems OK except you could set now optimistic to false (openmqttgateway send now the code back when the command has been sent as an acknowledgement)
Did you change your hardware/connections between the previous soft and the newer version?

Could you check on mosquitto what HA is publishing?

I did change the wiring to match your diagram. My pins were different in the original. I have vcc to 5v (shared with receiver that is working), Ground to Gnd, and data to D4.

When I press the button in Home Assistant, Mosquitto reports:

home/commands/MQTTto433 1389###
home/433toMQTT 1389###

Tomorrow, I will pull out a new transmitter. Maybe I fried the two I had out since everything else seems good.

If you want to eliminate potential configuration issues on OpenMqttGateway or home assistant you could upload into the arduino an RCSwitch example like send demo and see if you are able to control your sockets.

Great Idea! I’ll give it a shot tomorrow. - Thanks!

GOT IT!!

Transmitter was working the whole time. The RCSwitch SendDemo proved that for me. Eventually found ZgatewayRF code to have the default pulselength of 350… (TreeFitty!!) The Etekcity remotes need a pulse of 189. That was the trick.

Here’s my code for those that follow along and upgrade their Gateway to version 3.

  - platform: mqtt
    name: "Office Light"  
    state_topic: "home/433toMQTT"
    command_topic: "home/commands/PLSL_189/433_1/BITS_24"
    payload_on: "1389###"
    payload_off: "1389###"

OOH no more optimistic: true!!! So we got the slide buttons in Home Assistant and no blue color for an off device!!

I also have some small suggestions for the code which I’ll post on Github. But first I gotta rewrite my configuration.yaml for the 21 switches on the gatway. I haven’t turned off some lights in a couple days. lol
Thanks @1technophile

3 Likes

@masterkenobi i have a dht sensor, connected my gateway, and Works fine , i receive temperature and humidity.

@Partybug a question for you, did you have a pir sensor that use cell 9v right? How many days or months does it work?

I have one generic 433mhz pir powered by 9v battery since more than 9 months. I think it depends a lot where it stands nd the number of triggers per day. In my case it has to trigger around 10-20times a day

1 Like

@Rodolfo_Vieira I’d have to say over 6 months on my driveway sensor - 9 months sounds right. I have the same sensor on the wall of my office for a month now.

1 Like