Meross plug

Hi, this is my way to turn on/off the Meross plugs thanks to IFTTT (Webhooks).

Items:

Number Meross_1 { expire="1s" }

I used “expire” to reset the state since there’s no way to let Opnehab know if the light is on or off. (I hope Meross implements new actions and especially a consumption-based trigger on IFTTT)

Sitemaps:

Switch item=Meross_1 label="Name1" icon="meross" mappings=[0="Off", 1="On"]

Rules:

rule "Meross 1"
when
    Item Meross_1 changed
then
    switch (Meross_1.state) {
        case 0: {
		 sendHttpGetRequest("https://maker.ifttt.com/trigger/meross_1_off/with/key")
		}
        case 1: {
                 sendHttpGetRequest("https://maker.ifttt.com/trigger/meross_1_on/with/key")
		}
    }
end

I connected one socket to a floor lamp and use this rule to turn on the light at sunset:

rule "Meross 1 sunset"
when
    Channel "astro:sun:home:civilDusk#event" triggered START
then
    sendCommand(Meross_1, 1)
end

It’s not perfect, there’s a delay a few seconds but it works :slightly_smiling_face:

PS. Sorry for my bad english :frowning:

1 Like

Hello, I’m trying to replicate what you have done but I’m unable to have something work straight from IFTTT. What did you use in IFTTT to have the address? As for the trigger, is it always meross_1_on or does meross_1 refer to something in ifttt?

thank you

It’s the name you define in IFTTT for the Webhook.

You also have to add your key at the end of the URL, separated by a slash after the word “key”.

Example if your key would be “123456”: sendHttpGetRequest(“https://maker.ifttt.com/trigger/meross_1_off/with/key/123456”)

Ah! Never used webhook and last time I used IFTTT was about 3 years ago so I totally forgot how that worked. It’s working great now! I also tried another way, we can now use if openhab then meross, meaning you can monitor openhab var or switch value. PRoblem is the refresh rate is “run about in 2 hours” so not very fast.

I’ve used this to almost successfully get my Amazon Dash button to turn on my Meross device, thanks.

However, it only seems to work once! I press the button and the lights turn on. If I turn them off for whatever reason the button will not turn the lights on again unless I restart Openhab. Any ideas?

Items

Number Meross_1 { expire="1s" }

Sitemaps

Switch item=Meross_1 label="Name1" icon="meross" mappings=[0="Off", 1="On"]

Rules
1

rule "Meross_1"
when
    Item Meross_1 changed
then
    switch (Meross_1.state) {
        case 0: {
		 sendHttpGetRequest("https://maker.ifttt.com/trigger/meross_1_off/with/key/123")
		}
        case 1: {
                 sendHttpGetRequest("https://maker.ifttt.com/trigger/meross_1_on/with/key/123")
		}
    }
end

2

rule "My Dash Button pressed"
when
    Channel "amazondashbutton:dashbutton:7103f09a:press" triggered
then
    sendCommand(Meross_1, 1)
end

Thanks

Sorry, I hadn’t seen the message and I hope you have already fix it but otherwise you can try this

Items

Number Meross_1 { expire="1s,command=2" }

Expire marks item as NULL and maybe this could be the problem but I don’t have a Dash Button so I can’t try.