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

Device Default State On/Off #1172

Closed
soloam opened this issue Mar 1, 2019 · 31 comments
Closed

Device Default State On/Off #1172

soloam opened this issue Mar 1, 2019 · 31 comments
Labels
stale Stale issues

Comments

@soloam
Copy link

soloam commented Mar 1, 2019

Hello, I have some xiaomi plugs that I what always on as default, If I unplug them and then plug them, they stay off as default. Can I force ON?

Thank You

@Koenkk
Copy link
Owner

Koenkk commented Mar 1, 2019

Is this a setting that can be set when using the Xiaomi gateway?

@soloam
Copy link
Author

soloam commented Mar 1, 2019 via email

@soloam
Copy link
Author

soloam commented Mar 1, 2019

I checked... in the MiHome App there is a option to restore the state to the previews one! That would work!

@ryanbeaton
Copy link

#297 (comment)

@Koenkk
Copy link
Owner

Koenkk commented Mar 3, 2019

Can you sniff the zigbee traffic while setting this option? http://www.zigbee2mqtt.io/how_tos/how_to_sniff_zigbee_traffic.html

@soloam
Copy link
Author

soloam commented Mar 3, 2019 via email

@soloam
Copy link
Author

soloam commented Mar 4, 2019

Hello, here is the packet capture

export.zip

From what I can see he changes the 3 atributs in a row

@Koenkk
Copy link
Owner

Koenkk commented Mar 4, 2019

@soloam I don't have your network keys, either give me the network key, or you can post screenshots with all info here.

@soloam
Copy link
Author

soloam commented Mar 4, 2019

@Koenkk how can I send you a private message?

@Koenkk
Copy link
Owner

Koenkk commented Mar 4, 2019

@Koenkk on telegram.

Koenkk added a commit to Koenkk/zigbee-herdsman-converters that referenced this issue Mar 4, 2019
@Koenkk
Copy link
Owner

Koenkk commented Mar 4, 2019

Please try with the following changes: Koenkk/zigbee-herdsman-converters@49a728a

In the capture, it sends 4 different values to the same cluster/attribute ID. We need to figure out the correct one.
Send to zigbee2mqtt/[DEVICE_ID]/set payload {"power_on_behavior": VALUE} with the following VALUES:

  • aa:80:03:d3:07:41:03
  • aa:80:03:d3:07:40:02
  • aa:80:03:d3:07:3f:01
  • aa:80:05:d1:47:3e:01:10:01

After send each value, check if it uses the expected power on behavior.

@soloam
Copy link
Author

soloam commented Mar 5, 2019

Hello @Koenkk

I tried the chages, but it did not work. I publish the commands and I get this on the log

2019-3-5 09:09:47 - info: Zigbee publish to device '0x00158d00028a5428', genBasic - write - [{"attrId":65520,"dataType":65,"attrData":"aa:80:03:d3:07:3f:01"}] - {"manufSpec":1,"disDefaultRsp":1,"manufCode":4447} - null

No changes in the power on

Thank you

@Koenkk
Copy link
Owner

Koenkk commented Mar 6, 2019

When sniffing the command being send by zigbee2mqtt, Wireshark showed that the packet was malformed. It seems that zigbee-shepherd doesn't correctly from the octet string. Need to dive deeper here.

@wimpie007
Copy link

wimpie007 commented Mar 8, 2019

a default state would also be nice for the tradfri lamps...
They always are fysically ON after power on/off, and i get "off" as default state in HA.
(even last state is not always correct: after an "unavailable" it should always report "ON". (edit!)

@Koenkk
Copy link
Owner

Koenkk commented Mar 9, 2019

@wimpie007 unfortunately TRADFRI lamps don't support this, it's something that has to be solved at the firmware level of the TRADFRI bulbs.

@wimpie007
Copy link

coudnt we have a default state 'on' option?
now it is default 'off'. This would solve it for devices who doesnt remember its state after power on/off...

@Koenkk
Copy link
Owner

Koenkk commented Mar 9, 2019

@wimpie007 as you are using device availability, this should be fetched once this device comes back online. Please try with zigbee2mqtt 1.2.0, if it's not working please report in #775

@wimpie007
Copy link

@Koenkk: indeed! works in 1.2.1!
THANKS

@stale
Copy link

stale bot commented May 11, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Stale issues label May 11, 2019
@Koenkk Koenkk closed this as completed May 12, 2019
@Thulinma
Copy link
Contributor

Thulinma commented Jan 5, 2020

When sniffing the command being send by zigbee2mqtt, Wireshark showed that the packet was malformed. It seems that zigbee-shepherd doesn't correctly from the octet string. Need to dive deeper here.

I would like to pick this back up, as I also have a pair of ZNCZ02LM's and would like to be able to set the power-on behavior similarly.
@Koenkk I tried to update your code to the current format (I think...?) as follows:

    ZNCZ02LM_power_on_behavior: {
        key: ['power_on_behavior'],
        convertSet: async (entity, key, value, meta) => {
            await entity.write('genBasic', {0xFFF0: {value: value, type: 0x41}}, options.xiaomi);
        },
    },

But that fails with the message zigbee2mqtt:error 2020-01-05T16:48:27: Publish 'set' 'power_on_behavior' to '[DEVICE_ID]' failed: 'Error: Write for 'OCTETSTR' not available', and I'm not sure how to change that part...

Any hints? 😃

Koenkk added a commit to Koenkk/zigbee-herdsman that referenced this issue Jan 9, 2020
Koenkk added a commit to Koenkk/zigbee-herdsman-converters that referenced this issue Jan 9, 2020
@Koenkk
Copy link
Owner

Koenkk commented Jan 9, 2020

@Thulinma implemented, will be available in the latest dev branch in a few hours, documentation: https://github.com/Koenkk/zigbee2mqtt.io/blob/develop/docs/devices/ZNCZ02LM.md#power-outage-memory

@Thulinma
Copy link
Contributor

Thulinma commented Jan 9, 2020

Works like a charm, thanks! You just made my day 👍

@sirs2k
Copy link

sirs2k commented Mar 25, 2020

@Koenkk I'm on latest Dev and I don't know why I'm getting No converter available for 'power_outage_memory' (true)
By the way, does this restore the color settings too?

It's very annoying to have to change the color back to daylight whenever the kids turn the lights off from the switch

@Electronlibre2012
Copy link

Works like a charm, thanks! You just made my day 👍

Hello @Thulinma ,

i have folow the instructions but it doesnt work :
mqtt.publish
topic: zigbee2mqtt/Prise Salon tv/set
payload: "power_outage_memory: true"

then push the switch on the plug from OFF to ON,

then unplug / wait 5 secondes / plug again and the plug stay off.

I have not the DEV version of zigbee2mqtt, does i need to install the "edge" version to make it works please?

Thanks for your reply...i am stuck.

@Thulinma
Copy link
Contributor

Thulinma commented Dec 4, 2020

i have folow the instructions but it doesnt work :
mqtt.publish
topic: zigbee2mqtt/Prise Salon tv/set
payload: "power_outage_memory: true"

Make sure you use the payload {"power_outage_memory": true}, exactly like that. I'm not sure what application/syntax that is, but it looks like it doesn't match the required payload format...? I could be wrong about that, of course.

@Electronlibre2012
Copy link

Electronlibre2012 commented Dec 4, 2020

your the boss!!!

a big thank you

It as to be :

payload: '{"power_outage_memory": true}'

and after push the button "on" on the plug, i unplug / wait 5 seconds/ plug again, and...TADA! works as expected!!

Thanks again! have a nice week end

@jusxon
Copy link

jusxon commented Oct 26, 2022

@Koenkk Is it possible to get this supported on the US version of the plug (ZNCZ12LM)? It supports the same features as the EU plug, but when using the same settings as the EU plug in a custom converter on the US plug, it gives the error Publish 'get' 'power_outage_memory' to 'Plug' failed: 'Error: Not supported' as well as the error;

Error: Not supported at Object.convertSet (/app/node_modules/zigbee-herdsman-converters/converters/toZigbee.js:2235:23) at Publish.onMQTTMessage (/app/lib/extension/publish.ts:246:52) at EventEmitter.emit (node:events:539:35) at EventBus.emitMQTTMessage (/app/lib/eventBus.ts:109:22) at MQTT.onMessage (/app/lib/mqtt.ts:140:27) at WebSocket.<anonymous> (/app/lib/extension/frontend.ts:94:27) at WebSocket.emit (node:events:527:28) at Receiver.receiverOnMessage (/app/node_modules/ws/lib/websocket.js:1178:20) at Receiver.emit (node:events:527:28) at Receiver.dataMessage (/app/node_modules/ws/lib/receiver.js:528:14)

Thank you!

Koenkk added a commit to Koenkk/zigbee-herdsman-converters that referenced this issue Oct 26, 2022
@Koenkk
Copy link
Owner

Koenkk commented Oct 26, 2022

@jusxon done!

@jusxon
Copy link

jusxon commented Oct 28, 2022

Thank you very much!

Mephistofeles pushed a commit to Mephistofeles/zigbee-herdsman-converters that referenced this issue Dec 13, 2022
@thekev
Copy link

thekev commented Jan 21, 2023

I have a ZNCZ12LM showing firmware build date 12-24-2021. By date alone it appears to be a match for latest in zigbee-OTA - no other version info is exposed. On what firmware is this tested @jusxon ? It does not work for me. In attempting to toggle the value in Exposes, I receive the error:

Publish 'set' 'power_outage_memory' to 'plug1' failed: 'Error: Write 0x00158d0008ceee97/1 aqaraOpple({"513":{"value":1,"type":16}}, {"sendWhen":"immediate","timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":4447,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Status 'UNSUPPORTED_ATTRIBUTE')'

I also receive a similar error for overload_protection, led_disabled_night and auto_off. I also cannot read the value:

Publish 'get' 'power_outage_memory' to 'plug1' failed: 'Error: Read 0x00158d0008ceee97/1 aqaraOpple([513], {"sendWhen":"immediate","timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":4447,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Status 'UNSUPPORTED_ATTRIBUTE')'

@junosuarez
Copy link

I'm seeing the same as @thekev with UNSUPPORTED_ATTRIBUTE errors on read and write to overload_protection, led_disabled_night and auto_off. I purchased the device recently (February 2023):

  • Zigbee model: lumi.plug.maus01
  • Zigbee manufacturer: LUMI
  • Firmware: 12-24-2021

Example logs:

Debug 2023-02-24 09:31:47Received MQTT message on 'zigbee2mqtt/c-1007-aqara-power-plug/set' with data '{"led_disabled_night":true}'
Debug 2023-02-24 09:31:47Publishing 'set' 'led_disabled_night' to 'c-1007-aqara-power-plug'
Info 2023-02-24 09:31:47MQTT publish: topic 'zigbee2mqtt/c-1007-aqara-power-plug', payload '{"consumption":0.74,"device_temperature":29,"energy":0.74,"last_seen":"2023-02-24T09:31:47-08:00","led_disabled_night":false,"linkquality":168,"overload_protection":null,"power":47.51,"power_outage_count":8,"power_outage_memory":false,"state":"ON","update":{"installed_version":17,"latest_version":17,"state":"idle"}}'
Error 2023-02-24 09:31:47Publish 'set' 'led_disabled_night' to 'c-1007-aqara-power-plug' failed: 'Error: Write 0x00158d0008e1b9b6/1 aqaraOpple({"515":{"value":1,"type":16}}, {"sendWhen":"immediate","timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":4447,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Status 'UNSUPPORTED_ATTRIBUTE')'
Debug 2023-02-24 09:31:47Error: Write 0x00158d0008e1b9b6/1 aqaraOpple({"515":{"value":1,"type":16}}, {"sendWhen":"immediate","timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":4447,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Status 'UNSUPPORTED_ATTRIBUTE') at Endpoint.checkStatus (/app/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:317:28) at Endpoint.write (/app/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:397:22) at processTicksAndRejections (node:internal/process/task_queues:95:5) at Object.convertSet (/app/node_modules/zigbee-herdsman-converters/converters/toZigbee.js:2286:17) at Publish.onMQTTMessage (/app/lib/extension/publish.ts:246:36)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Stale issues
Projects
None yet
Development

No branches or pull requests

10 participants