# Node-Red / Xiaomi

**URL:** <https://community.gladysassistant.com/t/node-red-xiaomi/6644>\
**Category:** Configuration\
**Created:** [October 30, 2021, 4:03pm UTC](https://community.gladysassistant.com/t/node-red-xiaomi/6644 "2021-10-30T16:03:45Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![jerome](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/jerome/32/7030_2.png) [@jerome](https://community.gladysassistant.com/u/jerome)\
**Post date:** [December 6, 2021, 10:35pm UTC](https://community.gladysassistant.com/t/node-red-xiaomi/6644/21 "2021-12-06T22:35:01Z")

</div>

The node changes I’ve already tested it by telling it that 1 is equal to on and 0 to off but it doesn’t work.

I try a lot of things and look on the web but it doesn’t work but the advantage is that I learn as I go from my mistakes, on the other hand it really annoys me but well it’s part of the game 😅

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [December 7, 2021, 12:46pm UTC](https://community.gladysassistant.com/t/node-red-xiaomi/6644/22 "2021-12-07T12:46:19Z")

</div>

Can you send us a screenshot of what you’re doing in your Change block?

You are using the «&nbsp;Set&nbsp;» block, then the property title you put the title of the property expected by your input, and the value you put the expected value?

---

<div class="post-metadata">

**Author:** ![jerome](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/jerome/32/7030_2.png) [@jerome](https://community.gladysassistant.com/u/jerome)\
**Post date:** [December 7, 2021, 10:49pm UTC](https://community.gladysassistant.com/t/node-red-xiaomi/6644/23 "2021-12-07T22:49:31Z")

</div>

![Capture d’écran 2021-12-07 à 23.48.45](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/4/4b3ba8bfc0fcfbdd4a996a0d214f6959e0c1410e.png)

Debug : Cannot set property of non-object type: payload.channel\_0

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [December 8, 2021, 8:30am UTC](https://community.gladysassistant.com/t/node-red-xiaomi/6644/24 "2021-12-08T08:30:31Z")

</div>

At this stage, your «&nbsp;payload&nbsp;» is probably a string, so when you try to assign a «&nbsp;channel\_0&nbsp;» property to a string, it doesn’t work (hence the error message)

You need to add a «&nbsp;Set&nbsp;» in this «&nbsp;change&nbsp;» box, before the set you created, where you initialize the payload to an empty object {}

I found an example on the internet:

 ![Screenshot 2021-12-08 at 09.28.52](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/f/fe09e0f36960308dfc8cb0e6a666f2b5d2ef7a88.png)

Step 1: msg.payload = {} (remember to set the correct payload type, see screenshot)  
Step 2: msg.payload.channel\_0 = on (same as you did there)

Let us know if it works 🙂

---

<div class="post-metadata">

**Author:** ![jerome](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/jerome/32/7030_2.png) [@jerome](https://community.gladysassistant.com/u/jerome)\
**Post date:** [December 12, 2021, 8:33pm UTC](https://community.gladysassistant.com/t/node-red-xiaomi/6644/25 "2021-12-12T20:33:08Z")

</div>

Yes! Yes! Yes! It works

Thanks @pierre-gilles

---

<div class="post-metadata">

**Author:** ![Psoy](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/psoy/32/9005_2.png) [@Psoy](https://community.gladysassistant.com/u/Psoy)\
**Post date:** [December 18, 2021, 8:42pm UTC](https://community.gladysassistant.com/t/node-red-xiaomi/6644/26 "2021-12-18T20:42:46Z")

</div>

Good evening Jérôme, and the community  
I wrote a tutorial on controlling the Xiaomi Gateway, where I explain what I was able to do and also what I haven’t solved. But my limited skills in Js and NodeRed have not yet allowed me to find a solution to a certain point «&nbsp;the scope of values in a scope&nbsp;». As Jérôme suggested to me, I share this tutorial.

How to publish 11 pages written on Word?  
After that, once the missing solutions are found, I will write it with the modifications. Moreover, I think there will be other issues with the memorization of values (example my temperature sensor refreshes and I cannot make a history of more than one hour on the graph, while when it was defined in the Xiaomi integration, it worked correctly).

---

<div class="post-metadata">

**Author:** ![jerome](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/jerome/32/7030_2.png) [@jerome](https://community.gladysassistant.com/u/jerome)\
**Post date:** [December 20, 2021, 3:45pm UTC](https://community.gladysassistant.com/t/node-red-xiaomi/6644/27 "2021-12-20T15:45:45Z")

</div>

Hello @Psoy

But could you share the link to your tutorial hosted on another platform so we can read it.

I agree with you about the issue of sensor values that we lose under node-red. This is really annoying.

I removed it from node-red and gladys to be able to set it up again under gladys, but no device detected.

I will start over with a clean installation as I just received my SSD.

@pierre-gilles might have an idea why the link is lost with node-red?

---

<div class="post-metadata">

**Author:** ![jerome](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/jerome/32/7030_2.png) [@jerome](https://community.gladysassistant.com/u/jerome)\
**Post date:** [December 20, 2021, 10:19pm UTC](https://community.gladysassistant.com/t/node-red-xiaomi/6644/29 "2021-12-20T22:19:31Z")

</div>

@Psoy your file doesn’t seem to be accessible. It says it has been deleted?

Regarding your 32GB SD cards, depending on the brand, they may not actually have 32GB of storage. This might be the issue. Have you checked the actual capacity on a PC?

---

<div class="post-metadata">

**Author:** ![jerome](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/jerome/32/7030_2.png) [@jerome](https://community.gladysassistant.com/u/jerome)\
**Post date:** [December 21, 2021, 12:13pm UTC](https://community.gladysassistant.com/t/node-red-xiaomi/6644/31 "2021-12-21T12:13:40Z")

</div>

Hi @Psoy

Great tutorial, the Node-RED part is very well detailed, you must have spent a lot of time on it.

If I may offer some advice: it would be helpful to add the command lines so that other users can copy and paste them for the laziest ones.

To detail the Gladys part, which is the heart of the project. Simply the part of creating an object in MYQTT because the end user does not know if they should create one or more MQTT objects or an object with multiple features.

As Pierre-Gilles told me previously, you could add a possible spell checker.

After that, if you master it, you can create a tutorial on GitHub if you master it. I had tried on my side on a tutorial for a water level sensor for a rainwater collector.

Once again, really great job 👍

---

<div class="post-metadata">

**Author:** ![Psoy](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/psoy/32/9005_2.png) [@Psoy](https://community.gladysassistant.com/u/Psoy)\
**Post date:** [December 21, 2021, 12:56pm UTC](https://community.gladysassistant.com/t/node-red-xiaomi/6644/32 "2021-12-21T12:56:39Z")

</div>

Hello Jerome,

Thank you for your feedback  
For the proofreader, I passed it, but yesterday I finished at midnight, I must have had my eyes closed 😄😄.  
What do you mean by copying commands (are you talking about the lines of code in the nodes)?  
And about the MQTT part?  
For GitHub, I tested it yesterday, but it doesn’t take the images? I wanted to copy that into the «&nbsp;Read me&nbsp;».

---

<div class="post-metadata">

**Author:** ![jerome](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/jerome/32/7030_2.png) [@jerome](https://community.gladysassistant.com/u/jerome)\
**Post date:** [December 21, 2021, 3:08pm UTC](https://community.gladysassistant.com/t/node-red-xiaomi/6644/33 "2021-12-21T15:08:09Z")

</div>

Yes, I am talking about the code lines in the nodes

to take back the MQTT part in gladys with screenshots on the creation of the object itself.  
Integration - MQTT - creation - object name, topic name…

For the images via github I confirm it’s not simple, I also struggled. Pierre-gilles helped me after that if you look at the tutorial I made it was also very long

> [@\[TUTORIEL\] Connaitre la capacité restante de sa cuve eau de pluie](https://community.gladysassistant.com/t/tutoriel-connaitre-la-capacite-restante-de-sa-cuve-eau-de-pluie/6272?u=jerome):
>
> id Title sidebar\_label Capacité Restante d’une Cuve Capacité Restante d’une Cuve Capacité Restant d’une Cuve Projet :Capacité Restante d’une Cuve Bonjour la communauté, Je vous présente mon projet qui est maintenant fonctionnel pour mesurer la quantité d’eau restante dans ma cuve. J’ai eu l’idée de ce projet car ma cuve de récupération d’eau de pluie alimente mon arrosage extérieur, ma machine à laver ainsi que mes WC et il m’était impossible de savoir hormis le fait d’aller voir de…

---

<div class="post-metadata">

**Author:** ![Psoy](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/psoy/32/9005_2.png) [@Psoy](https://community.gladysassistant.com/u/Psoy)\
**Post date:** [December 21, 2021, 4:11pm UTC](https://community.gladysassistant.com/t/node-red-xiaomi/6644/34 "2021-12-21T16:11:04Z")

</div>

Did you write this tutorial in Gladys?

---

<div class="post-metadata">

**Author:** ![jerome](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/jerome/32/7030_2.png) [@jerome](https://community.gladysassistant.com/u/jerome)\
**Post date:** [December 21, 2021, 4:30pm UTC](https://community.gladysassistant.com/t/node-red-xiaomi/6644/35 "2021-12-21T16:30:59Z")

</div>

Copy / paste into Word file as you

---

<div class="post-metadata">

**Author:** ![Psoy](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/psoy/32/9005_2.png) [@Psoy](https://community.gladysassistant.com/u/Psoy)\
**Post date:** [December 21, 2021, 5:08pm UTC](https://community.gladysassistant.com/t/node-red-xiaomi/6644/36 "2021-12-21T17:08:49Z")

</div>

You pasted your Word file in a message (as one does), but you posted it in the tutorials section, right?

---

<div class="post-metadata">

**Author:** ![Psoy](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/psoy/32/9005_2.png) [@Psoy](https://community.gladysassistant.com/u/Psoy)\
**Post date:** [December 21, 2021, 5:09pm UTC](https://community.gladysassistant.com/t/node-red-xiaomi/6644/37 "2021-12-21T17:09:45Z")

</div>

But can’t we rework it after?

---

<div class="post-metadata">

**Author:** ![jerome](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/jerome/32/7030_2.png) [@jerome](https://community.gladysassistant.com/u/jerome)\
**Post date:** [December 21, 2021, 9:55pm UTC](https://community.gladysassistant.com/t/node-red-xiaomi/6644/38 "2021-12-21T21:55:45Z")

</div>

Yes that’s exactly it.

The goal is to have a completed tutorial when you post it but you can still modify it with the little pencil below the post.

---

<div class="post-metadata">

**Author:** ![Psoy](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/psoy/32/9005_2.png) [@Psoy](https://community.gladysassistant.com/u/Psoy)\
**Post date:** [December 21, 2021, 10:34pm UTC](https://community.gladysassistant.com/t/node-red-xiaomi/6644/39 "2021-12-21T22:34:32Z")

</div>

Very well, I’m still making changes and looking for typos, then if you would, you’ll take a look before I publish it with Pierre-Gilles’ approval.

Thank you for your help.

---

<div class="post-metadata">

**Author:** ![Psoy](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/psoy/32/9005_2.png) [@Psoy](https://community.gladysassistant.com/u/Psoy)\
**Post date:** [December 23, 2021, 3:48pm UTC](https://community.gladysassistant.com/t/node-red-xiaomi/6644/40 "2021-12-23T15:48:38Z")

</div>

Hello Jerome  
I’ve updated the tutorial, if you could take a look. (Between unwrapping presents 😀)  
Happy holidays to you

---

<div class="post-metadata">

**Author:** ![jerome](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/jerome/32/7030_2.png) [@jerome](https://community.gladysassistant.com/u/jerome)\
**Post date:** [December 23, 2021, 11:06pm UTC](https://community.gladysassistant.com/t/node-red-xiaomi/6644/41 "2021-12-23T23:06:39Z")

</div>

Hello @Psoy

It’s perfect, I’ll send you a private message to refine a few things. I hope @pierre-gilles will read it if he has a bit of time to give his opinion, but great job.

I think this can also help the community understand Node-red.

After that, yes, you can publish it in the «&nbsp;tutorial&nbsp;» section.

Don’t hesitate to develop other topics via node-red if you want. (For my part, I think the arduino and rflink sections are topics expected by the community and that can be set up quite easily via node-red)

Happy holidays to you too.

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [January 2, 2022, 1:30pm UTC](https://community.gladysassistant.com/t/node-red-xiaomi/6644/42 "2022-01-02T13:30:32Z")

</div>

Hello @Psoy and happy new year to everyone!

I’m back from vacation and I’m catching up on your messages.

@Psoy Indeed, it would be really cool to post this tutorial on the forum, especially so that this content is indexed by the forum and by Google, so it will allow new users to find this content through a search!

You can go to the «&nbsp;Tutorials&nbsp;» category: [Tutoriels - Gladys Assistant community](https://community.gladysassistant.com/c/francais/tutoriels/40)

You create a new topic, and you copy and paste your text into it. You may need to do this in several messages, there may be a limit to the size of a message in Discourse (to be seen)

For the images, you can insert them one by one by dragging them into the text field 🙂

Of course, messages are editable so you can evolve your tutorial over time.

Thanks again for the time spent on its writing!

[Previous page](https://community.gladysassistant.com/t/node-red-xiaomi/6644.md?page=1)
