Skip to content

Commit f7a2b78

Browse files
committed
Merge branch 'master' of github.com:csuermann/node-red-contrib-virtual-smart-home
2 parents d9785bf + dc14914 commit f7a2b78

File tree

6 files changed

+125
-55
lines changed

6 files changed

+125
-55
lines changed

.github/ISSUE_TEMPLATE/01-bug.yaml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Bug Report
2+
description: Create a bug report to help improve Virtual-Smart-Home
3+
assignees:
4+
- csuermann
5+
labels:
6+
- bug
7+
body:
8+
- type: markdown
9+
attributes:
10+
value: |
11+
Thanks for taking the time to fill out this bug report!
12+
- type: textarea
13+
id: description
14+
attributes:
15+
label: Bug Description
16+
description: A clear and concise description of what the bug is
17+
placeholder: Tell us what you see!
18+
validations:
19+
required: true
20+
- type: textarea
21+
id: reproduction
22+
attributes:
23+
label: To Reproduce
24+
description: Steps to reproduce the behavior
25+
placeholder: |
26+
1. Go to '...'
27+
2. Click on '....'
28+
3. Scroll down to '....'
29+
4. See error
30+
validations:
31+
required: true
32+
- type: textarea
33+
id: expected
34+
attributes:
35+
label: Expected behavior
36+
description: A clear and concise description of what you expected to happen
37+
validations:
38+
required: true
39+
- type: input
40+
id: vsh-version
41+
attributes:
42+
label: Virtual-Smart-Home Version
43+
placeholder: ex. 4.1.2
44+
validations:
45+
required: true
46+
- type: input
47+
id: nodered-version
48+
attributes:
49+
label: Node-RED Version
50+
placeholder: ex. 3.1.5
51+
validations:
52+
required: true
53+
- type: input
54+
id: nodejs-version
55+
attributes:
56+
label: Node.js Version
57+
placeholder: ex. 18.16.0
58+
validations:
59+
required: false
60+
- type: dropdown
61+
id: plan
62+
attributes:
63+
label: Plan
64+
options:
65+
- FREE
66+
- PRO
67+
validations:
68+
required: true
69+
- type: input
70+
id: thing-id
71+
attributes:
72+
description: You'll find your `Thing-ID` in the vsh-connection node
73+
label: Thing-ID
74+
placeholder: vsht-...
75+
validations:
76+
required: false
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Feature Request
2+
description: What would make Virtual-Smart-Home even better for you?
3+
assignees:
4+
- csuermann
5+
labels:
6+
- enhancement
7+
body:
8+
- type: markdown
9+
attributes:
10+
value: |
11+
Thanks for taking the time to share your idea!
12+
- type: textarea
13+
id: problem
14+
attributes:
15+
label: Problem Statement
16+
description: A clear and concise description of what the problem is
17+
placeholder: "Example: I'm always frustrated when..."
18+
validations:
19+
required: false
20+
- type: textarea
21+
id: solution
22+
attributes:
23+
label: Ideal Solution
24+
description: A clear and concise description of what you would want to happen
25+
validations:
26+
required: false
27+
- type: textarea
28+
id: alternatives
29+
attributes:
30+
label: Alternatives
31+
description: "Describe alternatives / workarounds you've considered"
32+
validations:
33+
required: false
34+
- type: textarea
35+
id: additional-context
36+
attributes:
37+
label: Additional context
38+
description: Provide any other context or screenshots about the feature request here
39+
validations:
40+
required: false

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Frequently Asked Questions
4+
url: https://github.com/csuermann/node-red-contrib-virtual-smart-home?tab=readme-ov-file#faq
5+
about: The answer to your question might already be there
6+
- name: Manage your PRO plan subscription
7+
url: https://billing.stripe.com/p/login/6oE00vdQ62Tp3LidQQ
8+
about: For users with an active PRO plan subscription

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 0 additions & 20 deletions
This file was deleted.

examples/alexa_to_homeassistant.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"type": "function",
2323
"z": "affffc88a48e1001",
2424
"name": "convert",
25-
"func": "const directiveToService = {\n TurnOff: \"turn_off\",\n TurnOn: \"turn_on\",\n SetBrightness: \"turn_on\",\n SetColorTemperature: \"turn_on\",\n SetColor: \"turn_on\"\n}\n\nconst {domain, entityId} = msg.metadata ?? {}\n\nconst service = directiveToService[msg.payload.directive]\n\nnode.status({\n fill: service == 'turn_on' ? 'yellow' : 'grey',\n shape: 'dot',\n text: msg.payload.directive\n})\n\nreturn {\n payload: {\n domain,\n service,\n data: {\n entity_id: domain + \".\" + entityId,\n ...(service === \"turn_on\" & msg.payload.brightness !== undefined && { brightness_pct: msg.payload.brightness}),\n ...(service === \"turn_on\" & msg.payload.color_xy !== undefined && msg.payload.lightMode === \"hsb\" && { color_xy: msg.payload.color_xy }),\n ...(service === \"turn_on\" & msg.payload.colorTemperatureInKelvin !== undefined & msg.payload.lightMode === \"temp\" && { color_temp: msg.payload.colorTemperatureInKelvin}) }\n }\n}",
25+
"func": "// Mapping of directives to Home Assistant services\nconst directiveToServiceMapping = {\n TurnOff: \"turn_off\",\n TurnOn: \"turn_on\",\n SetBrightness: \"turn_on\",\n SetColorTemperature: \"turn_on\",\n SetColor: \"turn_on\",\n AdjustBrightness: \"turn_on\"\n};\n\n// Extract metadata from the message, defaulting to an empty object\nconst { domain, entityId } = msg.metadata ?? {};\nconst service = directiveToServiceMapping[msg.payload.directive];\n\n// Set the node status visually in the Node-RED flow\nupdateNodeStatus(service, msg.payload.directive);\n\n// Generate payload data based on the service and message\nconst payloadData = generatePayloadData();\n\n// Construct and return the full payload\nreturn constructPayload(domain, service, payloadData);\n\n// Function definitions below\n\nfunction updateNodeStatus(service, directive) {\n node.status({\n fill: service === 'turn_on' ? 'yellow' : 'grey',\n shape: 'dot',\n text: directive\n });\n}\n\nfunction generatePayloadData() {\n const data = { entity_id: `${domain}.${entityId}` };\n\n if (service === \"turn_on\") {\n Object.assign(data, handleTurnOnConditions());\n }\n\n return data;\n}\n\nfunction handleTurnOnConditions() {\n const data = {};\n if (hasBrightness()) {\n data.brightness_pct = msg.payload.brightness;\n }\n if (isColorModeHSB()) {\n data.xy_color = msg.payload.color_xy;\n }\n if (isTemperatureMode()) {\n data.color_temp = convertKelvinToMireds(msg.payload.colorTemperatureInKelvin);\n }\n return data;\n}\n\nfunction hasBrightness() {\n return msg.payload.brightness !== undefined;\n}\n\nfunction isColorModeHSB() {\n return msg.payload.color_xy !== undefined && msg.payload.lightMode === \"hsb\";\n}\n\nfunction isTemperatureMode() {\n return msg.payload.colorTemperatureInKelvin !== undefined && msg.payload.lightMode === \"temp\";\n}\n\nfunction convertKelvinToMireds(kelvin) {\n // Converts Kelvin to Mireds to comply with Home Assistant's expected units\n return Math.round(1000000 / kelvin);\n}\n\nfunction constructPayload(domain, service, data) {\n return {\n payload: {\n domain,\n service,\n data\n }\n };\n}\n",
2626
"outputs": 1,
2727
"timeout": "",
2828
"noerr": 0,

0 commit comments

Comments
 (0)