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

Z2m cover feature #1577

Merged
merged 3 commits into from
Oct 3, 2022
Merged

Conversation

atrovato
Copy link
Contributor

@atrovato atrovato commented Jul 24, 2022

Pull Request check-list

To ensure your Pull Request can be accepted as fast as possible, make sure to review and check all of these items:

  • If your changes affects code, did your write the tests?
  • Are tests passing? (npm test on both front/server)
  • Is the linter passing? (npm run eslint on both front/server)
  • Did you run prettier? (npm run prettier on both front/server)
  • If you are adding a new features/services, did you run integration comparator? (npm run compare-translations on front)
  • Did you test this pull request in real life? With real devices? If this development is a big feature or a new service, we recommend that you provide a Docker image to the community for testing before merging.
  • [ ] If your changes modify the API (REST or Node.js), did you modify the API documentation? (Documentation is based on comments in code)
  • [ ] If you are adding a new features/services which needs explanation, did you modify the user documentation? See the GitHub repo and the website.
  • [ ] Did you add fake requests data for the demo mode (front/src/config/demo.js) so that the demo website is working without a backend? (if needed) See https://demo.gladysassistant.com.

NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open.

Description of change

Linked to

Manage cover with z2m.

@codecov
Copy link

codecov bot commented Jul 24, 2022

Codecov Report

Base: 96.77% // Head: 96.77% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (af30069) compared to base (505df71).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1577   +/-   ##
=======================================
  Coverage   96.77%   96.77%           
=======================================
  Files         654      654           
  Lines        9662     9664    +2     
=======================================
+ Hits         9350     9352    +2     
  Misses        312      312           
Impacted Files Coverage Δ
server/services/zigbee2mqtt/exposes/numericType.js 100.00% <ø> (ø)
server/services/zigbee2mqtt/exposes/enumType.js 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@VonOx
Copy link
Contributor

VonOx commented Aug 1, 2022

Patched my production server to test with my device
front builded after patch, container restarted

image

discover json

  {
    "name": "Volet chambre Sasha",
    "model": "CCT5015-0001",
    "external_id": "zigbee2mqtt:Volet chambre Sasha",
    "features": [
      {
        "name": "State",
        "min": -1,
        "read_only": false,
        "has_feedback": true,
        "category": "shutter",
        "type": "state",
        "max": 1,
        "unit": null,
        "external_id": "zigbee2mqtt:Volet chambre Sasha:shutter:state:state",
        "selector": "zigbee2mqtt-volet-chambre-sasha-shutter-state-state"
      },
      {
        "name": "Position",
        "min": 0,
        "read_only": false,
        "has_feedback": true,
        "category": "shutter",
        "type": "position",
        "unit": "percent",
        "max": 100,
        "external_id": "zigbee2mqtt:Volet chambre Sasha:shutter:position:position",
        "selector": "zigbee2mqtt-volet-chambre-sasha-shutter-position-position"
      }
    ],
    "should_poll": false,
    "service_id": "0fccf6a6-0377-4678-b244-30d650619a42"
  }

Attempt to save
image

Not sure how I can help ( no log in server and no log in front )


I'va added the device manually in db

image

Button not working, level feature does.

@VonOx
Copy link
Contributor

VonOx commented Aug 3, 2022

@atrovato If it help

2022-08-03T14:34:20+0200 <error> handleMqttMessage.js:97 () Failed to convert value for device Volet chambre Sasha: Error: Zigbee2mqqt don't handle value "OPEN" for property "state".
    at Zigbee2mqttManager.readValue (/src/server/services/zigbee2mqtt/lib/readValue.js:22:11)
    at /src/server/services/zigbee2mqtt/lib/handleMqttMessage.js:93:31
    at Array.forEach (<anonymous>)
    at Zigbee2mqttManager.handleMqttMessage (/src/server/services/zigbee2mqtt/lib/handleMqttMessage.js:86:41)
    at MqttClient.<anonymous> (/src/server/services/zigbee2mqtt/lib/connect.js:53:12)
    at MqttClient.emit (events.js:400:28)
    at MqttClient._handlePublish (/src/server/services/zigbee2mqtt/node_modules/mqtt/lib/client.js:1277:12)
    at MqttClient._handlePacket (/src/server/services/zigbee2mqtt/node_modules/mqtt/lib/client.js:410:12)
    at work (/src/server/services/zigbee2mqtt/node_modules/mqtt/lib/client.js:321:12)
    at Writable.writable._write (/src/server/services/zigbee2mqtt/node_modules/mqtt/lib/client.js:335:5)
    at doWrite (/src/server/services/zigbee2mqtt/node_modules/readable-stream/lib/_stream_writable.js:409:139)
    at writeOrBuffer (/src/server/services/zigbee2mqtt/node_modules/readable-stream/lib/_stream_writable.js:398:5)
    at Writable.write (/src/server/services/zigbee2mqtt/node_modules/readable-stream/lib/_stream_writable.js:307:11)
    at Socket.ondata (internal/streams/readable.js:731:22)
    at Socket.emit (events.js:400:28)
    at addChunk (internal/streams/readable.js:293:12)
    at readableAddChunk (internal/streams/readable.js:267:9)
    at Socket.Readable.push (internal/streams/readable.js:206:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:188:23)

@atrovato
Copy link
Contributor Author

atrovato commented Aug 3, 2022

@VonOx don't you miss a commit?
I paste your payload in the demo mode, and I have a better display

image

I think you forgot both 8dc7103 and 8f81ccc commits (https://github.com/GladysAssistant/Gladys/pull/1576/commits).

@atrovato
Copy link
Contributor Author

atrovato commented Aug 3, 2022

Read again, softly, I agree there is another problem.

@VonOx
Copy link
Contributor

VonOx commented Aug 3, 2022

I don't think so, I used a patch file. 🤔

I will manually check every file tomorrow.

@atrovato
Copy link
Contributor Author

atrovato commented Aug 3, 2022

I pushed a new commit on z2m part, for the "readValue" error.
Please add 44c105d commit too.
And keep crossed fingers ;)

@VonOx
Copy link
Contributor

VonOx commented Aug 4, 2022

I've applied commit

Not working, and no error in logs for button.

But position throw error. ( the slider is working )

2022-08-04T09:26:07+0200 <error> handleMqttMessage.js:97 () Failed to convert value for device Volet chambre Sasha: Error: Zigbee2mqqt don't handle value "35" for property "position".
    at Zigbee2mqttManager.readValue (/src/server/services/zigbee2mqtt/lib/readValue.js:24:11)
    at /src/server/services/zigbee2mqtt/lib/handleMqttMessage.js:93:31
    at Array.forEach (<anonymous>)
    at Zigbee2mqttManager.handleMqttMessage (/src/server/services/zigbee2mqtt/lib/handleMqttMessage.js:86:41)
    at MqttClient.<anonymous> (/src/server/services/zigbee2mqtt/lib/connect.js:53:12)
    at MqttClient.emit (events.js:400:28)
    at MqttClient._handlePublish (/src/server/services/zigbee2mqtt/node_modules/mqtt/lib/client.js:1277:12)
    at MqttClient._handlePacket (/src/server/services/zigbee2mqtt/node_modules/mqtt/lib/client.js:410:12)
    at work (/src/server/services/zigbee2mqtt/node_modules/mqtt/lib/client.js:321:12)
    at Writable.writable._write (/src/server/services/zigbee2mqtt/node_modules/mqtt/lib/client.js:335:5)
    at doWrite (/src/server/services/zigbee2mqtt/node_modules/readable-stream/lib/_stream_writable.js:409:139)
    at writeOrBuffer (/src/server/services/zigbee2mqtt/node_modules/readable-stream/lib/_stream_writable.js:398:5)
    at Writable.write (/src/server/services/zigbee2mqtt/node_modules/readable-stream/lib/_stream_writable.js:307:11)
    at Socket.ondata (internal/streams/readable.js:731:22)
    at Socket.emit (events.js:400:28)
    at addChunk (internal/streams/readable.js:293:12)
    at readableAddChunk (internal/streams/readable.js:267:9)
    at Socket.Readable.push (internal/streams/readable.js:206:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:188:23)

Trying to edit the device ouput this error on front
image

@atrovato atrovato force-pushed the z2m-cover-feature branch from 44c105d to e32a6ad Compare August 6, 2022 05:41
@atrovato
Copy link
Contributor Author

atrovato commented Aug 6, 2022

This constant is in a server file server/utils/constants.js.
Did you copy it too?

I just rebase from #1576 branch (which was just rebased from latest merged changes on master branch).

@atrovato atrovato force-pushed the z2m-cover-feature branch 3 times, most recently from 9464a4b to 19e5aa3 Compare September 14, 2022 19:38
@atrovato atrovato marked this pull request as ready for review September 14, 2022 19:41
@atrovato
Copy link
Contributor Author

@VonOx
Copy link
Contributor

VonOx commented Sep 15, 2022

It's working now !

Animation

@Pierre-Gilles
Copy link
Contributor

Nice ! Can I merge ?

@VonOx
Copy link
Contributor

VonOx commented Sep 15, 2022

Yes no error with my device

@atrovato
Copy link
Contributor Author

I just rebase on master. Thanks @VonOx

Copy link
Contributor

@Pierre-Gilles Pierre-Gilles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work, thanks @atrovato 🙏

@Pierre-Gilles Pierre-Gilles merged commit ce240d4 into GladysAssistant:master Oct 3, 2022
@relativeci
Copy link

relativeci bot commented Oct 3, 2022

Job #516: Bundle Size — 7.02MB (+0.01%).

ce240d4 vs a1e079e

Changed metrics (2/10)
Metric Current Baseline
Initial JS 2.98MB(+0.02%) 2.98MB
Cache Invalidation 42.34% 66.17%
Changed assets by type (1/7)
            Current     Baseline
JS 4.99MB (+0.01%) 4.99MB

View Job #516 full report

euguuu pushed a commit to euguuu/Gladys that referenced this pull request Oct 4, 2022
@atrovato atrovato deleted the z2m-cover-feature branch March 18, 2023 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants