Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

while tag is "Ver.motoer.I" ,error Tag is not string #17

Closed
nuannuande opened this issue May 11, 2018 · 6 comments
Closed

while tag is "Ver.motoer.I" ,error Tag is not string #17

nuannuande opened this issue May 11, 2018 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@nuannuande
Copy link

src/tag.js
const regex = /^[a-zA-Z_][a-zA-Z0-9_]*([a-zA-Z0-9_]|[\d+])$/i;

Current Behavior

Expected Behavior

Possible Solution (Optional)

Context

Steps to Reproduce (for bugs only)

Your Environment

  • Package version (Use npm list - e.g. 1.0.6):
  • Node Version (Use node --version - e.g. 9.8.0):
  • Operating System and version:
  • Controller Type (eg 1756-L83E/B):
  • Controller Firmware (eg 30.11):
@cmseaton42 cmseaton42 added the bug Something isn't working label May 11, 2018
@cmseaton42
Copy link
Owner

Can you provide more details surrounding the issue you are having? Code snippet, error screenshot, etc.

Thanks!

@nuannuande
Copy link
Author

Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。

C:\Users\Administrator>cd F:\PLCgate

C:\Users\Administrator>f:

F:\PLCgate>node dts.js
F:\PLCgate\node_modules\ethernet-ip\src\tag\index.js:15
if (!Tag.isValidTagname(tagname)) throw new Error("Tagname Must be of Ty
pe ");
^

Error: Tagname Must be of Type
at new Tag (F:\PLCgate\node_modules\ethernet-ip\src\tag\index.js:15:49)
at Object. (F:\PLCgate\dts.js:9:15)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3

PLC.subscribe(new Tag("VersaRoll.VRoll.I");

@patrickjmcd
Copy link
Collaborator

Can you post the entire contents of your dts.js file?

@patrickjmcd
Copy link
Collaborator

Also, please post the results of npm list and node --version. To make it more readable, you can format the results as code using backticks (the key to the left of the "1" key) like this:

```
code goes here
```

gets rendered as

code goes here

@nuannuande
Copy link
Author

nuannuande commented May 17, 2018

F:\PLCgate>node -v
v8.9.3
const { Controller, Tag ,TagGroup } = require("ethernet-ip");
const PLC = new Controller();
var postdata={data:{dName:"win7",dId:"win_7",iData:[]},gSN:"someserialnumber",accessToken:"fakedataaccesstoken"};
var postflag=0;
var idata=[];

PLC.subscribe(new Tag("VersaRoll.VRoll.I","S030")); // 
PLC.connect("178.18.10.21",0).then(() => {
    // Set Scan Rate of Subscription Group to 50 ms (defaults to 200 ms)
    PLC.scan_rate=50;//
    // Begin Scanning
    PLC.scan();
});
setInterval(()=>{
PLC.forEach(tag => {
 //if(!tag.value) tag.value=0;
 console.log(tag.value);
}); 
},100)


//setInterval(()=>{
// update_Data();
//},1000);
var http = require("http");
var querystring = require('querystring');

tag.js /RegExp cannot match tha tag name while the last only is one letter

cmseaton42 pushed a commit that referenced this issue May 18, 2018
* Fix tag regex to allow 1-character tag names

Fix for #17

* adds a test for 1-characters numeric tag names

* Increments version
@cmseaton42
Copy link
Owner

cmseaton42 commented May 24, 2018

@nuannuande, @patrickjmcd released a patch to help you with your issue, have you been able to test it?

you should be able to update to the latest version with npm update

We still have an issue when referencing a boolean via bit level specification that will be addressed at a later time (this is being tracked at #19).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants