Re: [mh] Adding ability to send arbitrary commands to Tasmota
Giles Godart-Brown <[email protected]>
| Newsgroups | gmane.comp.misc.misterhouse.user |
|---|---|
| Message-ID | <[email protected]> |
Thanks for the spot Paul, I only do an lc when no command is sent, and
returning on or off to be consistent with MisterHoues, but not otherwise.
I believe I saw this in the mqtt code too, I need to do some more
digging in the morning
Giles
On 03/02/2021 18:26, Paul Onley wrote:
> Giles,
>
> I noticed that the case of fields in the returned JSON is different
> between MQTT_DEVICE and the new Tasmota_HTTP::Item code. The
> Tasmota_HTTP::Item result seems to be consistent with the actual mqtt
> telemetry, is the MQTT_DEVICE code performing a lower() on the data or
> something?
>
> {"StatusSNS":{"Time":"2021-02-03T12:15:01","ENERGY":{"TotalStartTime":"2021-02-03T12:14:01","Total":0.000,"Yesterday":0.000,"Today":0.000,"Power":0,"ApparentPower":0,"ReactivePower":0,"Factor":0.00,"Voltage":0,"Current":0.000}}}
> {"time":"2021-02-03t12:14:07","energy":{"totalstarttime":"2021-02-03t12:14:01","total":0.000,"yesterday":0.000,"today":0.000,"period":0,"power":0,"apparentpower":0,"reactivepower":0,"factor":0.00,"voltage":0,"current":0.000}}
>
> Paul
>
> On 2/2/21 5:17 AM, Giles Godart-Brown wrote:
>>
>> All
>>
>> I've just created a pull request to extend Tasmota_HTTP::Item by
>> adding a run_cmnd subroutine to send arbitrary commands to a
>> MIsterHouse Tasmota item.
>>
>> * It returns the JSON response from the Tasmota and sets
>> $self->{run_cmnd_response} and $self->{last_http_status}
>> * It URL encodes the command so user doesn't need to
>> * If no command sent it decodes the json and returns the state of
>> the device e.g.
>> o $device->run_cmnd() returns on or off
>> o $device->run_cmnd('status 10') returns a json string of the
>> sensor status
>> o $device->run_cmnd('restart 1') reboots the Tasmota
>>
>> I hope people find this helpful
>>
>> Giles
>>
>>
>>
>> ________________________________________________________
>> To unsubscribe from this list, go to:https://lists.sourceforge.net/lists/listinfo/misterhouse-users
>>
>
>
>
> ________________________________________________________
> To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users
>
________________________________________________________
To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users