How to connect multiple slave devices under the modbus-serial (rtu) connector - modbus
this is my Configuration File. I'm using the new profile https://thingsboard.io/docs/iot-gateway/config/modbus/ [new_modbus.json], in the new configuration file, seems to be able to configure several different devices in { master : { "slaves" : [] }}. And when I do, I couldn't get the right results.
{
"master":{
"slaves":[
{
"unitId":1,
"deviceName":"test1",
"attributesPollPeriod":5000,
"timeseriesPollPeriod":5000,
"sendDataOnlyOnChange":false,
"attributes":[
{
"byteOrder":"BIG",
"tag":"temperature",
"type":"bytes",
"functionCode":3,
"registerCount":1,
"address":1
}
],
"timeseries":[
{
"tag":"distance",
"type":"bytes",
"functionCode":3,
"objectsCount":1,
"address":2
}
],
"attributeUpdates":[
{
"tag":"shared_value_1",
"type":"32uint",
"functionCode":6,
"objectsCount":2,
"address":3
},
{
"tag":"shared_value_2",
"type":"32uint",
"functionCode":6,
"objectsCount":2,
"address":4
}
],
"rpc":[
{
"tag":"bearing_bpfo",
"type":"32uint",
"functionCode":6,
"objectsCount":2,
"address":5
}
],
"host":null,
"port":"/dev/ttyUSB0",
"type":"serial",
"method":"rtu",
"timeout":35,
"byteOrder":"BIG",
"wordOrder":"BIG",
"retries":null,
"retryOnEmpty":null,
"retryOnInvalid":null,
"baudrate":9600,
"pollPeriod":5000,
"connectAttemptCount":1
},
{
"unitId":2,
"deviceName":"Test2",
"attributesPollPeriod":5000,
"timeseriesPollPeriod":5000,
"sendDataOnlyOnChange":false,
"attributes":[
{
"byteOrder":"BIG",
"tag":"temperature",
"type":"bytes",
"functionCode":3,
"registerCount":1,
"address":10
}
],
"timeseries":[
{
"tag":"distance",
"type":"bytes",
"functionCode":3,
"objectsCount":1,
"address":11
}
],
"attributeUpdates":[
{
"tag":"shared_value_1",
"type":"32uint",
"functionCode":6,
"objectsCount":2,
"address":12
}
],
"host":null,
"port":"/dev/ttyUSB0",
"type":"serial",
"method":"rtu",
"timeout":35,
"byteOrder":"BIG",
"wordOrder":"BIG",
"retries":null,
"retryOnEmpty":null,
"retryOnInvalid":null,
"baudrate":9600,
"pollPeriod":5000,
"connectAttemptCount":5
}
]
},
"slave":null
}
The Connector name I am using is the Modbus Connector, and the version information for my deployment is as follows:
OS: Raspberry Pi
Thingsboard IoT Gateway version : 3.0.1
Python version : 3.9.2
Error traceback:
""2022-05-11 15:28:10" - |DEBUG| - [bytes_modbus_uplink_converter.py] - bytes_modbus_uplink_converter - convert - 87 - datatype: telemetry key: distance value: None"
""2022-05-11 15:28:10" - |DEBUG| - [bytes_modbus_uplink_converter.py] - bytes_modbus_uplink_converter - convert - 92 - {'deviceName': 'testUpdate', 'deviceType': 'default', 'telemetry': [], 'attributes': []}"
""2022-05-11 15:28:10" - |ERROR| - [bytes_modbus_uplink_converter.py] - bytes_modbus_uplink_converter - convert - 83 - Modbus Error: [Input/Output] device reports readiness to read but returned no data (device disconnected or multiple access on port?)"
NoneType: None
""2022-05-11 15:28:10" - |DEBUG| - [bytes_modbus_uplink_converter.py] - bytes_modbus_uplink_converter - convert - 87 - datatype: telemetry key: distance value: None"
""2022-05-11 15:28:10" - |DEBUG| - [bytes_modbus_uplink_converter.py] - bytes_modbus_uplink_converter - convert - 92 - {'deviceName': 'RpcTest', 'deviceType': 'default', 'telemetry': [], 'attributes': []}"
""2022-05-11 15:28:10" - |ERROR| - [bytes_modbus_uplink_converter.py] - bytes_modbus_uplink_converter - convert - 83 - Modbus Error: [Input/Output] device reports readiness to read but returned no data (device disconnected or multiple access on port?)"
NoneType: None
Related
Bi-Encoder model_name and train_from_scratch not in object/dict
When I am attempting to train the bi_enc from the bi_enc.jac file provided in the codelab I am provided the following error: 2022-11-11 11:35:46,557 - ERROR - rt_error: enc.jac:blank - line 13, col 19 - rule atom_trailer - Key model_name not found in object/dict. ERROR:core:enc.jac:blank - line 13, col 19 - rule atom_trailer - Key model_name not found in object/dict. { "success": false, "report": [], "final_node": "urn:uuid:9730edd1-de38-4546-aed4-f291709c86b0", "yielded": false, "errors": [ "enc.jac:blank - line 8, col 32 - rule atom_trailer - Key train_from_scratch not found in object/dict.", "enc.jac:blank - line 13, col 19 - rule atom_trailer - Key model_name not found in object/dict." ] } The lines of code where the error is being thrown: node bi_enc { can bi_enc.train, bi_enc.infer; can train { train_data = file.load_json(visitor.train_file); bi_enc.train( dataset=train_data, from_scratch=visitor.train_from_scratch, training_parameters={ "num_train_epochs": visitor.num_train_epochs } ); if (visitor.model_name): bi_enc.save_model(model_path=visitor.model_name); } I have not made any changes to the bi_enc.jac file nor defined any other variables named bi_enc in any of my linked files. What could be causing this issue? Thanks
How to call cloud function from Parse via GraphQL
I have the following docker-compose: version: '3.9' services: database: image: mongo:6.0.2 environment: MONGO_INITDB_ROOT_USERNAME: admin MONGO_INITDB_ROOT_PASSWORD: admin volumes: - ${HOME}/_DOCKER_DATA_/database:/data/db server: restart: always image: parseplatform/parse-server:5.3.0 ports: - 1337:1337 environment: - PARSE_SERVER_APPLICATION_ID=APP_ID - PARSE_SERVER_APPLICATION_NAME=COOK_NAME - PARSE_SERVER_MASTER_KEY=MASTER_KEY - PARSE_SERVER_DATABASE_URI=mongodb://admin:admin#mongo/parse_server?authSource=admin - PARSE_SERVER_URL=http://10.0.2.2:1337/parse - PARSE_SERVER_MOUNT_GRAPHQL=true - PARSE_SERVER_CLOUD=/parse-server/cloud/main.js links: - database:mongo volumes: - ${HOME}/_DOCKER_DATA_/server:/data/server - ../cloud:/parse-server/cloud dashboard: image: parseplatform/parse-dashboard:5.0.0 ports: - "4040:4040" depends_on: - server environment: - PARSE_DASHBOARD_APP_ID=COOK_APP - PARSE_DASHBOARD_MASTER_KEY=MASTER_KEY_1 - PARSE_DASHBOARD_USER_ID=admin - PARSE_DASHBOARD_USER_PASSWORD=admin - PARSE_DASHBOARD_ALLOW_INSECURE_HTTP=true - PARSE_DASHBOARD_SERVER_URL=http://localhost:1337/parse - PARSE_DASHBOARD_GRAPHQL_SERVER_URL=http://localhost:1337/graphql volumes: - ${HOME}/_DOCKER_DATA_/dashboard:/data/dashboard And also the fallowing .graphqlconfig in the root of my project: { "name": "Untitled GraphQL Schema", "schemaPath": "schema.graphql", "extensions": { "endpoints": { "Default GraphQL Endpoint": { "url": "http://localhost:1337/graphql", "headers": { "X-Parse-Application-Id": "APP_ID", "X-Parse-Master-Key": "MASTER_KEY" }, "introspect": true } } } } inside of my root project I have a folder called "cloud" which has inside a main.js and also a schema.graphql. Main.js: Parse.Cloud.define("checkGraphQLSupport", async req => { if (parseGraphQLServer){ return "This App has GraphQL support."; } else { return "This App does not have GraphQL support. Wrong Parse version maybe?"; } }); schema.graphql extend type Query { checkGraphQLSupport: String! #resolve(to: "checkGraphQLSupport") } I am trying to call from http://0.0.0.0:4040/apps/COOK_APP/api_console/graphql the cloud function via graphql by using the following query: query { checkGraphQLSupport } But this is not working and I get the fallowing error message: "Cannot query field "checkGraphQLSupport" on type "Query"." Can anyone explain to me what I am doing wrong? All what I am trying to do is to call the cloud code using graphql.
Try to add the env var PARSE_SERVER_GRAPH_QLSCHEMA=/parse-server/cloud/schema.graphql
!ImportValue in Serverless Framework not working
I'm attempting to export a DynamoDb StreamArn from a stack created in CloudFormation, then reference the export using !ImportValue in the serverless.yml. But I'm getting this error message: unknown tag !<!ImportValue> in "/codebuild/output/src/serverless.yml" The cloudformation and serverless.yml are defined as below. Any help appreciated. StackA.yml AWSTemplateFormatVersion: 2010-09-09 Description: Resources for the registration site Resources: ClientTable: Type: AWS::DynamoDB::Table DeletionPolicy: Retain Properties: TableName: client AttributeDefinitions: - AttributeName: id AttributeType: S KeySchema: - AttributeName: id KeyType: HASH ProvisionedThroughput: ReadCapacityUnits: 2 WriteCapacityUnits: 2 StreamSpecification: StreamViewType: NEW_AND_OLD_IMAGES Outputs: ClientTableStreamArn: Description: The ARN for My ClientTable Stream Value: !GetAtt ClientTable.StreamArn Export: Name: my-client-table-stream-arn serverless.yml service: my-service frameworkVersion: ">=1.1.0 <2.0.0" provider: name: aws runtime: nodejs6.10 iamRoleStatements: - Effect: Allow Action: - dynamodb:DescribeStream - dynamodb:GetRecords - dynamodb:GetShardIterator - dynamodb:ListStreams - dynamodb:GetItem - dynamodb:PutItem Resource: arn:aws:dynamodb:*:*:table/client functions: foo: handler: foo.main events: - stream: type: dynamodb arn: !ImportValue my-client-table-stream-arn batchSize: 1
Solved by using ${cf:stackName.outputKey}
I struggled with this as well, and what did trick for me was: functions: foo: handler: foo.main events: - stream: type: dynamodb arn: !ImportValue my-client-table-stream-arn batchSize: 1 Note, that intrinsic functions ImportValue is on a new line and indented, otherwise the whole event is ignored when cloudformation-template-update-stack.json is generated.
It appears that you're using the !ImportValue shorthand for CloudFormation YAML. My understanding is that when CloudFormation parses the YAML, and !ImportValue actually aliases Fn::ImportValue. According to the Serverless Function documentation, it appears that they should support the Fn::ImportValue form of imports. Based on the documentation for Fn::ImportValue, you should be able to reference the your export like - stream: type: dynamodb arn: {"Fn::ImportValue": "my-client-table-stream-arn"} batchSize: 1 Hope that helps solve your issue.
I couldn't find it clearly documented anywhere but what seemed to resolve the issue for me is: For the Variables which need to be exposed/exported in outputs, they must have an "Export" property with a "Name" sub-property: In serverless.ts resources: { Resources: resources["Resources"], Outputs: { // For eventbus EventBusName: { Export: { Name: "${self:service}-${self:provider.stage}-UNIQUE_EVENTBUS_NAME", }, Value: { Ref: "UNIQUE_EVENTBUS_NAME", }, }, // For something like sqs, or anything else, would be the same IDVerifyQueueARN: { Export: { Name: "${self:service}-${self:provider.stage}-UNIQUE_SQS_NAME", }, Value: { "Fn::GetAtt": ["UNIQUE_SQS_NAME", "Arn"] }, } }, } Once this is deployed you can check if the exports are present by running in the terminal (using your associated aws credentials): aws cloudformation list-exports Then there should be a Name property in a list: { "ExportingStackId": "***", "Name": "${self:service}-${self:provider.stage}-UNIQUE_EVENTBUS_NAME", <-- same as given above (but will be populated with your service and stage) "Value": "***" } And then if the above is successful, you can reference it with "Fn::ImportValue" like so, e.g.: "Resource": { "Fn::ImportValue": "${self:service}-${self:provider.stage}-UNIQUE_EVENTBUS_NAME", <-- same as given above (but will be populated with your service and stage) }
(<unknown>): did not find expected alphabetic or numeric character while scanning an anchor at line 74 column 16
(full file: http://pastebin.com/jpTn5wqH) groups: Member: options: default: true prefix: '&f[&7Nomad&f]’ permissions: - essentials.kits.Nomad - essentials.kit.Nomad - bungeechat.global - bungeecord.command.server - essentials.msg - essentials.message - towny.leave - essentials.mail - essentials.mail.send - essentials.warp.list - essentials.warp - libsdisguise.disguise.* - essentials.balancetop - essentials.balance - bukkit.command.plugins - towny.command.town.add - towny.claimed.owntown.build.* - ChestShop.shop.buy - ChestShop.shop.sell - ChestShop.shop.create - essentials.plugins - essentials.ping - essentials.rules - essentials.balance.others - MyPet.command.trade.offer - essentials.killall - bukkit.plugins - bukkit.plugin - essentials.kit.peasant - essentials.pay - ontime.player.* - towny.chat.town - towny.chat.general - towny.wild.* - towny.command.town.buy - towny.command.plot.claim - mcmmo.repair.* - essentials.ignore - essentials.money - essentials.help - essentials.build - essentials.list - essentials.help - essentials.kit - essentials.spawn - essentials.afk - essentials.r - essentials.respond - essentials.talk - essentials.home - essentials.tpdeny - essentials.tpaccept - essentials.tpask - essentials.tpa - essentials.sethome - essentials.delhome - auctions.command.start - auctions.command.info - auctions.command.queue - auctions.command.end - auctions.command.ignore - auctions.command.bid - auctions.command.cancel inheritance: - Member Builder: options: prefix: '&0[&2Builder&0]&r' inheritance: - Member permissions: - worldguard.region.bypass.world - essentials.gamemode.Adventure - essentials.gamemode.survival - essentials.gamemode.spectator - essentials.gamemode.creative - essentials.mute - essentials.gamemode.others - essentials.gamemode.* - essentials.gamemode - worldedit.* Head Builder: options: prefix: '&r[&aHead Builder&r]&r' # line 74 inheritance: - Builder - Member - King Perms For PermX Minecraft Plugin What is wrong with the file?
Your YAML file starts with: groups: Member: options: default: true prefix: '&f[&7Nomad&f]’ permissions: - essentials.kits.Nomad - essentials.kit.Nomad and around line 74 has: Builder: options: prefix: '&0[&2Builder&0]&r' inheritance: - Member permissions: - worldguard.region.bypass.world - essentials.gamemode.Adventure The line: prefix: '&f[&7Nomad&f]’ starts a string (with the ') that ends on the line 74 followed by an unexpected character. You most likely want to change the ’ at the end of that line 5, as it is probably a typo and should be '. With that change the file parses correctly.
How to skip role executing in Ansible
I try to write the playbook.yml for my vagrant machine and I'm faced with the following problem. Ansible prompt me to set these variables and I set these variables to null/false/no/[just enter], but the roles is executed no matter! How can I prevent this behavior? I just want no actions if no vars are set.. --- - name: Deploy Webserver hosts: webservers vars_prompt: run_common: "Run common tasks?" run_wordpress: "Run Wordpress tasks?" run_yii: "Run Yii tasks?" run_mariadb: "Run MariaDB tasks?" run_nginx: "Run Nginx tasks?" run_php5: "Run PHP5 tasks?" roles: - { role: common, when: run_common is defined } - { role: mariadb, when: run_mariadb is defined } - { role: wordpress, when: run_wordpress is defined } - { role: yii, when: run_yii is defined } - { role: nginx, when: run_nginx is defined } - { role: php5, when: run_php5 is defined }
I believe the variables will always be defined when you use vars_prompt, so "is defined" will always be true. What you probably want is something along these lines: - name: Deploy Webserver hosts: webservers vars_prompt: - name: run_common prompt: "Product release version" default: "Y" roles: - { role: common, when: run_common == "Y" } Edit: To answer your question, no it does not throw an error. I made a slightly different version and tested it using ansible 1.4.4: - name: Deploy Webserver hosts: localohst vars_prompt: - name: run_common prompt: "Product release version" default: "N" roles: - { role: common, when: run_common == "Y" or run_common == "y" } And roles/common/tasks/main.yml contains: - local_action: debug msg="Debug Message" If you run the above example and just hit Enter, accepting the default, then the role is skipped: Product release version [N]: PLAY [Deploy Webserver] ******************************************************* GATHERING FACTS *************************************************************** ok: [localhost] TASK: [common | debug msg="Debug Message"] ************************************ skipping: [localhost] PLAY RECAP ******************************************************************** localhost : ok=1 changed=0 unreachable=0 failed=0 But if you run this and enter Y or y when prompted then the role is executed as desired: Product release version [N]:y PLAY [Deploy Webserver] ******************************************************* GATHERING FACTS *************************************************************** ok: [localhost] TASK: [common | debug msg="Debug Message"] ************************************ ok: [localhost] => { "item": "", "msg": "Debug Message" } PLAY RECAP ******************************************************************** localhost : ok=2 changed=0 unreachable=0 failed=0