Dev module xiaomi v4

Hello.

There might be a refresh issue on my end. I noticed this morning that it switched to state 1. However, the outlet was turned off. Is your dehumidifier powered continuously or does it only run at certain times?

It starts via a scenario and an alarm.

Hello everyone,

New to Gladys, I just installed the Beta and set up the Xiaomi module.
My Gateway was detected directly along with my sensors (5). However, in the settings it tells me that the sensors measure temperature, humidity and battery level but I don’t find this information in the dashboard, only the temperature appears.

Also, I have a few 3 sensors out of 5 that have not yet had any values to collect. Which I find surprising because I already have another personal system under NodeRed that reads the Gateway and the values are retrieved more regularly.

Great job anyway.
Kevin

Hello @Xerses!

Did you wait a little bit? Usually, it takes a little time before the values arrive and display. If you have waited and still nothing, I would be interested in seeing your Gladys logs to check that there is no bug in the integration :slight_smile:

After 1 day of waiting, still no values :slight_smile:
And now I only have 1 sensor left with a temperature.

Regarding the logs, I don’t know how to display them. I see everywhere on the forum « pm2 logs » but it doesn’t work for me because the pm2 command doesn’t exist. I did take the Gladys V4 image under HypriotOS.

Ok there must be a small issue.

pm2 logs was for Gladys v3, now to see the logs for Gladys it’s docker logs gladys :slight_smile:

@Hamtaro you have the values on your end?

Indeed, there are strange log returns.

In the end, I have 3 sensors out of 5 that work. In the integration, I see that these 2 sensors do not have Features like the others. This probably comes from there. Yet, they are the same models.

2019-10-21T11:55:14+0200 device.newStateEvent.js:20 (DeviceManager.newStateEvent) Unable to save new state of deviceFeature xiaomi:158d00010ffd46:humidity, state = 63
2019-10-21T11:55:14+0200 device.newStateEvent.js:23 (DeviceManager.newStateEvent) { Error: DeviceFeature not found
at DeviceManager.newStateEvent (/src/server/lib/device/device.newStateEvent.js:16:13)
at EventEmitter.emit (events.js:198:13)
at Event.emit (/src/server/lib/event/index.js:8:16)
at XiaomiManager.newValueTemperatureSensor (/src/server/services/xiaomi/lib/event/xiaomi.newValueTemperatureSensor.js:111:23)
at XiaomiManager.onMessage (/src/server/services/xiaomi/lib/event/xiaomi.onMessage.js:34:12)
at Socket. (/src/server/utils/functionsWrapper.js:13:13)
at Socket.emit (events.js:198:13)
at UDP.onMessage [as onmessage] (dgram.js:628:8) message: ‹ DeviceFeature not found › }

Okay…

Well, in the end, in the integration, I just deleted all the devices including the gateway.
I then connected them one by one and now they all have the Features, so the values should come back up in a little while. I’ll keep you posted.

Here you go, after 25 minutes, all the values have appeared!

Now, if I may suggest something about the interface in the dashboard, it’s the lack of sensor information:
Here is a screenshot of my personal interface (NodeJS):

For each room, I have the battery value, the temperature with additional precision, humidity, the humidex (a value that measures room comfort) with an indication of whether comfort is increasing or decreasing, and most importantly, the date and time of the last update of these elements, which allows you to always know if your system is running.

Hope this can inspire you!

Have a great day

I had a similar feedback from @Hamtaro, there is a small issue with the registration of features, it’s noted I will fix that :slight_smile:

Thank you for your feedback on the interface!

To give you a bit of my point of view, the guiding principle of Gladys 4 is to create something quite design-oriented and to avoid a dashboard that is too « geeky » and full of data in all directions, so I try to think about each use: what is the purpose of each data, and how to present it to avoid the « messy » effect.

At the level of a « room » box, it’s nice to have the temperature and humidity in my opinion (by the way, a question that arises, you only have one sensor per room, how do we do when there are several sensors per room? There is the possibility to take an average, but some users like @Hamtaro put a temperature sensor in the fridge, which skews the averages – we have to think about all these cases --)

At the level of the battery, I don’t think the data is useful. What is useful to know is when your device is running out of battery, to have a notification that the battery is low, then to have to bother to check the battery levels manually when a machine can do it for you, permanently?

Same for the date of the last value, what is useful is to know if a sensor stops sending values (and in that case receive a notification), otherwise why clutter the interface + a mental load to check each date in your head?

This is my point of view, but there is certainly room for improvement for the current boxes, without overloading the interface: we want to keep a lightweight product :wink:

I actually didn’t have a notification system in mind. If it’s possible to have this, it would indeed remove the need to have this information (battery level and last reading) directly visible.

I will continue to test this Beta to give you feedback. I am moving in a few months and I plan to use the system at full capacity with other devices (cameras, sensors, lights, etc.) and maybe even develop my own modules if I find the time (with 2 children, it’s more complicated than before).

Keep up the good work

Super! Thanks for your great feedback anyway :slight_smile: Don’t see any negativity if I compare your proposals with the reflections we have during the design, every feedback makes us think and I try to take the best of all these feedbacks.

Great. Keep us updated on the progress of your project, and don’t hesitate to post your installation/project on the forum. For help with the services, it will be with pleasure, we are never too many!

Re,
I still have issues. One of the sensors is no longer updating and I have this in the logs:

2019-10-21T16:41:54+0200 device.newStateEvent.js:20 (DeviceManager.newStateEvent) Unable to save new state of deviceFeature xiaomi:158d00010ffd46:temperature, state = 21.5
2019-10-21T16:41:54+0200 device.newStateEvent.js:23 (DeviceManager.newStateEvent) { SequelizeTimeoutError: SQLITE_BUSY: database is locked
at Query.formatError (/src/server/node_modules/sequelize/lib/dialects/sqlite/query.js:420:16)
at afterExecute (/src/server/node_modules/sequelize/lib/dialects/sqlite/query.js:119:32)
at Statement.errBack (/src/server/node_modules/sqlite3/lib/sqlite3.js:16:21)
name: ‹ SequelizeTimeoutError ›,
parent:
{ Error: SQLITE_BUSY: database is locked
errno: 5,
code: ‹ SQLITE_BUSY ›,
sql:
‹ INSERT INTO t_device_feature_state (id,device_feature_id,value,created_at,updated_at) VALUES (‹ 4bda35aa-b103-4463-b4e3-48db162f9780 ›,‹ 215500a7-ecef-40e0-b095-082c0a1f1ead ›,21.5,‹ 2019-10-21 14:41:52.535 +00:00 ›,‹ 2019-10-21 14:41:52.535 +00:00 ›); › },
original:
{ Error: SQLITE_BUSY: database is locked
errno: 5,
code: ‹ SQLITE_BUSY ›,
sql:
‹ INSERT INTO t_device_feature_state (id,device_feature_id,value,created_at,updated_at) VALUES (‹ 4bda35aa-b103-4463-b4e3-48db162f9780 ›,‹ 215500a7-ecef-40e0-b095-082c0a1f1ead ›,21.5,‹ 2019-10-21 14:41:52.535 +00:00 ›,‹ 2019-10-21 14:41:52.535 +00:00 ›); › },
sql:
‹ INSERT INTO t_device_feature_state (id,device_feature_id,value,created_at,updated_at) VALUES (‹ 4bda35aa-b103-4463-b4e3-48db162f9780 ›,‹ 215500a7-ecef-40e0-b095-082c0a1f1ead ›,21.5,‹ 2019-10-21 14:41:52.535 +00:00 ›,‹ 2019-10-21 14:41:52.535 +00:00 ›); › }

No worries on my end.
But well, you have dev on my gear ^^

Interesting feedback, I understand what’s happening!

I created an issue, I will work on it:

https://github.com/GladysAssistant/Gladys/issues/566

Hello,

As the « Xiaomi wall plug » seems to be integrated only for reading, I wanted to modify the service to be able to control this plug from Gladys.

I therefore started modifying the file xiaomi.setValue.js to manage it:

 case 'xiaomi-plug':
  msg = {
    cmd: 'write',
    model: this.sensorModelBySensorSid.get(sid),
    sid,
    data: JSON.stringify({
      status: state,
      key,
    }),
  };
  break;

I now go to the dashboard, click the button to turn it on and get this in the server logs:

 2020-01-14T20:52:26+0100 <warn> scene.executeSingleAction.js:18 (SceneManager.executeSingleAction) There was an error executing action device.set-value
2020-01-14T20:52:26+0100 <warn> scene.executeSingleAction.js:19 (SceneManager.executeSingleAction) { Error: Function device.setValue in service xiaomi does not exist.
    at DeviceManager.setValue (C:\Users\Thibaut\Documents\GitHub\GladysDev\server\lib\device\device.setValue.js:19:11)
    at Object.device.set-value (C:\Users\Thibaut\Documents\GitHub\GladysDev\server\lib\scene\scene.actions.js:16:24)
    at executeAction (C:\Users\Thibaut\Documents\GitHub\GladysDev\server\lib\scene\scene.executeActions.js:29:33)
    at SceneManager.executeSingleAction (C:\Users\Thibaut\Documents\GitHub\GladysDev\server\lib\scene\scene.executeSingleAction.js:16:11)
    at EventEmitter.Trigger.event.on (C:\Users\Thibaut\Documents\GitHub\GladysDev\server\lib\trigger\index.js:15:65)
    at EventEmitter.emit (events.js:189:13)
    at Event.emit (C:\Users\Thibaut\Documents\GitHub\GladysDev\server\lib\event\index.js:8:16)
    at setValueFeature (C:\Users\Thibaut\Documents\GitHub\GladysDev\server\api\controllers\device.controller.js:90:18)
    at C:\Users\Thibaut\Documents\GitHub\GladysDev\server\api\middlewares\asyncMiddleware.js:4:19)
    at Layer.handle [as handle_request] (C:\Users\Thibaut\Documents\GitHub\GladysDev\server\node_modules\express\lib\router\layer.js:95:5)
    at next (C:\Users\Thibaut\Documents\GitHub\GladysDev\server\node_modules\express\lib\router\route.js:137:13)
    at AuthMiddleware.asyncMiddleware (C:\Users\Thibaut\Documents\GitHub\GladysDev\server\api\middlewares\authMiddleware.js:28:7)
  message: 'Function device.setValue in service xiaomi does not exist.' }

I check everywhere, the setValue function seems correctly written in the Xiaomi service. Moreover, I see that the case of the « xiaomi-duplex-wired-switch » has been integrated. @Hamtaro, I imagine that’s one of your devices. No issues when you want to control it via the dashboard?

If one of you has an idea, I’m taking it. Something is escaping me.

What are you editing with, VSCode? Hasn’t the file encoding changed?

Yes, I am using VSCode. UTF-8 encoding.

@link39 The Xiaomi service does not expose a « device » attribute, see xiaomi/index.js! The setValue you saw is still clearly WIP, it’s not functional! It needs to be added :slight_smile:

Hi, I’m a bit late but here’s my point of view.

If you think you’ll use the ring light or the built-in speaker in the xiaomi gateway, go for this one. It also allows you to create scenarios between your xiaomi devices.

If you want something cheaper and capable of interfacing with other zigbee hardware, Philips hue and ikea for example, rather go for a zigbee gateway coupled with the zigbee2mqtt project.

For my part, I only have the xiaomi gateway (bought as a pack when I started in home automation). I therefore haven’t explored the other option much, so I leave it to the zigbee gateway experts to correct me if I’m wrong about the possibilities it offers.