Support for MCOHome A8-9 Multi-sensor

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.

Moderators: leecollings, remb0

Post Reply
Jofre
Posts: 12
Joined: Sunday 12 May 2019 14:09
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest
Location: Netherlands
Contact:

Support for MCOHome A8-9 Multi-sensor

Post by Jofre »

I would like to see better support for this sensor.

Code: Select all

2020-07-13 10:49:10.804 OpenZWave: Value_Added: Node: 50 (0x32), CommandClass: SENSOR BINARY, Label: Sensor, Instance: 1, Index: 0
2020-07-13 10:49:10.804 OpenZWave: Value_Added: Node: 50 (0x32), CommandClass: SENSOR MULTILEVEL, Label: Air Temperature, Instance: 1, Index: 1
2020-07-13 10:49:10.804 OpenZWave: Value_Added: Node: 50 (0x32), CommandClass: SENSOR MULTILEVEL, Label: General Purpose, Instance: 1, Index: 2
2020-07-13 10:49:10.804 OpenZWave: Value_Added: Node: 50 (0x32), CommandClass: SENSOR MULTILEVEL, Label: Illuminance, Instance: 1, Index: 3
2020-07-13 10:49:10.804 OpenZWave: Value_Added: Node: 50 (0x32), CommandClass: SENSOR MULTILEVEL, Label: Humidity, Instance: 1, Index: 5
2020-07-13 10:49:10.804 OpenZWave: Value_Added: Node: 50 (0x32), CommandClass: SENSOR MULTILEVEL, Label: Carbon Dioxide, Instance: 1, Index: 17
2020-07-13 10:49:10.805 OpenZWave: Value_Added: Node: 50 (0x32), CommandClass: SENSOR MULTILEVEL, Label: Loudness, Instance: 1, Index: 30
2020-07-13 10:49:10.805 OpenZWave: Value_Added: Node: 50 (0x32), CommandClass: SENSOR MULTILEVEL, Label: Particulate Matter 2.5, Instance: 1, Index: 35
2020-07-13 10:49:10.805 OpenZWave: Value_Added: Node: 50 (0x32), CommandClass: SENSOR MULTILEVEL, Label: Volatile Organic Compound, Instance: 1, Index: 39
2020-07-13 10:49:10.805 OpenZWave: Value_Added: Node: 50 (0x32), CommandClass: SENSOR MULTILEVEL, Label: Smoke Density, Instance: 1, Index: 55
2020-07-13 10:49:10.057 Status: OpenZWave: ManufacturerSpecificDB Ready
MCOHome A-9 devices.PNG
MCOHome A-9 devices.PNG (34.29 KiB) Viewed 2083 times
Attachments
A8-9.compressed.pdf
(247.38 KiB) Downloaded 85 times
appletreelane
Posts: 2
Joined: Saturday 05 September 2020 11:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Support for MCOHome A8-9 Multi-sensor

Post by appletreelane »

Hi Jofre,

curious what you would like to see more. From your screenshot it looks like you have all sensors accessible in Domoticz correct?
appletreelane
Posts: 2
Joined: Saturday 05 September 2020 11:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Support for MCOHome A8-9 Multi-sensor

Post by appletreelane »

I bought the mcohome a8-9 myself and now understand your request. Two sensors (movement and VOC) indeed do not work.
I already tried to do some edits to the file a8-9.xml in de mcohome folder but was not successful.

Anybody who has already succesfully integrated this device in Domoticz with Z-wave (aeotec USB running 1.6)
Any tips where to start?
AMDomoticz
Posts: 6
Joined: Tuesday 09 March 2021 16:27
Target OS: NAS (Synology & others)
Domoticz version: 2021.1
Location: NL
Contact:

Re: Support for MCOHome A8-9 Multi-sensor

Post by AMDomoticz »

In this topic a similar problem: viewtopic.php?f=24&t=35726&p=270798#p270798
One sensors (VOC) don't work/appear in the devices tab. Is there a pattern?
AMDomoticz
Posts: 6
Joined: Tuesday 09 March 2021 16:27
Target OS: NAS (Synology & others)
Domoticz version: 2021.1
Location: NL
Contact:

Re: Support for MCOHome A8-9 Multi-sensor

Post by AMDomoticz »

Asustor | Domoticz 2020.2 (b63341bc0)| Aeotec USB (running 1.6) | MCOHome A8-9

Issues:
- VOC sensor doesn't show up in Domoticz; but it is in OpenZwave Control Panel.
- VOC sensor displays its value in the CO2 device (range 0.000 - 64.000)
- PIR sensor 0 or 1 as floating value. Result error in log:
(2021-04-07 15:36:00.902 Error: OpenZWave: Value_Changed: Unhandled value type ZDTYPE_SWITCH_NORMAL (2). Node: 5 (0x05), CommandClass: SENSOR MULTILEVEL, Label: General Purpose, Instance: 1, Index: 2 (OpenZWave.cpp:3189))

Workaround:
dzVents (Version: 3.0.2)
- on change copy values CO2 sensor to Custom CO2 Sensor if value > 64.000
PHP
- every 5 minutes get VOC value from /ozwcp/poll.xml
- use json.htm?type=command&param=udevice&idx=IDX&nvalue=0&svalue= to update te value of the Custom VOC Sensor

Create dummy with 2 Custom Sensors
Spoiler: show
Name : Woonkamer-VOC
Sensor Type : Custom Sensor
Label : ppb

Name : Woonkamer-CO2
Sensor Type : Custom Sensor
Label : ppm
Create dzVents script airQualityCO2:

Code: Select all

return {
   on = {
      devices = {
         'Air Quality'   -- default name from A8-9
      }
   },

   execute = function(domoticz, device)
      if device.co2 > 64 then
            domoticz.devices(110).update( 0, device.co2 )   -- 'Woonkamer-CO2'
      end
   end
}
Create PHP script taskZwave05.php in /volume1/cron/05min/

Code: Select all

still testing
Add in crontab

Code: Select all

*/5 * * * * 	/volume0/usr/builtin/bin/php /volume1/cron/05min/taskZwave05.php
Stop and start the cron.

Shoot! I have no workaround for the PIR; anybody?

Update 11-05-2021: PIR works in 2021.1; values 0.000 / 1.000
VOC still not visible.
pshadoko
Posts: 4
Joined: Thursday 14 December 2017 9:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Support for MCOHome A8-9 Multi-sensor

Post by pshadoko »

Hi months later...
I have the same device and same problems
MCOHome A8-9
Domoticz Version: 2021.1 Build Hash: 8547c5b7e Compile Date: 2021-04-17 16:29:11 dzVents Version: 3.1.7 Python Version: 3.7.3 (default, Jan 22 2021, 20:04:44) [GCC 8.3.0]

Thanks for the solution you offer for the VOC integration.

I noticed that the sensor that is called "General Purpose" in fact reports the state of the PIR sensor. It changes to 1 when movement is detected and remains at 0 otherwise.
I had to play with the Z wave parameter configuration to get this status report.

In the parameters either we choose a reading when the value of a sensor is modified (Parameters from 1 to 9), or we choose a reading at regular intervals (parameter 10 to 18).

You can mix the options depending on the probe.
For example it seems that if I choose a regular interval for the CO2 probe I display zero values ​​when it does not fall exactly during a variation of the CO2 value. So at 99% I had a zero CO2 rate (Finally equal to 1 with the default offset)
So I chose to modify the values ​​like this:

2.CO2 Delta Level: 1 (Actual: 1)
13. CO2 Timer: 0 (Actual: 0)

For other sensors I preferred a reading at regular intervals (brightness, noise) because the noise, for example, constantly changes and it did not seem necessary to me to report all these values

All this to say that by adjusting the following parameters:

8. PIR Delta Level: Report Change
11. PIR Timer: (Real: 0)

I notice a change of state of the "general purpose" sensor from 0 to 1 when a movement is detected.

What about the switch that is created in the domoticz devices? I wonder if it is not a switch that is activated on detection of a significant level of smoke?

Here is some view from console and domoticz (is it the same for you?
Zwave devices console view
Zwave devices console view
image_274.png (29.9 KiB) Viewed 1531 times
Domoticz devices
Domoticz devices
image_273.png (13.16 KiB) Viewed 1531 times
Have you more returns to do at this time?

Thanks
pshadoko
Posts: 4
Joined: Thursday 14 December 2017 9:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Support for MCOHome A8-9 Multi-sensor

Post by pshadoko »

for the PIR sensor you can report the state of the general purpose type sensor (0/1 values corresponding to movement or not)
With a dummy type sensor and a script that updates its state according to the state of the general purpose sensor.

Code: Select all

# Script_device_pir.lua

local motion_detector = '$Motion sensor'
local motion_detector_device = 'MOUVEMENT'
local debug = 'On'

------------------------------------------------------------------------------
-- Déclaration des fonctions

commandArray = {}
	
	if (devicechanged[motion_detector]) then

		detect = tonumber(otherdevices_svalues[motion_detector])
		-- print (''..detect..'')
		
		if ( detect == 1.0 )	then
			commandArray[motion_detector_device] = 'On'
			if (debug == 'On') then print ('# MOUVEMENT : Détecteur '..motion_detector_device..' mis à On') end
		end
		
		
		if ( detect == 0.0 ) then
			commandArray[motion_detector_device] = 'Off' 
			if (debug == 'On') then print ('# MOUVEMENT : Détecteur '..motion_detector_device..' mis à Off') end
		end
		if (debug == 'On') then print ('# MOUVEMENT : Fin du script') end
	end
	
return commandArray
pshadoko
Posts: 4
Joined: Thursday 14 December 2017 9:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Support for MCOHome A8-9 Multi-sensor

Post by pshadoko »

Dear AMDomoticz I'm realy interested in your taskZwave05.php script because I never success to create the update of ozwcp.poll.XXXXXX.xml by reading the ozwcp page. I think it's the only way to get VOC value.

I dont understand why ozwcp can well read all the values and domoticz not?
AMDomoticz
Posts: 6
Joined: Tuesday 09 March 2021 16:27
Target OS: NAS (Synology & others)
Domoticz version: 2021.1
Location: NL
Contact:

Re: Support for MCOHome A8-9 Multi-sensor

Post by AMDomoticz »

Sorry for the late response. Busy preparing retirement and had a long vacation...

The php I use:

Code: Select all

<?php
# ==========================================================
# Bron: http://192.168.1.11:9980/ozwcp/poll.xml
#
  $versie = '1.06 dd 10-08-2021';
#
# Doel: Domotics V2021.1 database
# Via : json.htm?type=command&param=udevice&idx=107&nvalue=0&svalue=
# ==========================================================

header('Content-Type: application/json');
date_default_timezone_set("Europe/Amsterdam");

ini_set('max_execution_time', 90 );  // seconds
ini_set('memory_limit', '512M');

$url = 'http://192.168.1.11:9980/ozwcp/poll.xml';
$sensors = ['Schemerlampjes','Boiler','Hal','Woonkamer'];
$result = json_encode( ['error' => 'time out...'] );
$teller = 0;
$run = true;

while ($teller < 5) {

	$tel = 0;
	while ($run) {

		$resultStr = file_get_contents($url);
		// splitsen in apparaten
		preg_match_all('#<node (.*?)</node>#si', $resultStr, $matches);

		if ( count($matches[0]) == count($sensors) ) {

			// voor ieder apparaat
			foreach($matches[0] as $match){
				
				if ( strpos($match, 'Woonkamer') && strpos($match, 'Volatile Organic Compound')) {

					preg_match('#label="Volatile Organic Compound" units="Ppm" readonly="true" polled="false">(.*?)<help>Volatile Organic Compound Sensor Value</help>#si', $resultStr, $voc);
					// ppm -> ppb
					$value = $voc[1] * 1000;

					if ($value < 0) {
						exit( json_encode( ['error' => 'value < 0, waarde is ' . $value] ) );
					} else {
						$url = "http://192.168.1.11:9980/json.htm?type=command&param=udevice&idx=107&nvalue=0&svalue=" . $value;
						$result = file_get_contents($url);
						$jsonArray = json_decode($result, true);
						if ($jsonArray['status'] == 'OK') {
							exit( $result );
						}
					}

				}

			}

			$tel = 100;
		}

		$run = $tel++ < 5;

		// sleep before running the loop again
		usleep(500);
	}

	sleep(10);
	$teller++;
}
echo $result;
?>
The 4th sensor with the name 'Woonkamer' is, in my case, the MCOHome A8-9 Multi-sensor.
The file poll.xml is sometimes missing one or more devices. Then it loops and tries again.
Is the value found then it exits en writes the value to a Custom Sensor with the idx 107, name VOC, units ppb.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest