Error: V_ID MySensors: Unknown/Invalid sensor type (42)

Moderator: leecollings

Post Reply
Flopp
Posts: 279
Joined: Sunday 03 January 2016 14:55
Target OS: -
Domoticz version:
Location: Sweden
Contact:

Error: V_ID MySensors: Unknown/Invalid sensor type (42)

Post by Flopp »

RPi, version 3.5623

I got

Code: Select all

Error: MySensors: Unknown/Invalid sensor type (42)
when using V_ID

This is my sketch

Code: Select all

#include <SPI.h>
#include <MySensor.h>  
#include <Wire.h>

#define NODE_ID 44
#define TEMP_CHILD 1

MySensor gw;
float temperature;
MyMessage tempMsg(TEMP_CHILD, V_ID);

void setup() 
{
	gw.begin(NULL,NODE_ID);
	gw.sendSketchInfo("Minir", "1.0");
	gw.present(TEMP_CHILD, S_TEMP);
}

void loop() 
{
	Serial.println("start");
	temperature = 100.0;
	Serial.print("temperature:");
	Serial.print(temperature);
	Serial.println("°");
	gw.send(tempMsg.set(temperature, 1));
	gw.sleep(5000);
}
Last edited by Flopp on Saturday 08 October 2016 19:44, edited 2 times in total.
User avatar
sincze
Posts: 1300
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Error: MySensors: Unknown/Invalid sensor type (42)

Post by sincze »

I assume you are running a version of Mysensors < 2.0.0.
Why whould you need the V_ID ?

Presenting:

Code: Select all

gw.present(CHILD_ID_TEMP, S_TEMP);


should be sufficient.
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
Flopp
Posts: 279
Joined: Sunday 03 January 2016 14:55
Target OS: -
Domoticz version:
Location: Sweden
Contact:

Re: Error: MySensors: Unknown/Invalid sensor type (42)

Post by Flopp »

sincze wrote:I assume you are running a version of Mysensors < 2.0.0.
Yes, I am using 1.5.1
sincze wrote:Why whould you need the V_ID ?
I was testing because at MySensors forum one user was telling that V_ID didn't work, the user got same Error message as I did
User avatar
sincze
Posts: 1300
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Error: MySensors: Unknown/Invalid sensor type (42)

Post by sincze »

Ok, had to dig a bit in the code library.

Code: Select all

  // Startup and initialize MySensors library. Set callback for incoming messages. 
  gw.begin();

  // Send the sketch version information to the gateway and Controller
  gw.sendSketchInfo("Temperature Sensor", "1.1");

  // Fetch the number of attached temperature sensors  
  numSensors = sensors.getDeviceCount();

  // Present all sensors to controller
  for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {   
     gw.present(i, S_TEMP);
  }
Similar to yours without V_ID
So if you use S_TEMP without V_ID it still does not work??
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
Flopp
Posts: 279
Joined: Sunday 03 January 2016 14:55
Target OS: -
Domoticz version:
Location: Sweden
Contact:

Re: Error: MySensors: Unknown/Invalid sensor type (42)

Post by Flopp »

I can use S_TEMP but I need to declare tempMsg first and then I used V_ID for testing purpose.

If I use V_TEMP instead of V_ID it works.

My question was about the V_ID, why that Variable is not working. I have changed my first post to only ask about V_ID, to make it more clear
chrille
Posts: 8
Joined: Monday 08 June 2015 15:18
Target OS: Linux
Domoticz version: Beta
Location: Horsens, Denmark
Contact:

Re: Error: MySensors: Unknown/Invalid sensor type (42)

Post by chrille »

Flopp wrote:I can use S_TEMP but I need to declare tempMsg first and then I used V_ID for testing purpose.

If I use V_TEMP instead of V_ID it works.

My question was about the V_ID, why that Variable is not working. I have changed my first post to only ask about V_ID, to make it more clear
Just to clarify - the usecase is to report the 1-wire address together with the temperature, so use V_TEMP to report the temperature and V_ID to report that 1-wire device addresss. This makes it easier do deploy a new installation and it's the only way to track which sensor have gone bad, if you loose one (unless you do a fixed matching of nodeid and address in the sketch)

- Jan
Beaglebone Black, Raspberry Pi (A and B)
Multiple ESP8266 (DIY - temperature, humidity, light, door sensors)
USR-HTW (MQTT), HA7net, 2x Kankun wifi plug (MQTT)
WH1090 weatherstation + weewx (MQTT)
Hikvision IP cameras
KD101 fire alarms
RFXTRX433e + RFlink
User avatar
sincze
Posts: 1300
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Error: MySensors: Unknown/Invalid sensor type (42)

Post by sincze »

Flopp wrote:I can use S_TEMP but I need to declare tempMsg first and then I used V_ID for testing purpose.

If I use V_TEMP instead of V_ID it works.

My question was about the V_ID, why that Variable is not working. I have changed my first post to only ask about V_ID, to make it more clear

A yes, found the thread you are talking about.
https://forum.mysensors.org/topic/4834/ ... -sensors/7
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
Flopp
Posts: 279
Joined: Sunday 03 January 2016 14:55
Target OS: -
Domoticz version:
Location: Sweden
Contact:

Re: Error: V_ID MySensors: Unknown/Invalid sensor type (42)

Post by Flopp »

anyone had same problem?
User avatar
gizmocuz
Posts: 2394
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Error: V_ID MySensors: Unknown/Invalid sensor type (42)

Post by gizmocuz »

Domoticz does not use the V_ID value
Quality outlives Quantity!
Flopp
Posts: 279
Joined: Sunday 03 January 2016 14:55
Target OS: -
Domoticz version:
Location: Sweden
Contact:

Re: Error: V_ID MySensors: Unknown/Invalid sensor type (42)

Post by Flopp »

Is seems to be implemented if I look here https://github.com/domoticz/domoticz/bl ... rsBase.cpp
User avatar
gizmocuz
Posts: 2394
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Error: V_ID MySensors: Unknown/Invalid sensor type (42)

Post by gizmocuz »

Nope thats a reverse lookup function (GetMySensorsValueTypeStr)
Trust me (made the class) it's not implemented nor used, domoticz is using the nodeid/childid as ID
Quality outlives Quantity!
Flopp
Posts: 279
Joined: Sunday 03 January 2016 14:55
Target OS: -
Domoticz version:
Location: Sweden
Contact:

Re: Error: V_ID MySensors: Unknown/Invalid sensor type (42)

Post by Flopp »

Ok, I trust you
alexsh1
Posts: 169
Joined: Wednesday 30 September 2015 11:50
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8975
Location: United Kingdom
Contact:

Re: Error: V_ID MySensors: Unknown/Invalid sensor type (42)

Post by alexsh1 »

How can I report the distance so that it is displayed in km? It need it for a lightning sensor.
Unfortunately, it comes up in cm and V_UNIT_PREFIX does not work / not implemented in Domoticz.
User avatar
gizmocuz
Posts: 2394
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Error: V_ID MySensors: Unknown/Invalid sensor type (42)

Post by gizmocuz »

Could you tell me which sensor ? (i am looking for one)
Maybe we can make it dynamic ? When it's over 100 we display it in meters, and when over 1000 in km ?
Quality outlives Quantity!
alexsh1
Posts: 169
Joined: Wednesday 30 September 2015 11:50
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8975
Location: United Kingdom
Contact:

Re: Error: V_ID MySensors: Unknown/Invalid sensor type (42)

Post by alexsh1 »

Hi,

Something is wrong with my forum settings and I was not notified about you responding. :(
This is the sensor - https://www.embeddedadventures.com/as39 ... -1016.html
It is based on AS3935

This is the thread on MySensors about it. My posted my sketch on it.
https://forum.mysensors.org/topic/880/s ... -sensor/48
There are several boards but based on the same chip.
I have the one from Embedded Adventures.

What I did now it that I changed domoticz.db/DeviceStatus sub-type from "27" to "1" and cm changed for km. Not sure if this is a permanent fix though.

I think there has to be two different types of "Distance". Parking sensors does not need km or even m, but needs cm or even mm. Lightning sensor / Visibility needs km and not m.
User avatar
gizmocuz
Posts: 2394
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Error: V_ID MySensors: Unknown/Invalid sensor type (42)

Post by gizmocuz »

I think you changed it to a visibility sensor ?

Maybe a dynamic label like i opt above will help ?

if <100 then cm
else if <1000 then meters
else km

i ordered a sensor to test with

It might mean that in the feature you might need to send 40000 for 40 km
Quality outlives Quantity!
alexsh1
Posts: 169
Joined: Wednesday 30 September 2015 11:50
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8975
Location: United Kingdom
Contact:

Re: Error: V_ID MySensors: Unknown/Invalid sensor type (42)

Post by alexsh1 »

Probably, it makes sense. I would suggest as follows:

if distance < 100 then cm
else if distance <10000 then meters
else km

this means 100 = 1m, 10000 = 100m, >10000 is > 0.1km

This is sketch. The distance can be multiplied easily:

Code: Select all

#define MY_DEBUG 
//#define MY_DEBUG_VERBOSE_SIGNING 

// Enable and select radio type attached
#define MY_RF24_CE_PIN 7
#define MY_RF24_CS_PIN 8
#define MY_RADIO_NRF24
//#define MY_RADIO_RFM69
#define MY_NODE_ID 13

//Signing soft
//#define MY_SIGNING_SOFT
//#define MY_SIGNING_SOFT_RANDOMSEED_PIN 7
//#define MY_SIGNING_ATSHA204
//#define MY_SIGNING_REQUEST_SIGNATURES


#include <Wire.h>
#include <MySensors.h>
#include <AS3935.h> // AS3935 MOD-1016 by Embedded Adventures

volatile bool detected = false;


 //-----------------IMPORTANT--------------------
 //---------------CHANGE SETTINGS HERE-----------
#define IRQ_pin 2

#define AS3935_TUNE_CAPS     6 // <-- SET THIS VALUE TO THE NUMBER LISTED ON YOUR BOARD 
#define AS3935_INDOORS       1 // AS3935_INDOORS=1 indoors, AS3935_INDOORS=0 outdoors
#define AS3935_NOISE_FLOOR   6
#define AS3935_ENABLE_DISTURBERS 1 // 0 or 1      

#define CHILD_ID_DISTANCE 1
#define CHILD_ID_INTENSITY 2
#define CHILD_ID_STAT 3

MyMessage msgDist(CHILD_ID_DISTANCE, V_DISTANCE);
MyMessage Prefix(CHILD_ID_DISTANCE, V_UNIT_PREFIX);
MyMessage msgInt(CHILD_ID_INTENSITY, V_VAR5);
MyMessage msgStat(CHILD_ID_STAT, V_TEXT);
void setup()  
{ 
  Serial.begin(115200);
  while (!Serial) {}
  Serial.println("MOD-1016 (AS3935) Lightning Sensor");
  Serial.println("beginning boot procedure....");
  
  Wire.begin();
  mod1016.init(IRQ_pin);
 
 //-----------------IMPORTANT--------------------
 //---------------CHANGE SETTINGS HERE-----------
  //Tune Caps, Set AFE, Set Noise Floor
  //autoTuneCaps(IRQ_pin);
  mod1016.setTuneCaps(AS3935_TUNE_CAPS);
delay(2);
#if AS3935_INDOORS == 1
  mod1016.setIndoors();
  #else
  mod1016.setOutdoors();
#endif
delay(2);
mod1016.setNoiseFloor(AS3935_NOISE_FLOOR);
delay(2);
#if AS3935_ENABLE_DISTURBERS == 1
  mod1016.enableDisturbers();
#else
  mod1016.disableDisturbers();
#endif
//mod1016.calibrateRCO();
delay(2);
  Serial.println("TUNE\tIN/OUT\tNOISEFLOOR");
  Serial.print(mod1016.getTuneCaps(), HEX);
  Serial.print("\t");
  Serial.print(mod1016.getAFE(), BIN);
  Serial.print("\t");
  Serial.println(mod1016.getNoiseFloor(), HEX);
  //Serial.print("\n");

  pinMode(IRQ_pin, INPUT);
  attachInterrupt(digitalPinToInterrupt(IRQ_pin), alert, RISING);
  Serial.println("after interrupt");
    // delay execution to allow chip to stabilize.
  delay(1000);

}

void presentation()  {
  // Send the sketch version information to the gateway and Controller
  sendSketchInfo("Lightning Sensor MOD-1016", "1.0");

  // Register all sensors to gw (they will be created as child devices)
  present(CHILD_ID_DISTANCE, S_DISTANCE);
  send(Prefix.set("km"));
  present(CHILD_ID_INTENSITY, S_CUSTOM);
  present(CHILD_ID_STAT, S_INFO);
}

void loop() {
  if (detected) {
    translateIRQ(mod1016.getIRQ());
    detected = false;
  }
}

void alert() {
  detected = true;
}

void translateIRQ(uns8 irq) {
  switch(irq) {
      case 1:
        Serial.println("Noise detected");
        break;
      case 4:
        Serial.println("Disturber detected");
        //send(msgStat.setSensor(CHILD_ID_STAT).set("Disturber detected"));
        break;
      case 8: 
        Serial.println("Lightning detected!");
        printandsendToGW();
        break;

  }
}

void printandsendToGW() {
  int distance = mod1016.calculateDistance();
  unsigned int lightning_intensity = mod1016.getIntensity();
  if (distance == -1)
    Serial.println("Lightning out of range");
  else if (distance == 1)
    Serial.println("Distance not in table");
  else if (distance == 0)
    Serial.println("Lightning overhead") & send(msgStat.setSensor(CHILD_ID_STAT).set("Lightning overhead!"));
  else {
    Serial.print("Lightning ~");
    Serial.print(distance);
    Serial.println("km away\n");
    Serial.print("Lightning Intensity: ");
    Serial.println(lightning_intensity);  
    send(msgStat.setSensor(CHILD_ID_STAT).set("Lightning in a distance"));
    send(msgDist.set(distance));
    send(msgInt.set(lightning_intensity));
  }
}
alexsh1
Posts: 169
Joined: Wednesday 30 September 2015 11:50
Target OS: Raspberry Pi / ODroid
Domoticz version: v3.8975
Location: United Kingdom
Contact:

Re: Error: V_ID MySensors: Unknown/Invalid sensor type (42)

Post by alexsh1 »

@GizMoCuz

Any news on this? Dynamic sensor would work or something like this send(Prefix.set("km")); (currently does not work in Domoticz)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest